mirror of https://github.com/pulumi/pulumi.git
105 lines
3.0 KiB
Go
105 lines
3.0 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 BasicResource struct {
|
|
pulumi.CustomResourceState
|
|
|
|
Bar pulumix.Output[string] `pulumi:"bar"`
|
|
}
|
|
|
|
// NewBasicResource registers a new resource with the given unique name, arguments, and options.
|
|
func NewBasicResource(ctx *pulumi.Context,
|
|
name string, args *BasicResourceArgs, opts ...pulumi.ResourceOption) (*BasicResource, 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'")
|
|
}
|
|
opts = internal.PkgResourceDefaultOpts(opts)
|
|
var resource BasicResource
|
|
err := ctx.RegisterResource("example:index:BasicResource", name, args, &resource, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &resource, nil
|
|
}
|
|
|
|
// GetBasicResource gets an existing BasicResource 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 GetBasicResource(ctx *pulumi.Context,
|
|
name string, id pulumi.IDInput, state *BasicResourceState, opts ...pulumi.ResourceOption) (*BasicResource, error) {
|
|
var resource BasicResource
|
|
err := ctx.ReadResource("example:index:BasicResource", name, id, state, &resource, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &resource, nil
|
|
}
|
|
|
|
// Input properties used for looking up and filtering BasicResource resources.
|
|
type basicResourceState struct {
|
|
}
|
|
|
|
type BasicResourceState struct {
|
|
}
|
|
|
|
func (BasicResourceState) ElementType() reflect.Type {
|
|
return reflect.TypeOf((*basicResourceState)(nil)).Elem()
|
|
}
|
|
|
|
type basicResourceArgs struct {
|
|
Bar string `pulumi:"bar"`
|
|
}
|
|
|
|
// The set of arguments for constructing a BasicResource resource.
|
|
type BasicResourceArgs struct {
|
|
Bar pulumix.Input[string]
|
|
}
|
|
|
|
func (BasicResourceArgs) ElementType() reflect.Type {
|
|
return reflect.TypeOf((*basicResourceArgs)(nil)).Elem()
|
|
}
|
|
|
|
type BasicResourceOutput struct{ *pulumi.OutputState }
|
|
|
|
func (BasicResourceOutput) ElementType() reflect.Type {
|
|
return reflect.TypeOf((*BasicResource)(nil)).Elem()
|
|
}
|
|
|
|
func (o BasicResourceOutput) ToBasicResourceOutput() BasicResourceOutput {
|
|
return o
|
|
}
|
|
|
|
func (o BasicResourceOutput) ToBasicResourceOutputWithContext(ctx context.Context) BasicResourceOutput {
|
|
return o
|
|
}
|
|
|
|
func (o BasicResourceOutput) ToOutput(ctx context.Context) pulumix.Output[BasicResource] {
|
|
return pulumix.Output[BasicResource]{
|
|
OutputState: o.OutputState,
|
|
}
|
|
}
|
|
|
|
func (o BasicResourceOutput) Bar() pulumix.Output[string] {
|
|
value := pulumix.Apply[BasicResource](o, func(v BasicResource) pulumix.Output[string] { return v.Bar })
|
|
return pulumix.Flatten[string, pulumix.Output[string]](value)
|
|
}
|
|
|
|
func init() {
|
|
pulumi.RegisterOutputType(BasicResourceOutput{})
|
|
}
|