Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input & Output bindings #289

Merged
merged 14 commits into from
Jul 11, 2019
Merged

Input & Output bindings #289

merged 14 commits into from
Jul 11, 2019

Conversation

mikhailshilkov
Copy link
Member

Introduce the concepts of Input and Output bindings to all Azure Function mixins. Started with Storage Queue Outputs and Storage Table Inputs.

@mikhailshilkov mikhailshilkov marked this pull request as ready for review June 25, 2019 12:22
@mikhailshilkov
Copy link
Member Author

The feature is not complete yet, but I think it's worth running through a review. What's left to do:

  • Enable input/output bindings for all other triggers in addition to HTTP and Storage
  • Create input/output bindings for all destinations in addition to Storage (this is a potentially wider list than trigger types, so I think we can do that as separate PRs)

@mikhailshilkov
Copy link
Member Author

Also tagging @ChristianEder

const greeting = new azure.appservice.HttpEventSubscription('greeting', {
resourceGroup,
route: "{name}",
inputOutputs: [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why inputOutputs and not bindings? Or 2 distinct properties, 1 for inputs, 1 for outputs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had both of your versions in the past drafts :)

I thought bindings might be confusing because they don't include the trigger (and the HTTP output), while technically a trigger is also a binding.

Two separate properties could make sense... I guess I'd need to have two distinct types then, to avoid misplacing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your remark about bindings might be true. I personally would prefer to have 2 separate properties, but that’s not a strong opinion. If you choose to make it into two properties, you could probably relatively easy prevent misplacing by adding & {direction:“out“} to the type definition of outputs (and similar for inputs)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think i woudl prefer two separate properties as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, I like it too

// Nothing is returned if a function has no output bindings
void |
// A dictionary is returned if a function has output bindings
Record<string, any>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move this into the main description? Also, can you doc what the keys/values are for this dictionary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

};

FunctionApp.prototype.getFunctionKeys = function(this: FunctionApp, functionName) {
return pulumi.all([this.id, functionName]).apply(async ([id, functionName]) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

export function combineBindingSettings(trigger: BindingSettings<BindingDefinition>,
inputs?: InputBindingSettings[],
outputs?: OutputBindingSettings[]) {
const all = [trigger, ...inputs || [], ...outputs || []];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wow. i didn't know that works. looks like that parses as ...(inputs || []).

@@ -44,7 +44,7 @@ const sampleFile = new azure.storage.Blob("test.html", {
const fileServer = new azure.appservice.HttpEventSubscription("file-server", {
resourceGroup,
route: "{name}",
inputOutputs: [
inputs: [
storageContainer.input("blob", { blobName: "{name}" }),
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i far prefer this :)

@CyrusNajmabadi
Copy link
Contributor

This is awesome. Sorry it took so long to get in!

@CyrusNajmabadi CyrusNajmabadi merged commit c406f63 into master Jul 11, 2019
@pulumi-bot pulumi-bot deleted the input-output-bindings branch July 11, 2019 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants