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 missing Aliases support in codegen #44

Open
lbialy opened this issue Jun 4, 2023 · 9 comments
Open

Add missing Aliases support in codegen #44

lbialy opened this issue Jun 4, 2023 · 9 comments
Labels
area/codegen Schema to code generator impact/broken Something that is difficult or impossible for some people to use kind/missing We are missing a part of functionality compared to upstream needs-triage Needs attention from the triage team
Milestone

Comments

@lbialy
Copy link
Collaborator

lbialy commented Jun 4, 2023

The Aliases implementation needs to be written.

@lbialy lbialy added generated-by-gpt4 [robot] From our robot overlords kind/missing We are missing a part of functionality compared to upstream labels Jun 4, 2023
@pawelprazak pawelprazak added area/codegen Schema to code generator area/core The SDK's core code impact/broken Something that is difficult or impossible for some people to use needs-triage Needs attention from the triage team and removed generated-by-gpt4 [robot] From our robot overlords labels Nov 10, 2023
@pawelprazak
Copy link
Contributor

Metaschema:

                 "aliases": {
                    "description": "The list of aliases for the resource.",
                    "type": "array",
                    "items": {
                        "title": "Alias Definition",
                        "type": "object",
                        "properties": {
                            "name": {
                                "description": "The name portion of the alias, if any",
                                "type": "string"
                            },
                            "project": {
                                "description": "The project portion of the alias, if any",
                                "type": "string"
                            },
                            "type": {
                                "description": "The type portion of the alias, if any",
                                "type": "string"
                            }
                        }
                    }
                },

Production schema fragments:

"aliases": [
  {
    "type": "azure-native:machinelearningservices/v20210301preview:BatchDeployment"
  }
]
"aliases": {
  "type": "array",
  "items": {
    "type": "string"
  }
},
"aliases": {
  "type": "array",
  "items": {
    "type": "string"
  },
  "description": "The network aliases of the container in the specific network.\n",
  "willReplaceOnChanges": true
},
"aliases": {
  "type": "object",
  "additionalProperties": {
    "type": "string"
  },
  "description": "A set of key/value aliases pairs to assign to the IoT Core Device\n"
},

@pawelprazak pawelprazak changed the title Implement Aliases Add missing Aliases support in codegen and core Nov 10, 2023
@pawelprazak
Copy link
Contributor

An interesting consideration for the alias API design:
pulumi/pulumi#2754 (comment)

@lbialy lbialy added this to the 0.2.0 milestone Jan 11, 2024
@lbialy
Copy link
Collaborator Author

lbialy commented Jan 25, 2024

true, very interesting bit but can we codegen that type field somehow in codegen? @pawelprazak

@pawelprazak
Copy link
Contributor

Codegen should have enough information, yes.

@pawelprazak
Copy link
Contributor

pawelprazak commented Feb 6, 2024

As discussed on Slack, let's add typeToken filed with the Pulumi Type Token value to the ResourceCompanion using codegen

@pawelprazak
Copy link
Contributor

pawelprazak commented Feb 6, 2024

looks like we've already added the typeToken :D

e.g.

object Cluster extends besom.ResourceCompanion[Cluster]:
  def apply(using ctx: besom.types.Context)(
    name: besom.util.NonEmptyString,
    args: ClusterArgs = ClusterArgs(),
    opts: besom.ResourceOptsVariant.Custom ?=> besom.CustomResourceOptions = besom.CustomResourceOptions()
  ): besom.types.Output[Cluster] =
    ctx.readOrRegisterResource[Cluster, ClusterArgs]("google-native:container/v1:Cluster", name, args, opts(using besom.ResourceOptsVariant.Custom))

  private[besom] def typeToken: besom.types.ResourceType = "google-native:container/v1:Cluster"
  ...

So when implementing the aliases we can do as suggested here pulumi/pulumi#2754 (comment)

@pawelprazak
Copy link
Contributor

Relevant upstream integration tests: https://github.com/pulumi/pulumi/tree/master/tests/integration/aliases

@pawelprazak
Copy link
Contributor

Relevant use case: https://www.pulumi.com/blog/cumundi-guest-post/

@pawelprazak pawelprazak modified the milestones: 0.3.0, 1.0.0 Apr 2, 2024
@pawelprazak
Copy link
Contributor

Note to self: remember to investigate the difference between aliasURNs and aliases in the request.

@lbialy lbialy changed the title Add missing Aliases support in codegen and core Add missing Aliases support in codegen Jul 3, 2024
@lbialy lbialy removed the area/core The SDK's core code label Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/codegen Schema to code generator impact/broken Something that is difficult or impossible for some people to use kind/missing We are missing a part of functionality compared to upstream needs-triage Needs attention from the triage team
Projects
None yet
Development

No branches or pull requests

2 participants