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

111 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 BasicResourceV2 struct {
pulumi.CustomResourceState
Bar pulumix.Output[string] `pulumi:"bar"`
}
// NewBasicResourceV2 registers a new resource with the given unique name, arguments, and options.
func NewBasicResourceV2(ctx *pulumi.Context,
name string, args *BasicResourceV2Args, opts ...pulumi.ResourceOption) (*BasicResourceV2, 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"),
},
})
opts = append(opts, aliases)
opts = internal.PkgResourceDefaultOpts(opts)
var resource BasicResourceV2
err := ctx.RegisterResource("example:index:BasicResourceV2", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetBasicResourceV2 gets an existing BasicResourceV2 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 GetBasicResourceV2(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *BasicResourceV2State, opts ...pulumi.ResourceOption) (*BasicResourceV2, error) {
var resource BasicResourceV2
err := ctx.ReadResource("example:index:BasicResourceV2", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering BasicResourceV2 resources.
type basicResourceV2State struct {
}
type BasicResourceV2State struct {
}
func (BasicResourceV2State) ElementType() reflect.Type {
return reflect.TypeOf((*basicResourceV2State)(nil)).Elem()
}
type basicResourceV2Args struct {
Bar string `pulumi:"bar"`
}
// The set of arguments for constructing a BasicResourceV2 resource.
type BasicResourceV2Args struct {
Bar pulumix.Input[string]
}
func (BasicResourceV2Args) ElementType() reflect.Type {
return reflect.TypeOf((*basicResourceV2Args)(nil)).Elem()
}
type BasicResourceV2Output struct{ *pulumi.OutputState }
func (BasicResourceV2Output) ElementType() reflect.Type {
return reflect.TypeOf((*BasicResourceV2)(nil)).Elem()
}
func (o BasicResourceV2Output) ToBasicResourceV2Output() BasicResourceV2Output {
return o
}
func (o BasicResourceV2Output) ToBasicResourceV2OutputWithContext(ctx context.Context) BasicResourceV2Output {
return o
}
func (o BasicResourceV2Output) ToOutput(ctx context.Context) pulumix.Output[BasicResourceV2] {
return pulumix.Output[BasicResourceV2]{
OutputState: o.OutputState,
}
}
func (o BasicResourceV2Output) Bar() pulumix.Output[string] {
value := pulumix.Apply[BasicResourceV2](o, func(v BasicResourceV2) pulumix.Output[string] { return v.Bar })
return pulumix.Flatten[string, pulumix.Output[string]](value)
}
func init() {
pulumi.RegisterOutputType(BasicResourceV2Output{})
}