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