github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/simple-yaml-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 var resource OtherResource 27 err := ctx.RegisterRemoteComponentResource("example::OtherResource", name, args, &resource, opts...) 28 if err != nil { 29 return nil, err 30 } 31 return &resource, nil 32 } 33 34 type otherResourceArgs struct { 35 Bar []string `pulumi:"bar"` 36 Foo *Resource `pulumi:"foo"` 37 } 38 39 // The set of arguments for constructing a OtherResource resource. 40 type OtherResourceArgs struct { 41 Bar []pulumi.StringInput 42 Foo ResourceInput 43 } 44 45 func (OtherResourceArgs) ElementType() reflect.Type { 46 return reflect.TypeOf((*otherResourceArgs)(nil)).Elem() 47 } 48 49 type OtherResourceInput interface { 50 pulumi.Input 51 52 ToOtherResourceOutput() OtherResourceOutput 53 ToOtherResourceOutputWithContext(ctx context.Context) OtherResourceOutput 54 } 55 56 func (*OtherResource) ElementType() reflect.Type { 57 return reflect.TypeOf((**OtherResource)(nil)).Elem() 58 } 59 60 func (i *OtherResource) ToOtherResourceOutput() OtherResourceOutput { 61 return i.ToOtherResourceOutputWithContext(context.Background()) 62 } 63 64 func (i *OtherResource) ToOtherResourceOutputWithContext(ctx context.Context) OtherResourceOutput { 65 return pulumi.ToOutputWithContext(ctx, i).(OtherResourceOutput) 66 } 67 68 type OtherResourceOutput struct{ *pulumi.OutputState } 69 70 func (OtherResourceOutput) ElementType() reflect.Type { 71 return reflect.TypeOf((**OtherResource)(nil)).Elem() 72 } 73 74 func (o OtherResourceOutput) ToOtherResourceOutput() OtherResourceOutput { 75 return o 76 } 77 78 func (o OtherResourceOutput) ToOtherResourceOutputWithContext(ctx context.Context) OtherResourceOutput { 79 return o 80 } 81 82 func (o OtherResourceOutput) Foo() ResourceOutput { 83 return o.ApplyT(func(v *OtherResource) ResourceOutput { return v.Foo }).(ResourceOutput) 84 } 85 86 func init() { 87 pulumi.RegisterInputType(reflect.TypeOf((*OtherResourceInput)(nil)).Elem(), &OtherResource{}) 88 pulumi.RegisterOutputType(OtherResourceOutput{}) 89 }