52d01bb915
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.
201 lines
5.9 KiB
Go
201 lines
5.9 KiB
Go
// *** WARNING: this file was generated by test. ***
|
|
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
|
|
|
package example
|
|
|
|
import (
|
|
"context"
|
|
"reflect"
|
|
|
|
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
|
)
|
|
|
|
type NoRecursive struct {
|
|
pulumi.CustomResourceState
|
|
|
|
Rec RecPtrOutput `pulumi:"rec"`
|
|
Replace pulumi.StringPtrOutput `pulumi:"replace"`
|
|
}
|
|
|
|
// NewNoRecursive registers a new resource with the given unique name, arguments, and options.
|
|
func NewNoRecursive(ctx *pulumi.Context,
|
|
name string, args *NoRecursiveArgs, opts ...pulumi.ResourceOption) (*NoRecursive, error) {
|
|
if args == nil {
|
|
args = &NoRecursiveArgs{}
|
|
}
|
|
|
|
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
|
|
"replace",
|
|
})
|
|
opts = append(opts, replaceOnChanges)
|
|
var resource NoRecursive
|
|
err := ctx.RegisterResource("example::NoRecursive", name, args, &resource, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &resource, nil
|
|
}
|
|
|
|
// GetNoRecursive gets an existing NoRecursive 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 GetNoRecursive(ctx *pulumi.Context,
|
|
name string, id pulumi.IDInput, state *NoRecursiveState, opts ...pulumi.ResourceOption) (*NoRecursive, error) {
|
|
var resource NoRecursive
|
|
err := ctx.ReadResource("example::NoRecursive", name, id, state, &resource, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &resource, nil
|
|
}
|
|
|
|
// Input properties used for looking up and filtering NoRecursive resources.
|
|
type noRecursiveState struct {
|
|
}
|
|
|
|
type NoRecursiveState struct {
|
|
}
|
|
|
|
func (NoRecursiveState) ElementType() reflect.Type {
|
|
return reflect.TypeOf((*noRecursiveState)(nil)).Elem()
|
|
}
|
|
|
|
type noRecursiveArgs struct {
|
|
}
|
|
|
|
// The set of arguments for constructing a NoRecursive resource.
|
|
type NoRecursiveArgs struct {
|
|
}
|
|
|
|
func (NoRecursiveArgs) ElementType() reflect.Type {
|
|
return reflect.TypeOf((*noRecursiveArgs)(nil)).Elem()
|
|
}
|
|
|
|
type NoRecursiveInput interface {
|
|
pulumi.Input
|
|
|
|
ToNoRecursiveOutput() NoRecursiveOutput
|
|
ToNoRecursiveOutputWithContext(ctx context.Context) NoRecursiveOutput
|
|
}
|
|
|
|
func (*NoRecursive) ElementType() reflect.Type {
|
|
return reflect.TypeOf((**NoRecursive)(nil)).Elem()
|
|
}
|
|
|
|
func (i *NoRecursive) ToNoRecursiveOutput() NoRecursiveOutput {
|
|
return i.ToNoRecursiveOutputWithContext(context.Background())
|
|
}
|
|
|
|
func (i *NoRecursive) ToNoRecursiveOutputWithContext(ctx context.Context) NoRecursiveOutput {
|
|
return pulumi.ToOutputWithContext(ctx, i).(NoRecursiveOutput)
|
|
}
|
|
|
|
// NoRecursiveArrayInput is an input type that accepts NoRecursiveArray and NoRecursiveArrayOutput values.
|
|
// You can construct a concrete instance of `NoRecursiveArrayInput` via:
|
|
//
|
|
// NoRecursiveArray{ NoRecursiveArgs{...} }
|
|
type NoRecursiveArrayInput interface {
|
|
pulumi.Input
|
|
|
|
ToNoRecursiveArrayOutput() NoRecursiveArrayOutput
|
|
ToNoRecursiveArrayOutputWithContext(context.Context) NoRecursiveArrayOutput
|
|
}
|
|
|
|
type NoRecursiveArray []NoRecursiveInput
|
|
|
|
func (NoRecursiveArray) ElementType() reflect.Type {
|
|
return reflect.TypeOf((*[]*NoRecursive)(nil)).Elem()
|
|
}
|
|
|
|
func (i NoRecursiveArray) ToNoRecursiveArrayOutput() NoRecursiveArrayOutput {
|
|
return i.ToNoRecursiveArrayOutputWithContext(context.Background())
|
|
}
|
|
|
|
func (i NoRecursiveArray) ToNoRecursiveArrayOutputWithContext(ctx context.Context) NoRecursiveArrayOutput {
|
|
return pulumi.ToOutputWithContext(ctx, i).(NoRecursiveArrayOutput)
|
|
}
|
|
|
|
// NoRecursiveMapInput is an input type that accepts NoRecursiveMap and NoRecursiveMapOutput values.
|
|
// You can construct a concrete instance of `NoRecursiveMapInput` via:
|
|
//
|
|
// NoRecursiveMap{ "key": NoRecursiveArgs{...} }
|
|
type NoRecursiveMapInput interface {
|
|
pulumi.Input
|
|
|
|
ToNoRecursiveMapOutput() NoRecursiveMapOutput
|
|
ToNoRecursiveMapOutputWithContext(context.Context) NoRecursiveMapOutput
|
|
}
|
|
|
|
type NoRecursiveMap map[string]NoRecursiveInput
|
|
|
|
func (NoRecursiveMap) ElementType() reflect.Type {
|
|
return reflect.TypeOf((*map[string]*NoRecursive)(nil)).Elem()
|
|
}
|
|
|
|
func (i NoRecursiveMap) ToNoRecursiveMapOutput() NoRecursiveMapOutput {
|
|
return i.ToNoRecursiveMapOutputWithContext(context.Background())
|
|
}
|
|
|
|
func (i NoRecursiveMap) ToNoRecursiveMapOutputWithContext(ctx context.Context) NoRecursiveMapOutput {
|
|
return pulumi.ToOutputWithContext(ctx, i).(NoRecursiveMapOutput)
|
|
}
|
|
|
|
type NoRecursiveOutput struct{ *pulumi.OutputState }
|
|
|
|
func (NoRecursiveOutput) ElementType() reflect.Type {
|
|
return reflect.TypeOf((**NoRecursive)(nil)).Elem()
|
|
}
|
|
|
|
func (o NoRecursiveOutput) ToNoRecursiveOutput() NoRecursiveOutput {
|
|
return o
|
|
}
|
|
|
|
func (o NoRecursiveOutput) ToNoRecursiveOutputWithContext(ctx context.Context) NoRecursiveOutput {
|
|
return o
|
|
}
|
|
|
|
type NoRecursiveArrayOutput struct{ *pulumi.OutputState }
|
|
|
|
func (NoRecursiveArrayOutput) ElementType() reflect.Type {
|
|
return reflect.TypeOf((*[]*NoRecursive)(nil)).Elem()
|
|
}
|
|
|
|
func (o NoRecursiveArrayOutput) ToNoRecursiveArrayOutput() NoRecursiveArrayOutput {
|
|
return o
|
|
}
|
|
|
|
func (o NoRecursiveArrayOutput) ToNoRecursiveArrayOutputWithContext(ctx context.Context) NoRecursiveArrayOutput {
|
|
return o
|
|
}
|
|
|
|
func (o NoRecursiveArrayOutput) Index(i pulumi.IntInput) NoRecursiveOutput {
|
|
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *NoRecursive {
|
|
return vs[0].([]*NoRecursive)[vs[1].(int)]
|
|
}).(NoRecursiveOutput)
|
|
}
|
|
|
|
type NoRecursiveMapOutput struct{ *pulumi.OutputState }
|
|
|
|
func (NoRecursiveMapOutput) ElementType() reflect.Type {
|
|
return reflect.TypeOf((*map[string]*NoRecursive)(nil)).Elem()
|
|
}
|
|
|
|
func (o NoRecursiveMapOutput) ToNoRecursiveMapOutput() NoRecursiveMapOutput {
|
|
return o
|
|
}
|
|
|
|
func (o NoRecursiveMapOutput) ToNoRecursiveMapOutputWithContext(ctx context.Context) NoRecursiveMapOutput {
|
|
return o
|
|
}
|
|
|
|
func (o NoRecursiveMapOutput) MapIndex(k pulumi.StringInput) NoRecursiveOutput {
|
|
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *NoRecursive {
|
|
return vs[0].(map[string]*NoRecursive)[vs[1].(string)]
|
|
}).(NoRecursiveOutput)
|
|
}
|
|
|
|
func init() {
|
|
pulumi.RegisterOutputType(NoRecursiveOutput{})
|
|
pulumi.RegisterOutputType(NoRecursiveArrayOutput{})
|
|
pulumi.RegisterOutputType(NoRecursiveMapOutput{})
|
|
}
|