github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/naming-collisions/go/example/resource.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 Resource struct {
    14  	pulumi.CustomResourceState
    15  
    16  	Bar pulumi.StringPtrOutput `pulumi:"bar"`
    17  }
    18  
    19  // NewResource registers a new resource with the given unique name, arguments, and options.
    20  func NewResource(ctx *pulumi.Context,
    21  	name string, args *ResourceArgs, opts ...pulumi.ResourceOption) (*Resource, error) {
    22  	if args == nil {
    23  		args = &ResourceArgs{}
    24  	}
    25  
    26  	var resource Resource
    27  	err := ctx.RegisterResource("example::Resource", name, args, &resource, opts...)
    28  	if err != nil {
    29  		return nil, err
    30  	}
    31  	return &resource, nil
    32  }
    33  
    34  // GetResource gets an existing Resource 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 GetResource(ctx *pulumi.Context,
    37  	name string, id pulumi.IDInput, state *ResourceState, opts ...pulumi.ResourceOption) (*Resource, error) {
    38  	var resource Resource
    39  	err := ctx.ReadResource("example::Resource", 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 Resource resources.
    47  type resourceState struct {
    48  }
    49  
    50  type ResourceState struct {
    51  }
    52  
    53  func (ResourceState) ElementType() reflect.Type {
    54  	return reflect.TypeOf((*resourceState)(nil)).Elem()
    55  }
    56  
    57  type resourceArgs struct {
    58  }
    59  
    60  // The set of arguments for constructing a Resource resource.
    61  type ResourceArgs struct {
    62  }
    63  
    64  func (ResourceArgs) ElementType() reflect.Type {
    65  	return reflect.TypeOf((*resourceArgs)(nil)).Elem()
    66  }
    67  
    68  type ResourceInput interface {
    69  	pulumi.Input
    70  
    71  	ToResourceOutput() ResourceOutput
    72  	ToResourceOutputWithContext(ctx context.Context) ResourceOutput
    73  }
    74  
    75  func (*Resource) ElementType() reflect.Type {
    76  	return reflect.TypeOf((**Resource)(nil)).Elem()
    77  }
    78  
    79  func (i *Resource) ToResourceOutput() ResourceOutput {
    80  	return i.ToResourceOutputWithContext(context.Background())
    81  }
    82  
    83  func (i *Resource) ToResourceOutputWithContext(ctx context.Context) ResourceOutput {
    84  	return pulumi.ToOutputWithContext(ctx, i).(ResourceOutput)
    85  }
    86  
    87  type ResourceOutput struct{ *pulumi.OutputState }
    88  
    89  func (ResourceOutput) ElementType() reflect.Type {
    90  	return reflect.TypeOf((**Resource)(nil)).Elem()
    91  }
    92  
    93  func (o ResourceOutput) ToResourceOutput() ResourceOutput {
    94  	return o
    95  }
    96  
    97  func (o ResourceOutput) ToResourceOutputWithContext(ctx context.Context) ResourceOutput {
    98  	return o
    99  }
   100  
   101  func (o ResourceOutput) Bar() pulumi.StringPtrOutput {
   102  	return o.ApplyT(func(v *Resource) pulumi.StringPtrOutput { return v.Bar }).(pulumi.StringPtrOutput)
   103  }
   104  
   105  func init() {
   106  	pulumi.RegisterInputType(reflect.TypeOf((*ResourceInput)(nil)).Elem(), &Resource{})
   107  	pulumi.RegisterOutputType(ResourceOutput{})
   108  }