pulumi/tests/testdata/codegen/simple-resource-with-aliases/go/example/x/basicResourceV3.go

114 lines
3.2 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"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
"simple-resource-with-aliases/example/internal"
)
type BasicResourceV3 struct {
pulumi.CustomResourceState
Bar pulumix.Output[string] `pulumi:"bar"`
}
// NewBasicResourceV3 registers a new resource with the given unique name, arguments, and options.
func NewBasicResourceV3(ctx *pulumi.Context,
name string, args *BasicResourceV3Args, opts ...pulumi.ResourceOption) (*BasicResourceV3, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Bar == nil {
return nil, errors.New("invalid value for required argument 'Bar'")
}
aliases := pulumi.Aliases([]pulumi.Alias{
{
Type: pulumi.String("example:index:BasicResource"),
},
{
Type: pulumi.String("example:index:BasicResourceV2"),
},
})
opts = append(opts, aliases)
opts = internal.PkgResourceDefaultOpts(opts)
var resource BasicResourceV3
err := ctx.RegisterResource("example:index:BasicResourceV3", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetBasicResourceV3 gets an existing BasicResourceV3 resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetBasicResourceV3(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *BasicResourceV3State, opts ...pulumi.ResourceOption) (*BasicResourceV3, error) {
var resource BasicResourceV3
err := ctx.ReadResource("example:index:BasicResourceV3", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering BasicResourceV3 resources.
type basicResourceV3State struct {
}
type BasicResourceV3State struct {
}
func (BasicResourceV3State) ElementType() reflect.Type {
return reflect.TypeOf((*basicResourceV3State)(nil)).Elem()
}
type basicResourceV3Args struct {
Bar string `pulumi:"bar"`
}
// The set of arguments for constructing a BasicResourceV3 resource.
type BasicResourceV3Args struct {
Bar pulumix.Input[string]
}
func (BasicResourceV3Args) ElementType() reflect.Type {
return reflect.TypeOf((*basicResourceV3Args)(nil)).Elem()
}
type BasicResourceV3Output struct{ *pulumi.OutputState }
func (BasicResourceV3Output) ElementType() reflect.Type {
return reflect.TypeOf((*BasicResourceV3)(nil)).Elem()
}
func (o BasicResourceV3Output) ToBasicResourceV3Output() BasicResourceV3Output {
return o
}
func (o BasicResourceV3Output) ToBasicResourceV3OutputWithContext(ctx context.Context) BasicResourceV3Output {
return o
}
func (o BasicResourceV3Output) ToOutput(ctx context.Context) pulumix.Output[BasicResourceV3] {
return pulumix.Output[BasicResourceV3]{
OutputState: o.OutputState,
}
}
func (o BasicResourceV3Output) Bar() pulumix.Output[string] {
value := pulumix.Apply[BasicResourceV3](o, func(v BasicResourceV3) pulumix.Output[string] { return v.Bar })
return pulumix.Flatten[string, pulumix.Output[string]](value)
}
func init() {
pulumi.RegisterOutputType(BasicResourceV3Output{})
}