pulumi/pkg/codegen
Justin Van Patten 4e9e017cd2
[codegen/python] Rename conflicting ResourceArgs classes (#7171)
Python resource constructor overloads were recently added that accept a
`<Resource>Args` class for input properties, as an alternative to the
other constructor overload that accepts keyword arguments. The name of
the new args class is the name of the resource concatenated with an
`Args` suffix.

Some providers (e.g. Kubernetes, Azure Native, and Google Native) have
input types with the same name as resources in the same module, which
results in two different `<Resource>Args` classes in the same module.

When you try to use the new args class with the constructor, e.g.:

```python
pulumi_kubernetes.storage.v1.StorageClass(
            resource_name='string',
            args=pulumi_kubernetes.storage.v1.StorageClassArgs(...),
            opts=pulumi.ResourceOptions(...),
)
```

You run into an error, because
`pulumi_kubernetes.storage.v1.StorageClassArgs` is actually referring to
the existing input type rather than the intended `StorageClassArgs`
class for the constructor arguments.

Having the duplicate classes hasn't broken existing usage of the input
type because we "export" all the input types for a module _after_ all
the resources and resource args classes are exported, so the input type
just ends up "overwriting" the duplicate resource args class.

Other languages don't have this problem because the input type is either
in it's own module/namespace (e.g. Node.js and .NET) or a different name
is used for the input type (Go). But with Python, the input types and
resources are all available in the same module.

To address this for Python, when there is an input type in the same
module with the same name as the resource, the args class for the
resource will be emitted as `<Resource>InitArgs` instead of
`<Resource>Args`.
2021-06-10 10:41:49 -07:00
..
docs [codegen/python] Rename conflicting ResourceArgs classes (#7171) 2021-06-10 10:41:49 -07:00
dotnet [codegen/dotnet] Fix plain properties (#7180) 2021-06-04 09:25:20 -07:00
go Fix Go init.go codegen to be govet compliant (#7195) 2021-06-04 13:57:04 +03:00
hcl2 Discriminated unions in schema and programgen 2021-05-05 10:01:22 +02:00
importer [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
internal/test [codegen/python] Rename conflicting ResourceArgs classes (#7171) 2021-06-10 10:41:49 -07:00
nodejs [codegen/go] Fix emitted type of resources and types (#7158) 2021-05-27 16:02:19 -07:00
python [codegen/python] Rename conflicting ResourceArgs classes (#7171) 2021-06-10 10:41:49 -07:00
schema Add schema support for methods (#7141) 2021-06-10 09:47:25 -07:00
docs.go Fix inconsistent object type naming. (#6686) 2021-04-15 19:03:28 -07:00
docs_test.go [codegen/docs] Reimplement example extraction. (#4851) 2020-06-18 12:32:15 -07:00
utilities.go Add helper methods to StringSet 2021-06-09 12:02:32 +02:00
utilities_test.go Add helper methods to StringSet 2021-06-09 12:02:32 +02:00
utilities_types.go Distinguish between inputty and plain args types. (#6811) 2021-04-19 16:40:39 -07:00