github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/simple-plain-schema/go/example/component.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/pkg/errors" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 type Component struct { 15 pulumi.ResourceState 16 17 A pulumi.BoolOutput `pulumi:"a"` 18 B pulumi.BoolPtrOutput `pulumi:"b"` 19 Bar FooPtrOutput `pulumi:"bar"` 20 Baz FooArrayOutput `pulumi:"baz"` 21 C pulumi.IntOutput `pulumi:"c"` 22 D pulumi.IntPtrOutput `pulumi:"d"` 23 E pulumi.StringOutput `pulumi:"e"` 24 F pulumi.StringPtrOutput `pulumi:"f"` 25 Foo FooPtrOutput `pulumi:"foo"` 26 } 27 28 // NewComponent registers a new resource with the given unique name, arguments, and options. 29 func NewComponent(ctx *pulumi.Context, 30 name string, args *ComponentArgs, opts ...pulumi.ResourceOption) (*Component, error) { 31 if args == nil { 32 return nil, errors.New("missing one or more required arguments") 33 } 34 35 var resource Component 36 err := ctx.RegisterRemoteComponentResource("example::Component", name, args, &resource, opts...) 37 if err != nil { 38 return nil, err 39 } 40 return &resource, nil 41 } 42 43 type componentArgs struct { 44 A bool `pulumi:"a"` 45 B *bool `pulumi:"b"` 46 Bar *Foo `pulumi:"bar"` 47 Baz []Foo `pulumi:"baz"` 48 BazMap map[string]Foo `pulumi:"bazMap"` 49 C int `pulumi:"c"` 50 D *int `pulumi:"d"` 51 E string `pulumi:"e"` 52 F *string `pulumi:"f"` 53 Foo *Foo `pulumi:"foo"` 54 } 55 56 // The set of arguments for constructing a Component resource. 57 type ComponentArgs struct { 58 A bool 59 B *bool 60 Bar *FooArgs 61 Baz []FooInput 62 BazMap map[string]FooInput 63 C int 64 D *int 65 E string 66 F *string 67 Foo FooPtrInput 68 } 69 70 func (ComponentArgs) ElementType() reflect.Type { 71 return reflect.TypeOf((*componentArgs)(nil)).Elem() 72 } 73 74 type ComponentInput interface { 75 pulumi.Input 76 77 ToComponentOutput() ComponentOutput 78 ToComponentOutputWithContext(ctx context.Context) ComponentOutput 79 } 80 81 func (*Component) ElementType() reflect.Type { 82 return reflect.TypeOf((**Component)(nil)).Elem() 83 } 84 85 func (i *Component) ToComponentOutput() ComponentOutput { 86 return i.ToComponentOutputWithContext(context.Background()) 87 } 88 89 func (i *Component) ToComponentOutputWithContext(ctx context.Context) ComponentOutput { 90 return pulumi.ToOutputWithContext(ctx, i).(ComponentOutput) 91 } 92 93 type ComponentOutput struct{ *pulumi.OutputState } 94 95 func (ComponentOutput) ElementType() reflect.Type { 96 return reflect.TypeOf((**Component)(nil)).Elem() 97 } 98 99 func (o ComponentOutput) ToComponentOutput() ComponentOutput { 100 return o 101 } 102 103 func (o ComponentOutput) ToComponentOutputWithContext(ctx context.Context) ComponentOutput { 104 return o 105 } 106 107 func (o ComponentOutput) A() pulumi.BoolOutput { 108 return o.ApplyT(func(v *Component) pulumi.BoolOutput { return v.A }).(pulumi.BoolOutput) 109 } 110 111 func (o ComponentOutput) B() pulumi.BoolPtrOutput { 112 return o.ApplyT(func(v *Component) pulumi.BoolPtrOutput { return v.B }).(pulumi.BoolPtrOutput) 113 } 114 115 func (o ComponentOutput) Bar() FooPtrOutput { 116 return o.ApplyT(func(v *Component) FooPtrOutput { return v.Bar }).(FooPtrOutput) 117 } 118 119 func (o ComponentOutput) Baz() FooArrayOutput { 120 return o.ApplyT(func(v *Component) FooArrayOutput { return v.Baz }).(FooArrayOutput) 121 } 122 123 func (o ComponentOutput) C() pulumi.IntOutput { 124 return o.ApplyT(func(v *Component) pulumi.IntOutput { return v.C }).(pulumi.IntOutput) 125 } 126 127 func (o ComponentOutput) D() pulumi.IntPtrOutput { 128 return o.ApplyT(func(v *Component) pulumi.IntPtrOutput { return v.D }).(pulumi.IntPtrOutput) 129 } 130 131 func (o ComponentOutput) E() pulumi.StringOutput { 132 return o.ApplyT(func(v *Component) pulumi.StringOutput { return v.E }).(pulumi.StringOutput) 133 } 134 135 func (o ComponentOutput) F() pulumi.StringPtrOutput { 136 return o.ApplyT(func(v *Component) pulumi.StringPtrOutput { return v.F }).(pulumi.StringPtrOutput) 137 } 138 139 func (o ComponentOutput) Foo() FooPtrOutput { 140 return o.ApplyT(func(v *Component) FooPtrOutput { return v.Foo }).(FooPtrOutput) 141 } 142 143 func init() { 144 pulumi.RegisterInputType(reflect.TypeOf((*ComponentInput)(nil)).Elem(), &Component{}) 145 pulumi.RegisterOutputType(ComponentOutput{}) 146 }