Add missing Aliases support in codegen
The Aliases implementation needs to be written.
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"
},
An interesting consideration for the alias API design: https://github.com/pulumi/pulumi/issues/2754#issuecomment-498677172
true, very interesting bit but can we codegen that type field somehow in codegen? @pawelprazak
Codegen should have enough information, yes.
As discussed on Slack, let's add typeToken filed with the Pulumi Type Token value to the ResourceCompanion using codegen
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 https://github.com/pulumi/pulumi/issues/2754#issuecomment-498677172
Relevant upstream integration tests: https://github.com/pulumi/pulumi/tree/master/tests/integration/aliases
Relevant use case: https://www.pulumi.com/blog/cumundi-guest-post/
Note to self: remember to investigate the difference between aliasURNs and aliases in the request.