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

Add functions to list keys of Function Apps #297

Merged
merged 8 commits into from Jul 10, 2019

Conversation

@mikhailshilkov
Copy link
Collaborator

commented Jul 8, 2019

Adds mixin functions to wrap ARM API calls to List Keys of Function Apps, as described in this issue.

Required for #295 or in case we want to support non-anonymous HTTP callback functions.

A function getServiceClientCredentials got introduced in core package. It might be useful for any REST interaction with the Azure Management API.

I enabled "format on save" in my VS Code, so some old lines got re-formated. Let me know if that's too annoying.

@mikhailshilkov mikhailshilkov requested a review from CyrusNajmabadi Jul 8, 2019
@mikhailshilkov

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 8, 2019

Note that we might get this from Terraform at some point, but they are blocked upstream, so probably not in short-term. See terraform-providers/terraform-provider-azurerm#699

@mikhailshilkov mikhailshilkov requested a review from CyrusNajmabadi Jul 9, 2019
};

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

This comment has been minimized.

Copy link
@CyrusNajmabadi

CyrusNajmabadi Jul 9, 2019

Contributor

i'm feeling dumb, but i cannot understand what this functionName is for. is it just to ensure that hte function has been created first before getFunctionKeys has been called? it seems weird...

This comment has been minimized.

Copy link
@ChristianEder

ChristianEder Jul 10, 2019

Contributor

Its used below in line 773 in the API call to the ARM Api to identify the function inside of the function app.

This comment has been minimized.

Copy link
@mikhailshilkov

mikhailshilkov Jul 10, 2019

Author Collaborator

Each function has its own set of keys in addition to the host keys, so the request URL contains the name as @ChristianEder kindly noticed

This comment has been minimized.

Copy link
@CyrusNajmabadi

CyrusNajmabadi Jul 10, 2019

Contributor

oh... doh. I see now. i was looking for functionName, and not 'name'. In general we actually like reusing the names (i.e. pulumi.all([this.id, functionName]).apply(async ([id, functionName]). It helps indicate they represent the same thing, and it makes sure that the outer variable is blocked from being used in the inner scope. I was looking for that pattern and that's what threw me off. This is all good, thanks for clarifying!

This comment has been minimized.

Copy link
@mikhailshilkov

mikhailshilkov Jul 10, 2019

Author Collaborator

That makes sense, I'll rename and pick up this pattern.

@CyrusNajmabadi

This comment has been minimized.

Copy link
Contributor

commented Jul 9, 2019

Done with review pass. LGTM, but i did hav ea question about something odd...

@mikhailshilkov mikhailshilkov merged commit a00afef into master Jul 10, 2019
2 checks passed
2 checks passed
Travis CI - Pull Request Build Passed
Details
Update Changelog Please update CHANGELOG.md
@pulumi-bot pulumi-bot deleted the mikhailshilkov/list-function-keys branch Jul 10, 2019
} else {
// `create()` will throw an error if the Az CLI is not installed or `az login` has never been run.
credentials = await msnodeauth.AzureCliCredentials.create();
}

This comment has been minimized.

Copy link
@lukehoban

lukehoban Jul 10, 2019

Member

Are we sure these are the complete set of configuration options supported by the Azure provider? I'm a little nervous re-creating this logic outside of the provider. Could we perhaps cross-reference to the primary source for this logic? (Ideally in the backing provider to make sure it's really the same as what the user is seeing for other @pulumi/azure operations.

This comment has been minimized.

Copy link
@mikhailshilkov

mikhailshilkov Jul 10, 2019

Author Collaborator

Yeah, me too... I don't know of the source of truth for this.
Ideally, I'd use some function provided by Pulumi core/Terraform which would give me an access token that the provider is already using. Is there something like that? I asked on Slack once but didn't get an answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.