mirror of https://github.com/pulumi/pulumi.git
130 lines
3.8 KiB
Go
130 lines
3.8 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 pulumi.StringOutput `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 pulumi.StringInput
|
|
}
|
|
|
|
func (BasicResourceArgs) ElementType() reflect.Type {
|
|
return reflect.TypeOf((*basicResourceArgs)(nil)).Elem()
|
|
}
|
|
|
|
type BasicResourceInput interface {
|
|
pulumi.Input
|
|
|
|
ToBasicResourceOutput() BasicResourceOutput
|
|
ToBasicResourceOutputWithContext(ctx context.Context) BasicResourceOutput
|
|
}
|
|
|
|
func (*BasicResource) ElementType() reflect.Type {
|
|
return reflect.TypeOf((**BasicResource)(nil)).Elem()
|
|
}
|
|
|
|
func (i *BasicResource) ToBasicResourceOutput() BasicResourceOutput {
|
|
return i.ToBasicResourceOutputWithContext(context.Background())
|
|
}
|
|
|
|
func (i *BasicResource) ToBasicResourceOutputWithContext(ctx context.Context) BasicResourceOutput {
|
|
return pulumi.ToOutputWithContext(ctx, i).(BasicResourceOutput)
|
|
}
|
|
|
|
func (i *BasicResource) ToOutput(ctx context.Context) pulumix.Output[*BasicResource] {
|
|
return pulumix.Output[*BasicResource]{
|
|
OutputState: i.ToBasicResourceOutputWithContext(ctx).OutputState,
|
|
}
|
|
}
|
|
|
|
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() pulumi.StringOutput {
|
|
return o.ApplyT(func(v *BasicResource) pulumi.StringOutput { return v.Bar }).(pulumi.StringOutput)
|
|
}
|
|
|
|
func init() {
|
|
pulumi.RegisterInputType(reflect.TypeOf((*BasicResourceInput)(nil)).Elem(), &BasicResource{})
|
|
pulumi.RegisterOutputType(BasicResourceOutput{})
|
|
}
|