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