2022-04-19 16:39:23 +00:00
|
|
|
// Code generated by test DO NOT EDIT.
|
|
|
|
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
|
2021-01-15 18:13:01 +00:00
|
|
|
|
|
|
|
package example
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"reflect"
|
|
|
|
|
2022-11-01 09:02:01 +00:00
|
|
|
"errors"
|
2024-03-21 13:41:07 +00:00
|
|
|
"external-resource-schema/example/internal"
|
2021-09-15 16:49:36 +00:00
|
|
|
"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
|
|
|
|
"github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes"
|
|
|
|
metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/meta/v1"
|
|
|
|
storagev1 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/storage/v1"
|
2021-03-17 13:20:05 +00:00
|
|
|
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
2021-01-15 18:13:01 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Component struct {
|
|
|
|
pulumi.CustomResourceState
|
|
|
|
|
|
|
|
Provider kubernetes.ProviderOutput `pulumi:"provider"`
|
|
|
|
SecurityGroup ec2.SecurityGroupOutput `pulumi:"securityGroup"`
|
|
|
|
StorageClasses storagev1.StorageClassMapOutput `pulumi:"storageClasses"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewComponent registers a new resource with the given unique name, arguments, and options.
|
|
|
|
func NewComponent(ctx *pulumi.Context,
|
|
|
|
name string, args *ComponentArgs, opts ...pulumi.ResourceOption) (*Component, error) {
|
|
|
|
if args == nil {
|
2021-05-27 23:02:19 +00:00
|
|
|
return nil, errors.New("missing one or more required arguments")
|
2021-01-15 18:13:01 +00:00
|
|
|
}
|
|
|
|
|
2021-05-27 23:02:19 +00:00
|
|
|
if args.RequiredMetadata == nil {
|
|
|
|
return nil, errors.New("invalid value for required argument 'RequiredMetadata'")
|
|
|
|
}
|
|
|
|
if args.RequiredMetadataArray == nil {
|
|
|
|
return nil, errors.New("invalid value for required argument 'RequiredMetadataArray'")
|
|
|
|
}
|
|
|
|
if args.RequiredMetadataMap == nil {
|
|
|
|
return nil, errors.New("invalid value for required argument 'RequiredMetadataMap'")
|
|
|
|
}
|
2023-06-14 16:34:49 +00:00
|
|
|
opts = internal.PkgResourceDefaultOpts(opts)
|
2021-01-15 18:13:01 +00:00
|
|
|
var resource Component
|
|
|
|
err := ctx.RegisterResource("example::Component", name, args, &resource, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &resource, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetComponent gets an existing Component 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 GetComponent(ctx *pulumi.Context,
|
|
|
|
name string, id pulumi.IDInput, state *ComponentState, opts ...pulumi.ResourceOption) (*Component, error) {
|
|
|
|
var resource Component
|
|
|
|
err := ctx.ReadResource("example::Component", name, id, state, &resource, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &resource, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Input properties used for looking up and filtering Component resources.
|
|
|
|
type componentState struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
type ComponentState struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ComponentState) ElementType() reflect.Type {
|
|
|
|
return reflect.TypeOf((*componentState)(nil)).Elem()
|
|
|
|
}
|
|
|
|
|
|
|
|
type componentArgs struct {
|
2021-07-14 22:12:25 +00:00
|
|
|
Metadata *metav1.ObjectMeta `pulumi:"metadata"`
|
|
|
|
MetadataArray []metav1.ObjectMeta `pulumi:"metadataArray"`
|
|
|
|
MetadataMap map[string]metav1.ObjectMeta `pulumi:"metadataMap"`
|
|
|
|
RequiredMetadata metav1.ObjectMeta `pulumi:"requiredMetadata"`
|
|
|
|
RequiredMetadataArray []metav1.ObjectMeta `pulumi:"requiredMetadataArray"`
|
|
|
|
RequiredMetadataMap map[string]metav1.ObjectMeta `pulumi:"requiredMetadataMap"`
|
2021-01-15 18:13:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// The set of arguments for constructing a Component resource.
|
|
|
|
type ComponentArgs struct {
|
2021-05-27 23:02:19 +00:00
|
|
|
Metadata metav1.ObjectMetaPtrInput
|
|
|
|
MetadataArray metav1.ObjectMetaArrayInput
|
|
|
|
MetadataMap metav1.ObjectMetaMapInput
|
|
|
|
RequiredMetadata metav1.ObjectMetaInput
|
|
|
|
RequiredMetadataArray metav1.ObjectMetaArrayInput
|
|
|
|
RequiredMetadataMap metav1.ObjectMetaMapInput
|
2021-01-15 18:13:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (ComponentArgs) ElementType() reflect.Type {
|
|
|
|
return reflect.TypeOf((*componentArgs)(nil)).Elem()
|
|
|
|
}
|
|
|
|
|
|
|
|
type ComponentInput interface {
|
|
|
|
pulumi.Input
|
|
|
|
|
|
|
|
ToComponentOutput() ComponentOutput
|
|
|
|
ToComponentOutputWithContext(ctx context.Context) ComponentOutput
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*Component) ElementType() reflect.Type {
|
[codegen/go] Remove ResourcePtr input/output types (#8449)
These changes remove the `Ptr` variants of input/ouptut types for
resources. A `TPtr` input or output is normally generated for `T` if `T`
is present in an `optional(input(T))` or `optional(output(T))` and if
the Go representation for `T` is not nilable. The generation of `Ptr`
variants for resource types breaks the latter rule: the canonical
representation of a resource type named `Foo` is a pointer to a struct
type named `Foo` (i.e. `*Foo`). `Foo` itself is not a resource, as it
does not implement the Go `Resource` interface. Because this
representation already accommodates `nil` to indicate the lack of a
value, we need not generate `FooPtr{Input,Output}` types.
Besides being unnecessary, the implementation of `Ptr` types for
resources was incorrect. Rather than using `**Foo` as their element
type, these types use `*Foo`--identical to the element type used for
the normal input/output types. Furthermore, the generated code for
at least `FooOutput.ToFooPtrOutputWithContext` and `FooPtrOutput.Elem`
was incorrect, making these types virtually unusable in practice.
Finally, these `Ptr` types should never appear on input/output
properties in practice, as the logic we use to generate input and output
type references never generates them for `optional({input,output}(T)).
Instead, it generates references to the standard input/output types.
Though this is _technically_ a breaking change--it changes the set of
exported types for any package that defines resources--I believe that in
practice it will be invisible to users for the reasons stated above.
These types are not usable, and were never referenced.
This is preparatory work for #7943.
2021-11-23 18:24:56 +00:00
|
|
|
return reflect.TypeOf((**Component)(nil)).Elem()
|
2021-01-15 18:13:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (i *Component) ToComponentOutput() ComponentOutput {
|
|
|
|
return i.ToComponentOutputWithContext(context.Background())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (i *Component) ToComponentOutputWithContext(ctx context.Context) ComponentOutput {
|
|
|
|
return pulumi.ToOutputWithContext(ctx, i).(ComponentOutput)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ComponentArrayInput is an input type that accepts ComponentArray and ComponentArrayOutput values.
|
|
|
|
// You can construct a concrete instance of `ComponentArrayInput` via:
|
|
|
|
//
|
2022-09-14 02:12:02 +00:00
|
|
|
// ComponentArray{ ComponentArgs{...} }
|
2021-01-15 18:13:01 +00:00
|
|
|
type ComponentArrayInput interface {
|
|
|
|
pulumi.Input
|
|
|
|
|
|
|
|
ToComponentArrayOutput() ComponentArrayOutput
|
|
|
|
ToComponentArrayOutputWithContext(context.Context) ComponentArrayOutput
|
|
|
|
}
|
|
|
|
|
|
|
|
type ComponentArray []ComponentInput
|
|
|
|
|
|
|
|
func (ComponentArray) ElementType() reflect.Type {
|
2021-07-27 02:23:17 +00:00
|
|
|
return reflect.TypeOf((*[]*Component)(nil)).Elem()
|
2021-01-15 18:13:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (i ComponentArray) ToComponentArrayOutput() ComponentArrayOutput {
|
|
|
|
return i.ToComponentArrayOutputWithContext(context.Background())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (i ComponentArray) ToComponentArrayOutputWithContext(ctx context.Context) ComponentArrayOutput {
|
|
|
|
return pulumi.ToOutputWithContext(ctx, i).(ComponentArrayOutput)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ComponentMapInput is an input type that accepts ComponentMap and ComponentMapOutput values.
|
|
|
|
// You can construct a concrete instance of `ComponentMapInput` via:
|
|
|
|
//
|
2022-09-14 02:12:02 +00:00
|
|
|
// ComponentMap{ "key": ComponentArgs{...} }
|
2021-01-15 18:13:01 +00:00
|
|
|
type ComponentMapInput interface {
|
|
|
|
pulumi.Input
|
|
|
|
|
|
|
|
ToComponentMapOutput() ComponentMapOutput
|
|
|
|
ToComponentMapOutputWithContext(context.Context) ComponentMapOutput
|
|
|
|
}
|
|
|
|
|
|
|
|
type ComponentMap map[string]ComponentInput
|
|
|
|
|
|
|
|
func (ComponentMap) ElementType() reflect.Type {
|
2021-07-27 02:23:17 +00:00
|
|
|
return reflect.TypeOf((*map[string]*Component)(nil)).Elem()
|
2021-01-15 18:13:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (i ComponentMap) ToComponentMapOutput() ComponentMapOutput {
|
|
|
|
return i.ToComponentMapOutputWithContext(context.Background())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (i ComponentMap) ToComponentMapOutputWithContext(ctx context.Context) ComponentMapOutput {
|
|
|
|
return pulumi.ToOutputWithContext(ctx, i).(ComponentMapOutput)
|
|
|
|
}
|
|
|
|
|
2021-08-02 20:43:24 +00:00
|
|
|
type ComponentOutput struct{ *pulumi.OutputState }
|
2021-01-15 18:13:01 +00:00
|
|
|
|
|
|
|
func (ComponentOutput) ElementType() reflect.Type {
|
[codegen/go] Remove ResourcePtr input/output types (#8449)
These changes remove the `Ptr` variants of input/ouptut types for
resources. A `TPtr` input or output is normally generated for `T` if `T`
is present in an `optional(input(T))` or `optional(output(T))` and if
the Go representation for `T` is not nilable. The generation of `Ptr`
variants for resource types breaks the latter rule: the canonical
representation of a resource type named `Foo` is a pointer to a struct
type named `Foo` (i.e. `*Foo`). `Foo` itself is not a resource, as it
does not implement the Go `Resource` interface. Because this
representation already accommodates `nil` to indicate the lack of a
value, we need not generate `FooPtr{Input,Output}` types.
Besides being unnecessary, the implementation of `Ptr` types for
resources was incorrect. Rather than using `**Foo` as their element
type, these types use `*Foo`--identical to the element type used for
the normal input/output types. Furthermore, the generated code for
at least `FooOutput.ToFooPtrOutputWithContext` and `FooPtrOutput.Elem`
was incorrect, making these types virtually unusable in practice.
Finally, these `Ptr` types should never appear on input/output
properties in practice, as the logic we use to generate input and output
type references never generates them for `optional({input,output}(T)).
Instead, it generates references to the standard input/output types.
Though this is _technically_ a breaking change--it changes the set of
exported types for any package that defines resources--I believe that in
practice it will be invisible to users for the reasons stated above.
These types are not usable, and were never referenced.
This is preparatory work for #7943.
2021-11-23 18:24:56 +00:00
|
|
|
return reflect.TypeOf((**Component)(nil)).Elem()
|
2021-01-15 18:13:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o ComponentOutput) ToComponentOutput() ComponentOutput {
|
|
|
|
return o
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o ComponentOutput) ToComponentOutputWithContext(ctx context.Context) ComponentOutput {
|
|
|
|
return o
|
|
|
|
}
|
|
|
|
|
2022-05-03 18:36:57 +00:00
|
|
|
func (o ComponentOutput) Provider() kubernetes.ProviderOutput {
|
|
|
|
return o.ApplyT(func(v *Component) kubernetes.ProviderOutput { return v.Provider }).(kubernetes.ProviderOutput)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o ComponentOutput) SecurityGroup() ec2.SecurityGroupOutput {
|
|
|
|
return o.ApplyT(func(v *Component) ec2.SecurityGroupOutput { return v.SecurityGroup }).(ec2.SecurityGroupOutput)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o ComponentOutput) StorageClasses() storagev1.StorageClassMapOutput {
|
|
|
|
return o.ApplyT(func(v *Component) storagev1.StorageClassMapOutput { return v.StorageClasses }).(storagev1.StorageClassMapOutput)
|
|
|
|
}
|
|
|
|
|
2021-01-15 18:13:01 +00:00
|
|
|
type ComponentArrayOutput struct{ *pulumi.OutputState }
|
|
|
|
|
|
|
|
func (ComponentArrayOutput) ElementType() reflect.Type {
|
[codegen/go] Remove ResourcePtr input/output types (#8449)
These changes remove the `Ptr` variants of input/ouptut types for
resources. A `TPtr` input or output is normally generated for `T` if `T`
is present in an `optional(input(T))` or `optional(output(T))` and if
the Go representation for `T` is not nilable. The generation of `Ptr`
variants for resource types breaks the latter rule: the canonical
representation of a resource type named `Foo` is a pointer to a struct
type named `Foo` (i.e. `*Foo`). `Foo` itself is not a resource, as it
does not implement the Go `Resource` interface. Because this
representation already accommodates `nil` to indicate the lack of a
value, we need not generate `FooPtr{Input,Output}` types.
Besides being unnecessary, the implementation of `Ptr` types for
resources was incorrect. Rather than using `**Foo` as their element
type, these types use `*Foo`--identical to the element type used for
the normal input/output types. Furthermore, the generated code for
at least `FooOutput.ToFooPtrOutputWithContext` and `FooPtrOutput.Elem`
was incorrect, making these types virtually unusable in practice.
Finally, these `Ptr` types should never appear on input/output
properties in practice, as the logic we use to generate input and output
type references never generates them for `optional({input,output}(T)).
Instead, it generates references to the standard input/output types.
Though this is _technically_ a breaking change--it changes the set of
exported types for any package that defines resources--I believe that in
practice it will be invisible to users for the reasons stated above.
These types are not usable, and were never referenced.
This is preparatory work for #7943.
2021-11-23 18:24:56 +00:00
|
|
|
return reflect.TypeOf((*[]*Component)(nil)).Elem()
|
2021-01-15 18:13:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o ComponentArrayOutput) ToComponentArrayOutput() ComponentArrayOutput {
|
|
|
|
return o
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o ComponentArrayOutput) ToComponentArrayOutputWithContext(ctx context.Context) ComponentArrayOutput {
|
|
|
|
return o
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o ComponentArrayOutput) Index(i pulumi.IntInput) ComponentOutput {
|
[codegen/go] Remove ResourcePtr input/output types (#8449)
These changes remove the `Ptr` variants of input/ouptut types for
resources. A `TPtr` input or output is normally generated for `T` if `T`
is present in an `optional(input(T))` or `optional(output(T))` and if
the Go representation for `T` is not nilable. The generation of `Ptr`
variants for resource types breaks the latter rule: the canonical
representation of a resource type named `Foo` is a pointer to a struct
type named `Foo` (i.e. `*Foo`). `Foo` itself is not a resource, as it
does not implement the Go `Resource` interface. Because this
representation already accommodates `nil` to indicate the lack of a
value, we need not generate `FooPtr{Input,Output}` types.
Besides being unnecessary, the implementation of `Ptr` types for
resources was incorrect. Rather than using `**Foo` as their element
type, these types use `*Foo`--identical to the element type used for
the normal input/output types. Furthermore, the generated code for
at least `FooOutput.ToFooPtrOutputWithContext` and `FooPtrOutput.Elem`
was incorrect, making these types virtually unusable in practice.
Finally, these `Ptr` types should never appear on input/output
properties in practice, as the logic we use to generate input and output
type references never generates them for `optional({input,output}(T)).
Instead, it generates references to the standard input/output types.
Though this is _technically_ a breaking change--it changes the set of
exported types for any package that defines resources--I believe that in
practice it will be invisible to users for the reasons stated above.
These types are not usable, and were never referenced.
This is preparatory work for #7943.
2021-11-23 18:24:56 +00:00
|
|
|
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Component {
|
|
|
|
return vs[0].([]*Component)[vs[1].(int)]
|
2021-01-15 18:13:01 +00:00
|
|
|
}).(ComponentOutput)
|
|
|
|
}
|
|
|
|
|
|
|
|
type ComponentMapOutput struct{ *pulumi.OutputState }
|
|
|
|
|
|
|
|
func (ComponentMapOutput) ElementType() reflect.Type {
|
[codegen/go] Remove ResourcePtr input/output types (#8449)
These changes remove the `Ptr` variants of input/ouptut types for
resources. A `TPtr` input or output is normally generated for `T` if `T`
is present in an `optional(input(T))` or `optional(output(T))` and if
the Go representation for `T` is not nilable. The generation of `Ptr`
variants for resource types breaks the latter rule: the canonical
representation of a resource type named `Foo` is a pointer to a struct
type named `Foo` (i.e. `*Foo`). `Foo` itself is not a resource, as it
does not implement the Go `Resource` interface. Because this
representation already accommodates `nil` to indicate the lack of a
value, we need not generate `FooPtr{Input,Output}` types.
Besides being unnecessary, the implementation of `Ptr` types for
resources was incorrect. Rather than using `**Foo` as their element
type, these types use `*Foo`--identical to the element type used for
the normal input/output types. Furthermore, the generated code for
at least `FooOutput.ToFooPtrOutputWithContext` and `FooPtrOutput.Elem`
was incorrect, making these types virtually unusable in practice.
Finally, these `Ptr` types should never appear on input/output
properties in practice, as the logic we use to generate input and output
type references never generates them for `optional({input,output}(T)).
Instead, it generates references to the standard input/output types.
Though this is _technically_ a breaking change--it changes the set of
exported types for any package that defines resources--I believe that in
practice it will be invisible to users for the reasons stated above.
These types are not usable, and were never referenced.
This is preparatory work for #7943.
2021-11-23 18:24:56 +00:00
|
|
|
return reflect.TypeOf((*map[string]*Component)(nil)).Elem()
|
2021-01-15 18:13:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o ComponentMapOutput) ToComponentMapOutput() ComponentMapOutput {
|
|
|
|
return o
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o ComponentMapOutput) ToComponentMapOutputWithContext(ctx context.Context) ComponentMapOutput {
|
|
|
|
return o
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o ComponentMapOutput) MapIndex(k pulumi.StringInput) ComponentOutput {
|
[codegen/go] Remove ResourcePtr input/output types (#8449)
These changes remove the `Ptr` variants of input/ouptut types for
resources. A `TPtr` input or output is normally generated for `T` if `T`
is present in an `optional(input(T))` or `optional(output(T))` and if
the Go representation for `T` is not nilable. The generation of `Ptr`
variants for resource types breaks the latter rule: the canonical
representation of a resource type named `Foo` is a pointer to a struct
type named `Foo` (i.e. `*Foo`). `Foo` itself is not a resource, as it
does not implement the Go `Resource` interface. Because this
representation already accommodates `nil` to indicate the lack of a
value, we need not generate `FooPtr{Input,Output}` types.
Besides being unnecessary, the implementation of `Ptr` types for
resources was incorrect. Rather than using `**Foo` as their element
type, these types use `*Foo`--identical to the element type used for
the normal input/output types. Furthermore, the generated code for
at least `FooOutput.ToFooPtrOutputWithContext` and `FooPtrOutput.Elem`
was incorrect, making these types virtually unusable in practice.
Finally, these `Ptr` types should never appear on input/output
properties in practice, as the logic we use to generate input and output
type references never generates them for `optional({input,output}(T)).
Instead, it generates references to the standard input/output types.
Though this is _technically_ a breaking change--it changes the set of
exported types for any package that defines resources--I believe that in
practice it will be invisible to users for the reasons stated above.
These types are not usable, and were never referenced.
This is preparatory work for #7943.
2021-11-23 18:24:56 +00:00
|
|
|
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Component {
|
|
|
|
return vs[0].(map[string]*Component)[vs[1].(string)]
|
2021-01-15 18:13:01 +00:00
|
|
|
}).(ComponentOutput)
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2021-10-14 17:41:40 +00:00
|
|
|
pulumi.RegisterInputType(reflect.TypeOf((*ComponentInput)(nil)).Elem(), &Component{})
|
|
|
|
pulumi.RegisterInputType(reflect.TypeOf((*ComponentArrayInput)(nil)).Elem(), ComponentArray{})
|
|
|
|
pulumi.RegisterInputType(reflect.TypeOf((*ComponentMapInput)(nil)).Elem(), ComponentMap{})
|
2021-01-15 18:13:01 +00:00
|
|
|
pulumi.RegisterOutputType(ComponentOutput{})
|
|
|
|
pulumi.RegisterOutputType(ComponentArrayOutput{})
|
|
|
|
pulumi.RegisterOutputType(ComponentMapOutput{})
|
|
|
|
}
|