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