diff --git a/changelog/pending/20221017--sdkgen-go-python--handle-hyphenated-names.yaml b/changelog/pending/20221017--sdkgen-go-python--handle-hyphenated-names.yaml new file mode 100644 index 000000000000..43ac9f52516f --- /dev/null +++ b/changelog/pending/20221017--sdkgen-go-python--handle-hyphenated-names.yaml @@ -0,0 +1,4 @@ +changes: +- type: fix + scope: sdkgen/go,python + description: Handle hypheneated names in go and python diff --git a/pkg/codegen/python/utilities.go b/pkg/codegen/python/utilities.go index 6f5325b9a99d..911bded0e697 100644 --- a/pkg/codegen/python/utilities.go +++ b/pkg/codegen/python/utilities.go @@ -197,6 +197,6 @@ func pythonCase(s string) string { underscores += "_" return true }) - c := cgstrings.Camel(noUnderscores) + c := cgstrings.Unhyphenate(noUnderscores) return underscores + cgstrings.UppercaseFirst(c) } diff --git a/pkg/codegen/python/utilities_test.go b/pkg/codegen/python/utilities_test.go index 313df023733b..4fc5c0ff812f 100644 --- a/pkg/codegen/python/utilities_test.go +++ b/pkg/codegen/python/utilities_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/blang/semver" + "github.com/stretchr/testify/assert" "github.com/hashicorp/hcl/v2" "github.com/pulumi/pulumi/pkg/v3/codegen/hcl2/syntax" @@ -101,3 +102,20 @@ func TestMakePyPiVersion(t *testing.T) { }) } } + +func TestPythonCase(t *testing.T) { + t.Parallel() + + tests := []struct{ input, expected string }{ + {"FOOBarInput", "FOOBarInput"}, + {"foo-bar", "FooBar"}, + } + + for _, tt := range tests { + tt := tt + t.Run(tt.input, func(t *testing.T) { + t.Parallel() + assert.Equal(t, tt.expected, pythonCase(tt.input)) + }) + } +} diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/docs/codegen-manifest.json b/pkg/codegen/testing/test/testdata/dash-named-schema/docs/codegen-manifest.json index 9d5bfc37f29f..988aebf64616 100644 --- a/pkg/codegen/testing/test/testdata/dash-named-schema/docs/codegen-manifest.json +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/docs/codegen-manifest.json @@ -3,6 +3,7 @@ "_index.md", "provider/_index.md", "submodule1/_index.md", + "submodule1/fooencryptedbarclass/_index.md", "submodule1/moduleresource/_index.md" ] } diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/docs/submodule1/_index.md b/pkg/codegen/testing/test/testdata/dash-named-schema/docs/submodule1/_index.md index e8b321efc489..e6d6d5c115c8 100644 --- a/pkg/codegen/testing/test/testdata/dash-named-schema/docs/submodule1/_index.md +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/docs/submodule1/_index.md @@ -13,6 +13,7 @@ Explore the resources and functions of the foo-bar.submodule1 module.

Resources

diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/docs/submodule1/fooencryptedbarclass/_index.md b/pkg/codegen/testing/test/testdata/dash-named-schema/docs/submodule1/fooencryptedbarclass/_index.md new file mode 100644 index 000000000000..4600faf68c58 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/docs/submodule1/fooencryptedbarclass/_index.md @@ -0,0 +1,366 @@ + +--- +title: "FOOEncryptedBarClass" +title_tag: "foo-bar.submodule1.FOOEncryptedBarClass" +meta_desc: "Documentation for the foo-bar.submodule1.FOOEncryptedBarClass resource with examples, input properties, output properties, lookup functions, and supporting types." +layout: api +no_edit_this_page: true +--- + + + + + + + + + +## Create FOOEncryptedBarClass Resource {#create} +
+ +
+ + +
+ +
new FOOEncryptedBarClass(name: string, args?: FOOEncryptedBarClassArgs, opts?: CustomResourceOptions);
+
+
+ +
+ +
@overload
+def FOOEncryptedBarClass(resource_name: str,
+                         opts: Optional[ResourceOptions] = None)
+@overload
+def FOOEncryptedBarClass(resource_name: str,
+                         args: Optional[FOOEncryptedBarClassArgs] = None,
+                         opts: Optional[ResourceOptions] = None)
+
+
+ +
+ +
func NewFOOEncryptedBarClass(ctx *Context, name string, args *FOOEncryptedBarClassArgs, opts ...ResourceOption) (*FOOEncryptedBarClass, error)
+
+
+ +
+ +
public FOOEncryptedBarClass(string name, FOOEncryptedBarClassArgs? args = null, CustomResourceOptions? opts = null)
+
+
+ +
+ +
+public FOOEncryptedBarClass(String name, FOOEncryptedBarClassArgs args)
+public FOOEncryptedBarClass(String name, FOOEncryptedBarClassArgs args, CustomResourceOptions options)
+
+
+
+ +
+ +
type: foo-bar:submodule1:FOOEncryptedBarClass
+properties: # The arguments to resource properties.
+options: # Bag of options to control resource's behavior.
+
+
+
+
+ +
+ + +
+ name + + string +
+
The unique name of the resource.
+ args + + FOOEncryptedBarClassArgs +
+
The arguments to resource properties.
+ opts + + CustomResourceOptions +
+
Bag of options to control resource's behavior.
+ +
+
+ +
+ + +
+ resource_name + + str +
+
The unique name of the resource.
+ args + + FOOEncryptedBarClassArgs +
+
The arguments to resource properties.
+ opts + + ResourceOptions +
+
Bag of options to control resource's behavior.
+ +
+
+ +
+ + +
+ ctx + + Context +
+
Context object for the current deployment.
+ name + + string +
+
The unique name of the resource.
+ args + + FOOEncryptedBarClassArgs +
+
The arguments to resource properties.
+ opts + + ResourceOption +
+
Bag of options to control resource's behavior.
+ +
+
+ +
+ + +
+ name + + string +
+
The unique name of the resource.
+ args + + FOOEncryptedBarClassArgs +
+
The arguments to resource properties.
+ opts + + CustomResourceOptions +
+
Bag of options to control resource's behavior.
+ +
+
+ +
+ + +
+ name + + String +
+
The unique name of the resource.
+ args + + FOOEncryptedBarClassArgs +
+
The arguments to resource properties.
+ options + + CustomResourceOptions +
+
Bag of options to control resource's behavior.
+ +
+
+ +## FOOEncryptedBarClass Resource Properties {#properties} + +To learn more about resource properties and how to use them, see [Inputs and Outputs](/docs/intro/concepts/inputs-outputs) in the Architecture and Concepts docs. + +### Inputs + +The FOOEncryptedBarClass resource accepts the following [input](/docs/intro/concepts/inputs-outputs) properties: + + + +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + +### Outputs + +All [input](#inputs) properties are implicitly available as output properties. Additionally, the FOOEncryptedBarClass resource produces the following output properties: + + + +
+ +
+ +Id + + + string +
+

The provider-assigned unique ID for this managed resource.

+
+
+
+ +
+ +
+ +Id + + + string +
+

The provider-assigned unique ID for this managed resource.

+
+
+
+ +
+ +
+ +id + + + String +
+

The provider-assigned unique ID for this managed resource.

+
+
+
+ +
+ +
+ +id + + + string +
+

The provider-assigned unique ID for this managed resource.

+
+
+
+ +
+ +
+ +id + + + str +
+

The provider-assigned unique ID for this managed resource.

+
+
+
+ +
+ +
+ +id + + + String +
+

The provider-assigned unique ID for this managed resource.

+
+
+
+ + + + + + + + +

Package Details

+
+
Repository
+
+
License
+
+
+ diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/dotnet/Submodule1/FOOEncryptedBarClass.cs b/pkg/codegen/testing/test/testdata/dash-named-schema/dotnet/Submodule1/FOOEncryptedBarClass.cs new file mode 100644 index 000000000000..ad10dbd6e6b1 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/dotnet/Submodule1/FOOEncryptedBarClass.cs @@ -0,0 +1,64 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading.Tasks; +using Pulumi.Serialization; + +namespace Pulumi.FooBar.Submodule1 +{ + [FooBarResourceType("foo-bar:submodule1:FOOEncryptedBarClass")] + public partial class FOOEncryptedBarClass : global::Pulumi.CustomResource + { + /// + /// Create a FOOEncryptedBarClass resource with the given unique name, arguments, and options. + /// + /// + /// The unique name of the resource + /// The arguments used to populate this resource's properties + /// A bag of options that control this resource's behavior + public FOOEncryptedBarClass(string name, FOOEncryptedBarClassArgs? args = null, CustomResourceOptions? options = null) + : base("foo-bar:submodule1:FOOEncryptedBarClass", name, args ?? new FOOEncryptedBarClassArgs(), MakeResourceOptions(options, "")) + { + } + + private FOOEncryptedBarClass(string name, Input id, CustomResourceOptions? options = null) + : base("foo-bar:submodule1:FOOEncryptedBarClass", name, null, MakeResourceOptions(options, id)) + { + } + + private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input? id) + { + var defaultOptions = new CustomResourceOptions + { + Version = Utilities.Version, + }; + var merged = CustomResourceOptions.Merge(defaultOptions, options); + // Override the ID if one was specified for consistency with other language SDKs. + merged.Id = id ?? merged.Id; + return merged; + } + /// + /// Get an existing FOOEncryptedBarClass resource's state with the given name, ID, and optional extra + /// properties used to qualify the lookup. + /// + /// + /// The unique name of the resulting resource. + /// The unique provider ID of the resource to lookup. + /// A bag of options that control this resource's behavior + public static FOOEncryptedBarClass Get(string name, Input id, CustomResourceOptions? options = null) + { + return new FOOEncryptedBarClass(name, id, options); + } + } + + public sealed class FOOEncryptedBarClassArgs : global::Pulumi.ResourceArgs + { + public FOOEncryptedBarClassArgs() + { + } + public static new FOOEncryptedBarClassArgs Empty => new FOOEncryptedBarClassArgs(); + } +} diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/dotnet/codegen-manifest.json b/pkg/codegen/testing/test/testdata/dash-named-schema/dotnet/codegen-manifest.json index c296f3688727..3fd150c31bc4 100644 --- a/pkg/codegen/testing/test/testdata/dash-named-schema/dotnet/codegen-manifest.json +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/dotnet/codegen-manifest.json @@ -5,6 +5,7 @@ "Provider.cs", "Pulumi.FooBar.csproj", "README.md", + "Submodule1/FOOEncryptedBarClass.cs", "Submodule1/ModuleResource.cs", "Submodule1/README.md", "Utilities.cs", diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/go/codegen-manifest.json b/pkg/codegen/testing/test/testdata/dash-named-schema/go/codegen-manifest.json index 98dd741a35bd..e2c404da454f 100644 --- a/pkg/codegen/testing/test/testdata/dash-named-schema/go/codegen-manifest.json +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/go/codegen-manifest.json @@ -6,6 +6,7 @@ "foo/pulumi-plugin.json", "foo/pulumiTypes.go", "foo/pulumiUtilities.go", + "foo/submodule1/fooencryptedBarClass.go", "foo/submodule1/init.go", "foo/submodule1/moduleResource.go" ] diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/go/foo/submodule1/fooencryptedBarClass.go b/pkg/codegen/testing/test/testdata/dash-named-schema/go/foo/submodule1/fooencryptedBarClass.go new file mode 100644 index 000000000000..c1b14960a296 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/go/foo/submodule1/fooencryptedBarClass.go @@ -0,0 +1,102 @@ +// Code generated by test DO NOT EDIT. +// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** + +package submodule1 + +import ( + "context" + "reflect" + + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +) + +type FOOEncryptedBarClass struct { + pulumi.CustomResourceState +} + +// NewFOOEncryptedBarClass registers a new resource with the given unique name, arguments, and options. +func NewFOOEncryptedBarClass(ctx *pulumi.Context, + name string, args *FOOEncryptedBarClassArgs, opts ...pulumi.ResourceOption) (*FOOEncryptedBarClass, error) { + if args == nil { + args = &FOOEncryptedBarClassArgs{} + } + + var resource FOOEncryptedBarClass + err := ctx.RegisterResource("foo-bar:submodule1:FOOEncryptedBarClass", name, args, &resource, opts...) + if err != nil { + return nil, err + } + return &resource, nil +} + +// GetFOOEncryptedBarClass gets an existing FOOEncryptedBarClass resource's state with the given name, ID, and optional +// state properties that are used to uniquely qualify the lookup (nil if not required). +func GetFOOEncryptedBarClass(ctx *pulumi.Context, + name string, id pulumi.IDInput, state *FOOEncryptedBarClassState, opts ...pulumi.ResourceOption) (*FOOEncryptedBarClass, error) { + var resource FOOEncryptedBarClass + err := ctx.ReadResource("foo-bar:submodule1:FOOEncryptedBarClass", name, id, state, &resource, opts...) + if err != nil { + return nil, err + } + return &resource, nil +} + +// Input properties used for looking up and filtering FOOEncryptedBarClass resources. +type fooencryptedBarClassState struct { +} + +type FOOEncryptedBarClassState struct { +} + +func (FOOEncryptedBarClassState) ElementType() reflect.Type { + return reflect.TypeOf((*fooencryptedBarClassState)(nil)).Elem() +} + +type fooencryptedBarClassArgs struct { +} + +// The set of arguments for constructing a FOOEncryptedBarClass resource. +type FOOEncryptedBarClassArgs struct { +} + +func (FOOEncryptedBarClassArgs) ElementType() reflect.Type { + return reflect.TypeOf((*fooencryptedBarClassArgs)(nil)).Elem() +} + +type FOOEncryptedBarClassInput interface { + pulumi.Input + + ToFOOEncryptedBarClassOutput() FOOEncryptedBarClassOutput + ToFOOEncryptedBarClassOutputWithContext(ctx context.Context) FOOEncryptedBarClassOutput +} + +func (*FOOEncryptedBarClass) ElementType() reflect.Type { + return reflect.TypeOf((**FOOEncryptedBarClass)(nil)).Elem() +} + +func (i *FOOEncryptedBarClass) ToFOOEncryptedBarClassOutput() FOOEncryptedBarClassOutput { + return i.ToFOOEncryptedBarClassOutputWithContext(context.Background()) +} + +func (i *FOOEncryptedBarClass) ToFOOEncryptedBarClassOutputWithContext(ctx context.Context) FOOEncryptedBarClassOutput { + return pulumi.ToOutputWithContext(ctx, i).(FOOEncryptedBarClassOutput) +} + +type FOOEncryptedBarClassOutput struct{ *pulumi.OutputState } + +func (FOOEncryptedBarClassOutput) ElementType() reflect.Type { + return reflect.TypeOf((**FOOEncryptedBarClass)(nil)).Elem() +} + +func (o FOOEncryptedBarClassOutput) ToFOOEncryptedBarClassOutput() FOOEncryptedBarClassOutput { + return o +} + +func (o FOOEncryptedBarClassOutput) ToFOOEncryptedBarClassOutputWithContext(ctx context.Context) FOOEncryptedBarClassOutput { + return o +} + +func init() { + pulumi.RegisterInputType(reflect.TypeOf((*FOOEncryptedBarClassInput)(nil)).Elem(), &FOOEncryptedBarClass{}) + pulumi.RegisterOutputType(FOOEncryptedBarClassOutput{}) +} diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/go/foo/submodule1/init.go b/pkg/codegen/testing/test/testdata/dash-named-schema/go/foo/submodule1/init.go index d58dab59c6da..9e9454c23c8a 100644 --- a/pkg/codegen/testing/test/testdata/dash-named-schema/go/foo/submodule1/init.go +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/go/foo/submodule1/init.go @@ -21,6 +21,8 @@ func (m *module) Version() semver.Version { func (m *module) Construct(ctx *pulumi.Context, name, typ, urn string) (r pulumi.Resource, err error) { switch typ { + case "foo-bar:submodule1:FOOEncryptedBarClass": + r = &FOOEncryptedBarClass{} case "foo-bar:submodule1:ModuleResource": r = &ModuleResource{} default: diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/codegen-manifest.json b/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/codegen-manifest.json index 091408daedec..648ba63dec11 100644 --- a/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/codegen-manifest.json +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/codegen-manifest.json @@ -5,6 +5,7 @@ "package.json", "provider.ts", "scripts/install-pulumi-plugin.js", + "submodule1/fooencryptedBarClass.ts", "submodule1/index.ts", "submodule1/moduleResource.ts", "tsconfig.json", diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/submodule1/fooencryptedBarClass.ts b/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/submodule1/fooencryptedBarClass.ts new file mode 100644 index 000000000000..e8650ff4eb76 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/submodule1/fooencryptedBarClass.ts @@ -0,0 +1,57 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +import * as pulumi from "@pulumi/pulumi"; +import * as utilities from "../utilities"; + +export class FOOEncryptedBarClass extends pulumi.CustomResource { + /** + * Get an existing FOOEncryptedBarClass resource's state with the given name, ID, and optional extra + * properties used to qualify the lookup. + * + * @param name The _unique_ name of the resulting resource. + * @param id The _unique_ provider ID of the resource to lookup. + * @param opts Optional settings to control the behavior of the CustomResource. + */ + public static get(name: string, id: pulumi.Input, opts?: pulumi.CustomResourceOptions): FOOEncryptedBarClass { + return new FOOEncryptedBarClass(name, undefined as any, { ...opts, id: id }); + } + + /** @internal */ + public static readonly __pulumiType = 'foo-bar:submodule1:FOOEncryptedBarClass'; + + /** + * Returns true if the given object is an instance of FOOEncryptedBarClass. This is designed to work even + * when multiple copies of the Pulumi SDK have been loaded into the same process. + */ + public static isInstance(obj: any): obj is FOOEncryptedBarClass { + if (obj === undefined || obj === null) { + return false; + } + return obj['__pulumiType'] === FOOEncryptedBarClass.__pulumiType; + } + + + /** + * Create a FOOEncryptedBarClass resource with the given unique name, arguments, and options. + * + * @param name The _unique_ name of the resource. + * @param args The arguments to use to populate this resource's properties. + * @param opts A bag of options that control this resource's behavior. + */ + constructor(name: string, args?: FOOEncryptedBarClassArgs, opts?: pulumi.CustomResourceOptions) { + let resourceInputs: pulumi.Inputs = {}; + opts = opts || {}; + if (!opts.id) { + } else { + } + opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); + super(FOOEncryptedBarClass.__pulumiType, name, resourceInputs, opts); + } +} + +/** + * The set of arguments for constructing a FOOEncryptedBarClass resource. + */ +export interface FOOEncryptedBarClassArgs { +} diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/submodule1/index.ts b/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/submodule1/index.ts index a09ded660106..63fa43d1ee83 100644 --- a/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/submodule1/index.ts +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/submodule1/index.ts @@ -5,6 +5,11 @@ import * as pulumi from "@pulumi/pulumi"; import * as utilities from "../utilities"; // Export members: +export { FOOEncryptedBarClassArgs } from "./fooencryptedBarClass"; +export type FOOEncryptedBarClass = import("./fooencryptedBarClass").FOOEncryptedBarClass; +export const FOOEncryptedBarClass: typeof import("./fooencryptedBarClass").FOOEncryptedBarClass = null as any; +utilities.lazyLoad(exports, ["FOOEncryptedBarClass"], () => require("./fooencryptedBarClass")); + export { ModuleResourceArgs } from "./moduleResource"; export type ModuleResource = import("./moduleResource").ModuleResource; export const ModuleResource: typeof import("./moduleResource").ModuleResource = null as any; @@ -15,6 +20,8 @@ const _module = { version: utilities.getVersion(), construct: (name: string, type: string, urn: string): pulumi.Resource => { switch (type) { + case "foo-bar:submodule1:FOOEncryptedBarClass": + return new FOOEncryptedBarClass(name, undefined, { urn }) case "foo-bar:submodule1:ModuleResource": return new ModuleResource(name, undefined, { urn }) default: diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/tsconfig.json index ee52f3044f5a..63b822f490aa 100644 --- a/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/tsconfig.json @@ -15,6 +15,7 @@ "files": [ "index.ts", "provider.ts", + "submodule1/fooencryptedBarClass.ts", "submodule1/index.ts", "submodule1/moduleResource.ts", "types/index.ts", diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/python/codegen-manifest.json b/pkg/codegen/testing/test/testdata/dash-named-schema/python/codegen-manifest.json index 853fcc743ba0..bf545676d6ba 100644 --- a/pkg/codegen/testing/test/testdata/dash-named-schema/python/codegen-manifest.json +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/python/codegen-manifest.json @@ -9,6 +9,7 @@ "pulumi_foo_bar/pulumi-plugin.json", "pulumi_foo_bar/py.typed", "pulumi_foo_bar/submodule1/__init__.py", + "pulumi_foo_bar/submodule1/foo_encrypted_bar_class.py", "pulumi_foo_bar/submodule1/module_resource.py", "setup.py" ] diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/python/pulumi_foo_bar/__init__.py b/pkg/codegen/testing/test/testdata/dash-named-schema/python/pulumi_foo_bar/__init__.py index 9ba70b791701..5fcf9dc2e553 100644 --- a/pkg/codegen/testing/test/testdata/dash-named-schema/python/pulumi_foo_bar/__init__.py +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/python/pulumi_foo_bar/__init__.py @@ -24,6 +24,7 @@ "mod": "submodule1", "fqn": "pulumi_foo_bar.submodule1", "classes": { + "foo-bar:submodule1:FOOEncryptedBarClass": "FOOEncryptedBarClass", "foo-bar:submodule1:ModuleResource": "ModuleResource" } } diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/python/pulumi_foo_bar/submodule1/__init__.py b/pkg/codegen/testing/test/testdata/dash-named-schema/python/pulumi_foo_bar/submodule1/__init__.py index 35c52485638f..74ab07d2a574 100644 --- a/pkg/codegen/testing/test/testdata/dash-named-schema/python/pulumi_foo_bar/submodule1/__init__.py +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/python/pulumi_foo_bar/submodule1/__init__.py @@ -5,4 +5,5 @@ from .. import _utilities import typing # Export this package's modules as members: +from .foo_encrypted_bar_class import * from .module_resource import * diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/python/pulumi_foo_bar/submodule1/foo_encrypted_bar_class.py b/pkg/codegen/testing/test/testdata/dash-named-schema/python/pulumi_foo_bar/submodule1/foo_encrypted_bar_class.py new file mode 100644 index 000000000000..417ebaba70e7 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/python/pulumi_foo_bar/submodule1/foo_encrypted_bar_class.py @@ -0,0 +1,89 @@ +# coding=utf-8 +# *** WARNING: this file was generated by test. *** +# *** Do not edit by hand unless you're certain you know what you are doing! *** + +import copy +import warnings +import pulumi +import pulumi.runtime +from typing import Any, Mapping, Optional, Sequence, Union, overload +from .. import _utilities + +__all__ = ['FOOEncryptedBarClassArgs', 'FOOEncryptedBarClass'] + +@pulumi.input_type +class FOOEncryptedBarClassArgs: + def __init__(__self__): + """ + The set of arguments for constructing a FOOEncryptedBarClass resource. + """ + pass + + +class FOOEncryptedBarClass(pulumi.CustomResource): + @overload + def __init__(__self__, + resource_name: str, + opts: Optional[pulumi.ResourceOptions] = None, + __props__=None): + """ + Create a FOOEncryptedBarClass resource with the given unique name, props, and options. + :param str resource_name: The name of the resource. + :param pulumi.ResourceOptions opts: Options for the resource. + """ + ... + @overload + def __init__(__self__, + resource_name: str, + args: Optional[FOOEncryptedBarClassArgs] = None, + opts: Optional[pulumi.ResourceOptions] = None): + """ + Create a FOOEncryptedBarClass resource with the given unique name, props, and options. + :param str resource_name: The name of the resource. + :param FOOEncryptedBarClassArgs args: The arguments to use to populate this resource's properties. + :param pulumi.ResourceOptions opts: Options for the resource. + """ + ... + def __init__(__self__, resource_name: str, *args, **kwargs): + resource_args, opts = _utilities.get_resource_args_opts(FOOEncryptedBarClassArgs, pulumi.ResourceOptions, *args, **kwargs) + if resource_args is not None: + __self__._internal_init(resource_name, opts, **resource_args.__dict__) + else: + __self__._internal_init(resource_name, *args, **kwargs) + + def _internal_init(__self__, + resource_name: str, + opts: Optional[pulumi.ResourceOptions] = None, + __props__=None): + opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts) + if not isinstance(opts, pulumi.ResourceOptions): + raise TypeError('Expected resource options to be a ResourceOptions instance') + if opts.id is None: + if __props__ is not None: + raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource') + __props__ = FOOEncryptedBarClassArgs.__new__(FOOEncryptedBarClassArgs) + + super(FOOEncryptedBarClass, __self__).__init__( + 'foo-bar:submodule1:FOOEncryptedBarClass', + resource_name, + __props__, + opts) + + @staticmethod + def get(resource_name: str, + id: pulumi.Input[str], + opts: Optional[pulumi.ResourceOptions] = None) -> 'FOOEncryptedBarClass': + """ + Get an existing FOOEncryptedBarClass resource's state with the given name, id, and optional extra + properties used to qualify the lookup. + + :param str resource_name: The unique name of the resulting resource. + :param pulumi.Input[str] id: The unique provider ID of the resource to lookup. + :param pulumi.ResourceOptions opts: Options for the resource. + """ + opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) + + __props__ = FOOEncryptedBarClassArgs.__new__(FOOEncryptedBarClassArgs) + + return FOOEncryptedBarClass(resource_name, opts=opts, __props__=__props__) + diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/schema.json b/pkg/codegen/testing/test/testdata/dash-named-schema/schema.json index 8a64be699f8e..64109334abe3 100644 --- a/pkg/codegen/testing/test/testdata/dash-named-schema/schema.json +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/schema.json @@ -29,6 +29,9 @@ } }, "type": "object" + }, + "foo-bar:submodule1:FOOEncryptedBarClass":{ + "type": "object" } }, "language": {