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
Simplify findFunctionSchema
#11575
Simplify findFunctionSchema
#11575
Conversation
Changelog[uncommitted] (2022-12-07) |
6fefb40
to
d83bd75
Compare
var subnets = vpc.Apply(vpc => Aws.Ec2.GetSubnetIds.Invoke(new() | ||
{ | ||
VpcId = vpc.Apply(getVpcResult => getVpcResult.Id), | ||
}); | ||
VpcId = vpc.Id, | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff doesn't look right. Although it compiles AFAIK, it makes for an ugly result with the outer apply. I think this is because an invoke bound to variable vpc
was no longer tracked in generater.functionInvokes
which caused this diff along with the other program diffs in the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It compiles, but I agree that it looks bad. I don't understand why we see any of the diffs that we see. I assumed that this change would be more or less diff free.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, we are missing on tokens like azure:core:getResourceGroup
, which should be azure:core/getResources:getResources
. I'll add a lowering step here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of lowering, I exposed the token -> schema.Function
mechanism that PCL uses during binding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Update test output Expose a token lookup method in PCL, and then use it instead of `schema.PackageReference.Functions().Get`.
d83bd75
to
6d4b3d6
Compare
bors r+ |
11564: [sdk/dotnet/nodejs] Add InvokeSingle variants to dotnet and nodejs SDKs r=Zaid-Ajaj a=Zaid-Ajaj <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description Needed for #11418 where we have invoke calls that return a simple type (such as `number`) but the runtime and engine _require_ the outputs to be a struct (as per the RPC definition) so here we are adding variants of `invoke` that unwraps the returned object and gets the first value from that object. For example, a provider with a schema `outputs: { type: "number" }` will have an invoke implementation that returns `{ __result: 42.0 }`, in these case (non-object return types) we use `InvokeSingle` instead of `Invoke` > It doesn't matter what the name of the key is, we always get the first value by first key. ## Checklist <!--- Please provide details if the checkbox below is to be left unchecked. --> - [ ] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Service, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. --> 11575: Simplify `findFunctionSchema` r=iwahbe a=iwahbe Instead of indirecting through .NET function names, just use the schema token to lookup the function. Co-authored-by: Zaid Ajaj <zaid.naom@gmail.com> Co-authored-by: Ian Wahbe <ian@wahbe.com>
Build failed (retrying...): |
Build succeeded: |
Instead of indirecting through .NET function names, just use the schema token to lookup the function.