github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/resource-args-python-case-insensitive/go/example/person.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 Person struct { 14 pulumi.CustomResourceState 15 16 Name pulumi.StringPtrOutput `pulumi:"name"` 17 Pets PetTypeArrayOutput `pulumi:"pets"` 18 } 19 20 // NewPerson registers a new resource with the given unique name, arguments, and options. 21 func NewPerson(ctx *pulumi.Context, 22 name string, args *PersonArgs, opts ...pulumi.ResourceOption) (*Person, error) { 23 if args == nil { 24 args = &PersonArgs{} 25 } 26 27 var resource Person 28 err := ctx.RegisterResource("example::Person", name, args, &resource, opts...) 29 if err != nil { 30 return nil, err 31 } 32 return &resource, nil 33 } 34 35 // GetPerson gets an existing Person resource's state with the given name, ID, and optional 36 // state properties that are used to uniquely qualify the lookup (nil if not required). 37 func GetPerson(ctx *pulumi.Context, 38 name string, id pulumi.IDInput, state *PersonState, opts ...pulumi.ResourceOption) (*Person, error) { 39 var resource Person 40 err := ctx.ReadResource("example::Person", name, id, state, &resource, opts...) 41 if err != nil { 42 return nil, err 43 } 44 return &resource, nil 45 } 46 47 // Input properties used for looking up and filtering Person resources. 48 type personState struct { 49 } 50 51 type PersonState struct { 52 } 53 54 func (PersonState) ElementType() reflect.Type { 55 return reflect.TypeOf((*personState)(nil)).Elem() 56 } 57 58 type personArgs struct { 59 Name *string `pulumi:"name"` 60 Pets []PetType `pulumi:"pets"` 61 } 62 63 // The set of arguments for constructing a Person resource. 64 type PersonArgs struct { 65 Name pulumi.StringPtrInput 66 Pets PetTypeArrayInput 67 } 68 69 func (PersonArgs) ElementType() reflect.Type { 70 return reflect.TypeOf((*personArgs)(nil)).Elem() 71 } 72 73 type PersonInput interface { 74 pulumi.Input 75 76 ToPersonOutput() PersonOutput 77 ToPersonOutputWithContext(ctx context.Context) PersonOutput 78 } 79 80 func (*Person) ElementType() reflect.Type { 81 return reflect.TypeOf((**Person)(nil)).Elem() 82 } 83 84 func (i *Person) ToPersonOutput() PersonOutput { 85 return i.ToPersonOutputWithContext(context.Background()) 86 } 87 88 func (i *Person) ToPersonOutputWithContext(ctx context.Context) PersonOutput { 89 return pulumi.ToOutputWithContext(ctx, i).(PersonOutput) 90 } 91 92 // PersonArrayInput is an input type that accepts PersonArray and PersonArrayOutput values. 93 // You can construct a concrete instance of `PersonArrayInput` via: 94 // 95 // PersonArray{ PersonArgs{...} } 96 type PersonArrayInput interface { 97 pulumi.Input 98 99 ToPersonArrayOutput() PersonArrayOutput 100 ToPersonArrayOutputWithContext(context.Context) PersonArrayOutput 101 } 102 103 type PersonArray []PersonInput 104 105 func (PersonArray) ElementType() reflect.Type { 106 return reflect.TypeOf((*[]*Person)(nil)).Elem() 107 } 108 109 func (i PersonArray) ToPersonArrayOutput() PersonArrayOutput { 110 return i.ToPersonArrayOutputWithContext(context.Background()) 111 } 112 113 func (i PersonArray) ToPersonArrayOutputWithContext(ctx context.Context) PersonArrayOutput { 114 return pulumi.ToOutputWithContext(ctx, i).(PersonArrayOutput) 115 } 116 117 // PersonMapInput is an input type that accepts PersonMap and PersonMapOutput values. 118 // You can construct a concrete instance of `PersonMapInput` via: 119 // 120 // PersonMap{ "key": PersonArgs{...} } 121 type PersonMapInput interface { 122 pulumi.Input 123 124 ToPersonMapOutput() PersonMapOutput 125 ToPersonMapOutputWithContext(context.Context) PersonMapOutput 126 } 127 128 type PersonMap map[string]PersonInput 129 130 func (PersonMap) ElementType() reflect.Type { 131 return reflect.TypeOf((*map[string]*Person)(nil)).Elem() 132 } 133 134 func (i PersonMap) ToPersonMapOutput() PersonMapOutput { 135 return i.ToPersonMapOutputWithContext(context.Background()) 136 } 137 138 func (i PersonMap) ToPersonMapOutputWithContext(ctx context.Context) PersonMapOutput { 139 return pulumi.ToOutputWithContext(ctx, i).(PersonMapOutput) 140 } 141 142 type PersonOutput struct{ *pulumi.OutputState } 143 144 func (PersonOutput) ElementType() reflect.Type { 145 return reflect.TypeOf((**Person)(nil)).Elem() 146 } 147 148 func (o PersonOutput) ToPersonOutput() PersonOutput { 149 return o 150 } 151 152 func (o PersonOutput) ToPersonOutputWithContext(ctx context.Context) PersonOutput { 153 return o 154 } 155 156 func (o PersonOutput) Name() pulumi.StringPtrOutput { 157 return o.ApplyT(func(v *Person) pulumi.StringPtrOutput { return v.Name }).(pulumi.StringPtrOutput) 158 } 159 160 func (o PersonOutput) Pets() PetTypeArrayOutput { 161 return o.ApplyT(func(v *Person) PetTypeArrayOutput { return v.Pets }).(PetTypeArrayOutput) 162 } 163 164 type PersonArrayOutput struct{ *pulumi.OutputState } 165 166 func (PersonArrayOutput) ElementType() reflect.Type { 167 return reflect.TypeOf((*[]*Person)(nil)).Elem() 168 } 169 170 func (o PersonArrayOutput) ToPersonArrayOutput() PersonArrayOutput { 171 return o 172 } 173 174 func (o PersonArrayOutput) ToPersonArrayOutputWithContext(ctx context.Context) PersonArrayOutput { 175 return o 176 } 177 178 func (o PersonArrayOutput) Index(i pulumi.IntInput) PersonOutput { 179 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Person { 180 return vs[0].([]*Person)[vs[1].(int)] 181 }).(PersonOutput) 182 } 183 184 type PersonMapOutput struct{ *pulumi.OutputState } 185 186 func (PersonMapOutput) ElementType() reflect.Type { 187 return reflect.TypeOf((*map[string]*Person)(nil)).Elem() 188 } 189 190 func (o PersonMapOutput) ToPersonMapOutput() PersonMapOutput { 191 return o 192 } 193 194 func (o PersonMapOutput) ToPersonMapOutputWithContext(ctx context.Context) PersonMapOutput { 195 return o 196 } 197 198 func (o PersonMapOutput) MapIndex(k pulumi.StringInput) PersonOutput { 199 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Person { 200 return vs[0].(map[string]*Person)[vs[1].(string)] 201 }).(PersonOutput) 202 } 203 204 func init() { 205 pulumi.RegisterInputType(reflect.TypeOf((*PersonInput)(nil)).Elem(), &Person{}) 206 pulumi.RegisterInputType(reflect.TypeOf((*PersonArrayInput)(nil)).Elem(), PersonArray{}) 207 pulumi.RegisterInputType(reflect.TypeOf((*PersonMapInput)(nil)).Elem(), PersonMap{}) 208 pulumi.RegisterOutputType(PersonOutput{}) 209 pulumi.RegisterOutputType(PersonArrayOutput{}) 210 pulumi.RegisterOutputType(PersonMapOutput{}) 211 }