github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/simple-resource-schema/go/example/otherResource.go (about)

     1  // Code generated by test DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package example
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    11  )
    12  
    13  type OtherResource struct {
    14  	pulumi.ResourceState
    15  
    16  	Foo ResourceOutput `pulumi:"foo"`
    17  }
    18  
    19  // NewOtherResource registers a new resource with the given unique name, arguments, and options.
    20  func NewOtherResource(ctx *pulumi.Context,
    21  	name string, args *OtherResourceArgs, opts ...pulumi.ResourceOption) (*OtherResource, error) {
    22  	if args == nil {
    23  		args = &OtherResourceArgs{}
    24  	}
    25  
    26  	opts = pkgResourceDefaultOpts(opts)
    27  	var resource OtherResource
    28  	err := ctx.RegisterRemoteComponentResource("example::OtherResource", name, args, &resource, opts...)
    29  	if err != nil {
    30  		return nil, err
    31  	}
    32  	return &resource, nil
    33  }
    34  
    35  type otherResourceArgs struct {
    36  	Foo *Resource `pulumi:"foo"`
    37  }
    38  
    39  // The set of arguments for constructing a OtherResource resource.
    40  type OtherResourceArgs struct {
    41  	Foo ResourceInput
    42  }
    43  
    44  func (OtherResourceArgs) ElementType() reflect.Type {
    45  	return reflect.TypeOf((*otherResourceArgs)(nil)).Elem()
    46  }
    47  
    48  type OtherResourceInput interface {
    49  	pulumi.Input
    50  
    51  	ToOtherResourceOutput() OtherResourceOutput
    52  	ToOtherResourceOutputWithContext(ctx context.Context) OtherResourceOutput
    53  }
    54  
    55  func (*OtherResource) ElementType() reflect.Type {
    56  	return reflect.TypeOf((**OtherResource)(nil)).Elem()
    57  }
    58  
    59  func (i *OtherResource) ToOtherResourceOutput() OtherResourceOutput {
    60  	return i.ToOtherResourceOutputWithContext(context.Background())
    61  }
    62  
    63  func (i *OtherResource) ToOtherResourceOutputWithContext(ctx context.Context) OtherResourceOutput {
    64  	return pulumi.ToOutputWithContext(ctx, i).(OtherResourceOutput)
    65  }
    66  
    67  type OtherResourceOutput struct{ *pulumi.OutputState }
    68  
    69  func (OtherResourceOutput) ElementType() reflect.Type {
    70  	return reflect.TypeOf((**OtherResource)(nil)).Elem()
    71  }
    72  
    73  func (o OtherResourceOutput) ToOtherResourceOutput() OtherResourceOutput {
    74  	return o
    75  }
    76  
    77  func (o OtherResourceOutput) ToOtherResourceOutputWithContext(ctx context.Context) OtherResourceOutput {
    78  	return o
    79  }
    80  
    81  func (o OtherResourceOutput) Foo() ResourceOutput {
    82  	return o.ApplyT(func(v *OtherResource) ResourceOutput { return v.Foo }).(ResourceOutput)
    83  }
    84  
    85  func init() {
    86  	pulumi.RegisterInputType(reflect.TypeOf((*OtherResourceInput)(nil)).Elem(), &OtherResource{})
    87  	pulumi.RegisterOutputType(OtherResourceOutput{})
    88  }