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