具有自定义文件名的 Blob 绑定 [英] Blob binding with custom file name

查看:26
本文介绍了具有自定义文件名的 Blob 绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用带有 Azure 函数的输出绑定到存储 Blob,我可以为存储 Blob 输出指定路径.路径要么是硬编码的,要么可以使用特殊的模板".示例:{rand-guid}.有没有办法在函数执行期间提供自定义模板来指定值?例如,使用触发器队列消息 ID 作为 Blob 名称.或者根据函数中的逻辑设置blob的扩展.正在寻找有关此主题的文档,但没有多少对主题有帮助.

Using an output binding with Azure function to a Storage Blob, I can specify for the Storage Blob output the path. The path is either hard-coded or a special "template" can be used. Example: {rand-guid}. Is there a way to provide a custom template to specify value during Function execution? For example, use the trigger queue message ID as the blob name. Or set extension of the blob based on the logic in the function. Was looking for the documentation on this topic, but there's not much that would help on the topic.

2016-10-05 更新已创建 详细帖子展示它是如何工作的.

Update 2016-10-05 Have created a detailed post to show how it works.

推荐答案

对于基于声明性模板的命名,许多支持的绑定表达式因触发器类型而异.例如.对于队列触发器,您实际上已经可以使用将绑定到消息 ID 的 {Id}.Bindings Quick Reference 但是那个文件有点过时了.

For the declarative template based naming many of the supported binding expressions vary per trigger type. E.g. for a queue trigger, you can actually already use {Id} which will bind to the message Id. Some of these built in binding parameters are listed on the Bindings Quick Reference but that document is somewhat out of date.

{rand-guid} 是我们最近添加的扩展,适用于所有绑定.请注意,我们正在寻求扩展这样的内置插件集并有一个未解决的问题 这里.请就您遇到的任何情况提出该问题.

{rand-guid} is a recent extension we added and applies to all bindings. Note that we're looking to expand the set of built ins like this and have an open issue here for that. Please chime in on that issue with any scenarios you have.

以上所有内容均适用于声明性规范.在 C# 中,您有一种高级方法可以在您的函数中强制 执行此操作,也可以使用 IBinder.请参阅 这篇文章 以获取显示此内容的示例.最终,我们也会向 Node 公开动态绑定功能,但目前还没有.我们正在 this 问题中跟踪该问题.

All of the above is for declarative specifications. In C# you there is an advanced way for you to do this imperatively in your function as well using IBinder. See this post for an example showing this. Eventually we'll expose that dynamic binding capability to Node as well, but it's not there yet. We're tracking that in this issue.

这篇关于具有自定义文件名的 Blob 绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆