github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/simple-methods-schema/go/example/foo.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-random/sdk/v4/go/random"
    11  	"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test/testdata/simple-methods-schema/go/example/nested"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  type Foo struct {
    16  	pulumi.ResourceState
    17  }
    18  
    19  // NewFoo registers a new resource with the given unique name, arguments, and options.
    20  func NewFoo(ctx *pulumi.Context,
    21  	name string, args *FooArgs, opts ...pulumi.ResourceOption) (*Foo, error) {
    22  	if args == nil {
    23  		args = &FooArgs{}
    24  	}
    25  
    26  	var resource Foo
    27  	err := ctx.RegisterRemoteComponentResource("example::Foo", name, args, &resource, opts...)
    28  	if err != nil {
    29  		return nil, err
    30  	}
    31  	return &resource, nil
    32  }
    33  
    34  type fooArgs struct {
    35  }
    36  
    37  // The set of arguments for constructing a Foo resource.
    38  type FooArgs struct {
    39  }
    40  
    41  func (FooArgs) ElementType() reflect.Type {
    42  	return reflect.TypeOf((*fooArgs)(nil)).Elem()
    43  }
    44  
    45  // A description of bar.
    46  func (r *Foo) Bar(ctx *pulumi.Context, args *FooBarArgs) (FooBarResultOutput, error) {
    47  	out, err := ctx.Call("example::Foo/bar", args, FooBarResultOutput{}, r)
    48  	if err != nil {
    49  		return FooBarResultOutput{}, err
    50  	}
    51  	return out.(FooBarResultOutput), nil
    52  }
    53  
    54  type fooBarArgs struct {
    55  	Baz                 *nested.Baz       `pulumi:"baz"`
    56  	BazPlain            *nested.Baz       `pulumi:"bazPlain"`
    57  	BazRequired         nested.Baz        `pulumi:"bazRequired"`
    58  	BoolValue           *bool             `pulumi:"boolValue"`
    59  	BoolValuePlain      *bool             `pulumi:"boolValuePlain"`
    60  	BoolValueRequired   bool              `pulumi:"boolValueRequired"`
    61  	Name                *random.RandomPet `pulumi:"name"`
    62  	NamePlain           *random.RandomPet `pulumi:"namePlain"`
    63  	NameRequired        *random.RandomPet `pulumi:"nameRequired"`
    64  	StringValue         *string           `pulumi:"stringValue"`
    65  	StringValuePlain    *string           `pulumi:"stringValuePlain"`
    66  	StringValueRequired string            `pulumi:"stringValueRequired"`
    67  }
    68  
    69  // The set of arguments for the Bar method of the Foo resource.
    70  type FooBarArgs struct {
    71  	Baz                 nested.BazPtrInput
    72  	BazPlain            *nested.BazArgs
    73  	BazRequired         nested.BazInput
    74  	BoolValue           pulumi.BoolPtrInput
    75  	BoolValuePlain      *bool
    76  	BoolValueRequired   pulumi.BoolInput
    77  	Name                random.RandomPetInput
    78  	NamePlain           *random.RandomPet
    79  	NameRequired        random.RandomPetInput
    80  	StringValue         pulumi.StringPtrInput
    81  	StringValuePlain    *string
    82  	StringValueRequired pulumi.StringInput
    83  }
    84  
    85  func (FooBarArgs) ElementType() reflect.Type {
    86  	return reflect.TypeOf((*fooBarArgs)(nil)).Elem()
    87  }
    88  
    89  type FooBarResult struct {
    90  	SomeValue string `pulumi:"someValue"`
    91  }
    92  
    93  type FooBarResultOutput struct{ *pulumi.OutputState }
    94  
    95  func (FooBarResultOutput) ElementType() reflect.Type {
    96  	return reflect.TypeOf((*FooBarResult)(nil)).Elem()
    97  }
    98  
    99  func (o FooBarResultOutput) SomeValue() pulumi.StringOutput {
   100  	return o.ApplyT(func(v FooBarResult) string { return v.SomeValue }).(pulumi.StringOutput)
   101  }
   102  
   103  func (r *Foo) Baz(ctx *pulumi.Context) error {
   104  	_, err := ctx.Call("example::Foo/baz", nil, pulumi.AnyOutput{}, r)
   105  	return err
   106  }
   107  
   108  // Do something with something else
   109  func (r *Foo) GenerateKubeconfig(ctx *pulumi.Context, args *FooGenerateKubeconfigArgs) (FooGenerateKubeconfigResultOutput, error) {
   110  	out, err := ctx.Call("example::Foo/generateKubeconfig", args, FooGenerateKubeconfigResultOutput{}, r)
   111  	if err != nil {
   112  		return FooGenerateKubeconfigResultOutput{}, err
   113  	}
   114  	return out.(FooGenerateKubeconfigResultOutput), nil
   115  }
   116  
   117  type fooGenerateKubeconfigArgs struct {
   118  	BoolValue bool `pulumi:"boolValue"`
   119  }
   120  
   121  // The set of arguments for the GenerateKubeconfig method of the Foo resource.
   122  type FooGenerateKubeconfigArgs struct {
   123  	BoolValue bool
   124  }
   125  
   126  func (FooGenerateKubeconfigArgs) ElementType() reflect.Type {
   127  	return reflect.TypeOf((*fooGenerateKubeconfigArgs)(nil)).Elem()
   128  }
   129  
   130  type FooGenerateKubeconfigResult struct {
   131  	Kubeconfig string `pulumi:"kubeconfig"`
   132  }
   133  
   134  type FooGenerateKubeconfigResultOutput struct{ *pulumi.OutputState }
   135  
   136  func (FooGenerateKubeconfigResultOutput) ElementType() reflect.Type {
   137  	return reflect.TypeOf((*FooGenerateKubeconfigResult)(nil)).Elem()
   138  }
   139  
   140  func (o FooGenerateKubeconfigResultOutput) Kubeconfig() pulumi.StringOutput {
   141  	return o.ApplyT(func(v FooGenerateKubeconfigResult) string { return v.Kubeconfig }).(pulumi.StringOutput)
   142  }
   143  
   144  type FooInput interface {
   145  	pulumi.Input
   146  
   147  	ToFooOutput() FooOutput
   148  	ToFooOutputWithContext(ctx context.Context) FooOutput
   149  }
   150  
   151  func (*Foo) ElementType() reflect.Type {
   152  	return reflect.TypeOf((**Foo)(nil)).Elem()
   153  }
   154  
   155  func (i *Foo) ToFooOutput() FooOutput {
   156  	return i.ToFooOutputWithContext(context.Background())
   157  }
   158  
   159  func (i *Foo) ToFooOutputWithContext(ctx context.Context) FooOutput {
   160  	return pulumi.ToOutputWithContext(ctx, i).(FooOutput)
   161  }
   162  
   163  type FooOutput struct{ *pulumi.OutputState }
   164  
   165  func (FooOutput) ElementType() reflect.Type {
   166  	return reflect.TypeOf((**Foo)(nil)).Elem()
   167  }
   168  
   169  func (o FooOutput) ToFooOutput() FooOutput {
   170  	return o
   171  }
   172  
   173  func (o FooOutput) ToFooOutputWithContext(ctx context.Context) FooOutput {
   174  	return o
   175  }
   176  
   177  func init() {
   178  	pulumi.RegisterInputType(reflect.TypeOf((*FooInput)(nil)).Elem(), &Foo{})
   179  	pulumi.RegisterOutputType(FooOutput{})
   180  	pulumi.RegisterOutputType(FooBarResultOutput{})
   181  	pulumi.RegisterOutputType(FooGenerateKubeconfigResultOutput{})
   182  }