github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/simple-plain-schema-with-root-package/go/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 different
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"github.com/pkg/errors"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  type Component struct {
    15  	pulumi.ResourceState
    16  
    17  	A   pulumi.BoolOutput      `pulumi:"a"`
    18  	B   pulumi.BoolPtrOutput   `pulumi:"b"`
    19  	Bar FooPtrOutput           `pulumi:"bar"`
    20  	Baz FooArrayOutput         `pulumi:"baz"`
    21  	C   pulumi.IntOutput       `pulumi:"c"`
    22  	D   pulumi.IntPtrOutput    `pulumi:"d"`
    23  	E   pulumi.StringOutput    `pulumi:"e"`
    24  	F   pulumi.StringPtrOutput `pulumi:"f"`
    25  	Foo FooPtrOutput           `pulumi:"foo"`
    26  }
    27  
    28  // NewComponent registers a new resource with the given unique name, arguments, and options.
    29  func NewComponent(ctx *pulumi.Context,
    30  	name string, args *ComponentArgs, opts ...pulumi.ResourceOption) (*Component, error) {
    31  	if args == nil {
    32  		return nil, errors.New("missing one or more required arguments")
    33  	}
    34  
    35  	var resource Component
    36  	err := ctx.RegisterRemoteComponentResource("example::Component", name, args, &resource, opts...)
    37  	if err != nil {
    38  		return nil, err
    39  	}
    40  	return &resource, nil
    41  }
    42  
    43  type componentArgs struct {
    44  	A   bool    `pulumi:"a"`
    45  	B   *bool   `pulumi:"b"`
    46  	Bar *Foo    `pulumi:"bar"`
    47  	Baz []Foo   `pulumi:"baz"`
    48  	C   int     `pulumi:"c"`
    49  	D   *int    `pulumi:"d"`
    50  	E   string  `pulumi:"e"`
    51  	F   *string `pulumi:"f"`
    52  	Foo *Foo    `pulumi:"foo"`
    53  }
    54  
    55  // The set of arguments for constructing a Component resource.
    56  type ComponentArgs struct {
    57  	A   bool
    58  	B   *bool
    59  	Bar *FooArgs
    60  	Baz []FooInput
    61  	C   int
    62  	D   *int
    63  	E   string
    64  	F   *string
    65  	Foo FooPtrInput
    66  }
    67  
    68  func (ComponentArgs) ElementType() reflect.Type {
    69  	return reflect.TypeOf((*componentArgs)(nil)).Elem()
    70  }
    71  
    72  type ComponentInput interface {
    73  	pulumi.Input
    74  
    75  	ToComponentOutput() ComponentOutput
    76  	ToComponentOutputWithContext(ctx context.Context) ComponentOutput
    77  }
    78  
    79  func (*Component) ElementType() reflect.Type {
    80  	return reflect.TypeOf((**Component)(nil)).Elem()
    81  }
    82  
    83  func (i *Component) ToComponentOutput() ComponentOutput {
    84  	return i.ToComponentOutputWithContext(context.Background())
    85  }
    86  
    87  func (i *Component) ToComponentOutputWithContext(ctx context.Context) ComponentOutput {
    88  	return pulumi.ToOutputWithContext(ctx, i).(ComponentOutput)
    89  }
    90  
    91  type ComponentOutput struct{ *pulumi.OutputState }
    92  
    93  func (ComponentOutput) ElementType() reflect.Type {
    94  	return reflect.TypeOf((**Component)(nil)).Elem()
    95  }
    96  
    97  func (o ComponentOutput) ToComponentOutput() ComponentOutput {
    98  	return o
    99  }
   100  
   101  func (o ComponentOutput) ToComponentOutputWithContext(ctx context.Context) ComponentOutput {
   102  	return o
   103  }
   104  
   105  func (o ComponentOutput) A() pulumi.BoolOutput {
   106  	return o.ApplyT(func(v *Component) pulumi.BoolOutput { return v.A }).(pulumi.BoolOutput)
   107  }
   108  
   109  func (o ComponentOutput) B() pulumi.BoolPtrOutput {
   110  	return o.ApplyT(func(v *Component) pulumi.BoolPtrOutput { return v.B }).(pulumi.BoolPtrOutput)
   111  }
   112  
   113  func (o ComponentOutput) Bar() FooPtrOutput {
   114  	return o.ApplyT(func(v *Component) FooPtrOutput { return v.Bar }).(FooPtrOutput)
   115  }
   116  
   117  func (o ComponentOutput) Baz() FooArrayOutput {
   118  	return o.ApplyT(func(v *Component) FooArrayOutput { return v.Baz }).(FooArrayOutput)
   119  }
   120  
   121  func (o ComponentOutput) C() pulumi.IntOutput {
   122  	return o.ApplyT(func(v *Component) pulumi.IntOutput { return v.C }).(pulumi.IntOutput)
   123  }
   124  
   125  func (o ComponentOutput) D() pulumi.IntPtrOutput {
   126  	return o.ApplyT(func(v *Component) pulumi.IntPtrOutput { return v.D }).(pulumi.IntPtrOutput)
   127  }
   128  
   129  func (o ComponentOutput) E() pulumi.StringOutput {
   130  	return o.ApplyT(func(v *Component) pulumi.StringOutput { return v.E }).(pulumi.StringOutput)
   131  }
   132  
   133  func (o ComponentOutput) F() pulumi.StringPtrOutput {
   134  	return o.ApplyT(func(v *Component) pulumi.StringPtrOutput { return v.F }).(pulumi.StringPtrOutput)
   135  }
   136  
   137  func (o ComponentOutput) Foo() FooPtrOutput {
   138  	return o.ApplyT(func(v *Component) FooPtrOutput { return v.Foo }).(FooPtrOutput)
   139  }
   140  
   141  func init() {
   142  	pulumi.RegisterInputType(reflect.TypeOf((*ComponentInput)(nil)).Elem(), &Component{})
   143  	pulumi.RegisterOutputType(ComponentOutput{})
   144  }