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

131 lines
4.3 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/example/internal"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type ResourceWithAssets struct {
pulumi.CustomResourceState
Archive pulumi.ArchiveOutput `pulumi:"archive"`
Asset pulumi.AssetOrArchiveOutput `pulumi:"asset"`
Nested TypeWithAssetsPtrOutput `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 pulumi.ArchiveInput
Nested TypeWithAssetsPtrInput
Source pulumi.AssetOrArchiveInput
}
func (ResourceWithAssetsArgs) ElementType() reflect.Type {
return reflect.TypeOf((*resourceWithAssetsArgs)(nil)).Elem()
}
type ResourceWithAssetsInput interface {
pulumi.Input
ToResourceWithAssetsOutput() ResourceWithAssetsOutput
ToResourceWithAssetsOutputWithContext(ctx context.Context) ResourceWithAssetsOutput
}
func (*ResourceWithAssets) ElementType() reflect.Type {
return reflect.TypeOf((**ResourceWithAssets)(nil)).Elem()
}
func (i *ResourceWithAssets) ToResourceWithAssetsOutput() ResourceWithAssetsOutput {
return i.ToResourceWithAssetsOutputWithContext(context.Background())
}
func (i *ResourceWithAssets) ToResourceWithAssetsOutputWithContext(ctx context.Context) ResourceWithAssetsOutput {
return pulumi.ToOutputWithContext(ctx, i).(ResourceWithAssetsOutput)
}
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) Archive() pulumi.ArchiveOutput {
return o.ApplyT(func(v *ResourceWithAssets) pulumi.ArchiveOutput { return v.Archive }).(pulumi.ArchiveOutput)
}
func (o ResourceWithAssetsOutput) Asset() pulumi.AssetOrArchiveOutput {
return o.ApplyT(func(v *ResourceWithAssets) pulumi.AssetOrArchiveOutput { return v.Asset }).(pulumi.AssetOrArchiveOutput)
}
func (o ResourceWithAssetsOutput) Nested() TypeWithAssetsPtrOutput {
return o.ApplyT(func(v *ResourceWithAssets) TypeWithAssetsPtrOutput { return v.Nested }).(TypeWithAssetsPtrOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ResourceWithAssetsInput)(nil)).Elem(), &ResourceWithAssets{})
pulumi.RegisterOutputType(ResourceWithAssetsOutput{})
}