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

139 lines
4.1 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 pulumi.StringOutput `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 pulumi.StringInput
}
func (BasicResourceV3Args) ElementType() reflect.Type {
return reflect.TypeOf((*basicResourceV3Args)(nil)).Elem()
}
type BasicResourceV3Input interface {
pulumi.Input
ToBasicResourceV3Output() BasicResourceV3Output
ToBasicResourceV3OutputWithContext(ctx context.Context) BasicResourceV3Output
}
func (*BasicResourceV3) ElementType() reflect.Type {
return reflect.TypeOf((**BasicResourceV3)(nil)).Elem()
}
func (i *BasicResourceV3) ToBasicResourceV3Output() BasicResourceV3Output {
return i.ToBasicResourceV3OutputWithContext(context.Background())
}
func (i *BasicResourceV3) ToBasicResourceV3OutputWithContext(ctx context.Context) BasicResourceV3Output {
return pulumi.ToOutputWithContext(ctx, i).(BasicResourceV3Output)
}
func (i *BasicResourceV3) ToOutput(ctx context.Context) pulumix.Output[*BasicResourceV3] {
return pulumix.Output[*BasicResourceV3]{
OutputState: i.ToBasicResourceV3OutputWithContext(ctx).OutputState,
}
}
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() pulumi.StringOutput {
return o.ApplyT(func(v *BasicResourceV3) pulumi.StringOutput { return v.Bar }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*BasicResourceV3Input)(nil)).Elem(), &BasicResourceV3{})
pulumi.RegisterOutputType(BasicResourceV3Output{})
}