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