Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blob binding with custom file name

Tags:

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.

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

like image 972
Sean Feldman Avatar asked Oct 02 '16 06:10

Sean Feldman


1 Answers

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} 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.

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.

like image 192
mathewc Avatar answered Sep 22 '22 16:09

mathewc