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

查看:68
本文介绍了具有自定义文件名的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.其中一些内置的绑定参数在绑定快速参考,但该文档有些过时.

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公开这种动态绑定功能,但是还不存在.我们在问题中进行了跟踪.

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天全站免登陆