pulumi/tests/testdata/codegen/assets-and-archives-go-gene.../go/example/resourceWithAssets.go

122 lines
4.4 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"
"assets-and-archives-go-generics-only/example/internal"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
type ResourceWithAssets struct {
pulumi.CustomResourceState
Archive pulumix.Output[pulumi.Archive] `pulumi:"archive"`
Asset pulumix.Output[pulumi.AssetOrArchive] `pulumi:"asset"`
Nested pulumix.GPtrOutput[TypeWithAssets, TypeWithAssetsOutput] `pulumi:"nested"`
}
// NewResourceWithAssets registers a new resource with the given unique name, arguments, and options.
func NewResourceWithAssets(ctx *pulumi.Context,
name string, args *ResourceWithAssetsArgs, opts ...pulumi.ResourceOption) (*ResourceWithAssets, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Source == nil {
return nil, errors.New("invalid value for required argument 'Source'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource ResourceWithAssets
err := ctx.RegisterResource("example:index:ResourceWithAssets", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetResourceWithAssets gets an existing ResourceWithAssets 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 GetResourceWithAssets(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ResourceWithAssetsState, opts ...pulumi.ResourceOption) (*ResourceWithAssets, error) {
var resource ResourceWithAssets
err := ctx.ReadResource("example:index:ResourceWithAssets", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ResourceWithAssets resources.
type resourceWithAssetsState struct {
}
type ResourceWithAssetsState struct {
}
func (ResourceWithAssetsState) ElementType() reflect.Type {
return reflect.TypeOf((*resourceWithAssetsState)(nil)).Elem()
}
type resourceWithAssetsArgs struct {
Archive pulumi.Archive `pulumi:"archive"`
Nested *TypeWithAssets `pulumi:"nested"`
Source pulumi.AssetOrArchive `pulumi:"source"`
}
// The set of arguments for constructing a ResourceWithAssets resource.
type ResourceWithAssetsArgs struct {
Archive pulumix.Input[*pulumi.Archive]
Nested pulumix.Input[*TypeWithAssetsArgs]
Source pulumix.Input[pulumi.AssetOrArchive]
}
func (ResourceWithAssetsArgs) ElementType() reflect.Type {
return reflect.TypeOf((*resourceWithAssetsArgs)(nil)).Elem()
}
type ResourceWithAssetsOutput struct{ *pulumi.OutputState }
func (ResourceWithAssetsOutput) ElementType() reflect.Type {
return reflect.TypeOf((*ResourceWithAssets)(nil)).Elem()
}
func (o ResourceWithAssetsOutput) ToResourceWithAssetsOutput() ResourceWithAssetsOutput {
return o
}
func (o ResourceWithAssetsOutput) ToResourceWithAssetsOutputWithContext(ctx context.Context) ResourceWithAssetsOutput {
return o
}
func (o ResourceWithAssetsOutput) ToOutput(ctx context.Context) pulumix.Output[ResourceWithAssets] {
return pulumix.Output[ResourceWithAssets]{
OutputState: o.OutputState,
}
}
func (o ResourceWithAssetsOutput) Archive() pulumix.Output[pulumi.Archive] {
value := pulumix.Apply[ResourceWithAssets](o, func(v ResourceWithAssets) pulumix.Output[pulumi.Archive] { return v.Archive })
return pulumix.Flatten[pulumi.Archive, pulumix.Output[pulumi.Archive]](value)
}
func (o ResourceWithAssetsOutput) Asset() pulumix.Output[pulumi.AssetOrArchive] {
value := pulumix.Apply[ResourceWithAssets](o, func(v ResourceWithAssets) pulumix.Output[pulumi.AssetOrArchive] { return v.Asset })
return pulumix.Flatten[pulumi.AssetOrArchive, pulumix.Output[pulumi.AssetOrArchive]](value)
}
func (o ResourceWithAssetsOutput) Nested() pulumix.GPtrOutput[TypeWithAssets, TypeWithAssetsOutput] {
value := pulumix.Apply[ResourceWithAssets](o, func(v ResourceWithAssets) pulumix.GPtrOutput[TypeWithAssets, TypeWithAssetsOutput] { return v.Nested })
unwrapped := pulumix.Flatten[*TypeWithAssets, pulumix.GPtrOutput[TypeWithAssets, TypeWithAssetsOutput]](value)
return pulumix.GPtrOutput[TypeWithAssets, TypeWithAssetsOutput]{OutputState: unwrapped.OutputState}
}
func init() {
pulumi.RegisterOutputType(ResourceWithAssetsOutput{})
}