Giter VIP home page Giter VIP logo

functions-triggers-bindings-example's Introduction

functions-triggers-bindings-example

Repo containing an example Azure Functions project that implements different types of input and output Bindings.

Accompanying blog posts:

Here are some blog posts giving more context and explaining the examples a bit more:

Examples

There are a few examples:

BlobTriggerInputBinding

This example shows you how to copy the triggering Blob into another container by coding it out completely. The steps implemented:

  • Connect to a Storage Account
  • Create a BlobClient
  • Get a reference to a container (and create it if it doesn't exist)
  • Get a reference to a blob
  • Upload the file

BlobTriggerInputBindingOutputBinding

This example shows you the power of an output binding: only one line of code to copy the blob!

BlobTriggerInputBindingOutputBinding2

In this Function, we add a message to a queue for each word in the triggering Blob. The only line of code we need for that is calling the Add() method on the ICollector<T>.

BlobTriggerInputBindingOutputBinding3

Dynamic output binding by using the Binder class.

HttpTriggerReturnBinding

The HttpTrigger isn't bound to a generic HttpRequest, but is TYPED to a RequestModel. The platform takes care of the deserialization of the message body for you.
The return binding above the Function does a couple of things for you:

  • It creates a Blob in the 'copied' container with a random GUID as the filename
  • It automatically writes the output of the Function call into that Blob

HttpTriggerPropertyBinding

The HttpTrigger isn't bound to a generic HttpRequest, but is TYPED to a RequestModel. The platform takes care of the deserialization of the message body for you.
The blob binding above the Function does a couple of things for you:

  • It creates a Blob in the 'properties' container with the value of the Identifier property as the filename
  • It writes the message of the posted model into that Blob

HttpTriggerTableInputBinding

In this Function example the Table Storage binding takes care of connecting to Table Storage. We’re automatically getting an instance of a CloudTable pointing to the right (partition of a) table, or even an instance of a typed entity, in the right storage account, all by simply specifying the binding the right way.

functions-triggers-bindings-example's People

Contributors

rickvdbosch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.