Support methods (CALL) in codegen
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 85
- Forks
- 26
- Avg merge
- 11h 49m
- Merged PRs (30d)
- 22
Description
Hello!
- Vote on this issue by adding a 👍 reaction
- If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)
Issue details
Schema may define methods. For example consider getKubeconfig method in EKS provider.
$ curl https://raw.githubusercontent.com/pulumi/pulumi-eks/v0.37.1/provider/cmd/pulumi-resource-eks/schema.json -o ~/schemas/pulumi-eks-v0.37.1.json
jq ".resources[\"eks:index:Cluster\"].methods" ~/schemas/pulumi-eks-v0.37.1.json
{
"getKubeconfig": "eks:index:Cluster/getKubeconfig"
}
$ jq ".functions[\"eks:index:Cluster/getKubeconfig\"]" ~/schemas/pulumi-eks-v0.37.1.json
{
"description": "Generate a kubeconfig for cluster authentication that does not use the default AWS credential provider chain, and instead is scoped to the supported options in `KubeconfigOptions`.\n\nThe kubeconfig generated is automatically stringified for ease of use with the pulumi/kubernetes provider.\n\nSee for more details:\n- https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html\n- https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html\n- https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html",
"inputs": {
"properties": {
"__self__": {
"$ref": "#/resources/eks:index:Cluster"
},
"profileName": {
"type": "string",
"description": "AWS credential profile name to always use instead of the default AWS credential provider chain.\n\nThe profile is passed to kubeconfig as an authentication environment setting."
},
"roleArn": {
"type": "string",
"description": "Role ARN to assume instead of the default AWS credential provider chain.\n\nThe role is passed to kubeconfig as an authentication exec argument."
}
},
"required": [
"__self__"
]
},
"outputs": {
"properties": {
"result": {
"type": "string"
}
},
"required": [
"result"
]
}
}
We currently skip generating code for these. Instead we should generate instance methods on the appropriate resource class. For an example how this maps to a comparable language, consider this code in C#:
https://github.com/pulumi/pulumi-eks/blob/master/dotnet/Cluster.cs#L113
Affected area/feature
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining the schema.json example, especially resource methods and the corresponding function inputs and outputs. Compare the requested mapping with pulumi-eks's dotnet/Cluster.cs at line 113; done means generated Java resource classes expose instance methods for schema-defined CALL methods.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, java
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100