pulumi/tests/testdata/codegen/simple-methods-schema/go/example/foo.go

185 lines
5.5 KiB
Go

// Code generated by test DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package example
import (
"context"
"reflect"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test/testdata/simple-methods-schema/go/example/internal"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test/testdata/simple-methods-schema/go/example/nested"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type Foo struct {
pulumi.ResourceState
}
// NewFoo registers a new resource with the given unique name, arguments, and options.
func NewFoo(ctx *pulumi.Context,
name string, args *FooArgs, opts ...pulumi.ResourceOption) (*Foo, error) {
if args == nil {
args = &FooArgs{}
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Foo
err := ctx.RegisterRemoteComponentResource("example::Foo", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
type fooArgs struct {
}
// The set of arguments for constructing a Foo resource.
type FooArgs struct {
}
func (FooArgs) ElementType() reflect.Type {
return reflect.TypeOf((*fooArgs)(nil)).Elem()
}
// A description of bar.
func (r *Foo) Bar(ctx *pulumi.Context, args *FooBarArgs) (FooBarResultOutput, error) {
out, err := ctx.Call("example::Foo/bar", args, FooBarResultOutput{}, r)
if err != nil {
return FooBarResultOutput{}, err
}
return out.(FooBarResultOutput), nil
}
type fooBarArgs struct {
Baz *nested.Baz `pulumi:"baz"`
BazPlain *nested.Baz `pulumi:"bazPlain"`
BazRequired nested.Baz `pulumi:"bazRequired"`
BoolValue *bool `pulumi:"boolValue"`
BoolValuePlain *bool `pulumi:"boolValuePlain"`
BoolValueRequired bool `pulumi:"boolValueRequired"`
Name *random.RandomPet `pulumi:"name"`
NamePlain *random.RandomPet `pulumi:"namePlain"`
NameRequired *random.RandomPet `pulumi:"nameRequired"`
StringValue *string `pulumi:"stringValue"`
StringValuePlain *string `pulumi:"stringValuePlain"`
StringValueRequired string `pulumi:"stringValueRequired"`
}
// The set of arguments for the Bar method of the Foo resource.
type FooBarArgs struct {
Baz nested.BazPtrInput
BazPlain *nested.BazArgs
BazRequired nested.BazInput
BoolValue pulumi.BoolPtrInput
BoolValuePlain *bool
BoolValueRequired pulumi.BoolInput
Name random.RandomPetInput
NamePlain *random.RandomPet
NameRequired random.RandomPetInput
StringValue pulumi.StringPtrInput
StringValuePlain *string
StringValueRequired pulumi.StringInput
}
func (FooBarArgs) ElementType() reflect.Type {
return reflect.TypeOf((*fooBarArgs)(nil)).Elem()
}
type FooBarResult struct {
SomeValue string `pulumi:"someValue"`
}
type FooBarResultOutput struct{ *pulumi.OutputState }
func (FooBarResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*FooBarResult)(nil)).Elem()
}
func (o FooBarResultOutput) SomeValue() pulumi.StringOutput {
return o.ApplyT(func(v FooBarResult) string { return v.SomeValue }).(pulumi.StringOutput)
}
func (r *Foo) Baz(ctx *pulumi.Context) error {
_, err := ctx.Call("example::Foo/baz", nil, pulumi.AnyOutput{}, r)
return err
}
// Do something with something else
func (r *Foo) GenerateKubeconfig(ctx *pulumi.Context, args *FooGenerateKubeconfigArgs) (FooGenerateKubeconfigResultOutput, error) {
out, err := ctx.Call("example::Foo/generateKubeconfig", args, FooGenerateKubeconfigResultOutput{}, r)
if err != nil {
return FooGenerateKubeconfigResultOutput{}, err
}
return out.(FooGenerateKubeconfigResultOutput), nil
}
type fooGenerateKubeconfigArgs struct {
BoolValue bool `pulumi:"boolValue"`
}
// The set of arguments for the GenerateKubeconfig method of the Foo resource.
type FooGenerateKubeconfigArgs struct {
BoolValue bool
}
func (FooGenerateKubeconfigArgs) ElementType() reflect.Type {
return reflect.TypeOf((*fooGenerateKubeconfigArgs)(nil)).Elem()
}
type FooGenerateKubeconfigResult struct {
Kubeconfig string `pulumi:"kubeconfig"`
}
type FooGenerateKubeconfigResultOutput struct{ *pulumi.OutputState }
func (FooGenerateKubeconfigResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*FooGenerateKubeconfigResult)(nil)).Elem()
}
func (o FooGenerateKubeconfigResultOutput) Kubeconfig() pulumi.StringOutput {
return o.ApplyT(func(v FooGenerateKubeconfigResult) string { return v.Kubeconfig }).(pulumi.StringOutput)
}
type FooInput interface {
pulumi.Input
ToFooOutput() FooOutput
ToFooOutputWithContext(ctx context.Context) FooOutput
}
func (*Foo) ElementType() reflect.Type {
return reflect.TypeOf((**Foo)(nil)).Elem()
}
func (i *Foo) ToFooOutput() FooOutput {
return i.ToFooOutputWithContext(context.Background())
}
func (i *Foo) ToFooOutputWithContext(ctx context.Context) FooOutput {
return pulumi.ToOutputWithContext(ctx, i).(FooOutput)
}
type FooOutput struct{ *pulumi.OutputState }
func (FooOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Foo)(nil)).Elem()
}
func (o FooOutput) ToFooOutput() FooOutput {
return o
}
func (o FooOutput) ToFooOutputWithContext(ctx context.Context) FooOutput {
return o
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*FooInput)(nil)).Elem(), &Foo{})
pulumi.RegisterOutputType(FooOutput{})
pulumi.RegisterOutputType(FooBarResultOutput{})
pulumi.RegisterOutputType(FooGenerateKubeconfigResultOutput{})
}