pulumi/tests/testdata/codegen/any-resource/go/example/resourceWithResources.go

139 lines
5.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"
"any-resource/example/internal"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type ResourceWithResources struct {
pulumi.CustomResourceState
Nested TypeWithResourcesPtrOutput `pulumi:"nested"`
OptionalResource pulumi.ResourceOutput `pulumi:"optionalResource"`
Resource pulumi.ResourceOutput `pulumi:"resource"`
ResourceList pulumi.ResourceArrayOutput `pulumi:"resourceList"`
ResourceMap pulumi.ResourceMapOutput `pulumi:"resourceMap"`
}
// NewResourceWithResources registers a new resource with the given unique name, arguments, and options.
func NewResourceWithResources(ctx *pulumi.Context,
name string, args *ResourceWithResourcesArgs, opts ...pulumi.ResourceOption) (*ResourceWithResources, 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 ResourceWithResources
err := ctx.RegisterResource("example:index:ResourceWithResources", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetResourceWithResources gets an existing ResourceWithResources 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 GetResourceWithResources(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ResourceWithResourcesState, opts ...pulumi.ResourceOption) (*ResourceWithResources, error) {
var resource ResourceWithResources
err := ctx.ReadResource("example:index:ResourceWithResources", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ResourceWithResources resources.
type resourceWithResourcesState struct {
}
type ResourceWithResourcesState struct {
}
func (ResourceWithResourcesState) ElementType() reflect.Type {
return reflect.TypeOf((*resourceWithResourcesState)(nil)).Elem()
}
type resourceWithResourcesArgs struct {
Nested *TypeWithResources `pulumi:"nested"`
Source pulumi.Resource `pulumi:"source"`
}
// The set of arguments for constructing a ResourceWithResources resource.
type ResourceWithResourcesArgs struct {
Nested TypeWithResourcesPtrInput
Source pulumi.ResourceInput
}
func (ResourceWithResourcesArgs) ElementType() reflect.Type {
return reflect.TypeOf((*resourceWithResourcesArgs)(nil)).Elem()
}
type ResourceWithResourcesInput interface {
pulumi.Input
ToResourceWithResourcesOutput() ResourceWithResourcesOutput
ToResourceWithResourcesOutputWithContext(ctx context.Context) ResourceWithResourcesOutput
}
func (*ResourceWithResources) ElementType() reflect.Type {
return reflect.TypeOf((**ResourceWithResources)(nil)).Elem()
}
func (i *ResourceWithResources) ToResourceWithResourcesOutput() ResourceWithResourcesOutput {
return i.ToResourceWithResourcesOutputWithContext(context.Background())
}
func (i *ResourceWithResources) ToResourceWithResourcesOutputWithContext(ctx context.Context) ResourceWithResourcesOutput {
return pulumi.ToOutputWithContext(ctx, i).(ResourceWithResourcesOutput)
}
type ResourceWithResourcesOutput struct{ *pulumi.OutputState }
func (ResourceWithResourcesOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ResourceWithResources)(nil)).Elem()
}
func (o ResourceWithResourcesOutput) ToResourceWithResourcesOutput() ResourceWithResourcesOutput {
return o
}
func (o ResourceWithResourcesOutput) ToResourceWithResourcesOutputWithContext(ctx context.Context) ResourceWithResourcesOutput {
return o
}
func (o ResourceWithResourcesOutput) Nested() TypeWithResourcesPtrOutput {
return o.ApplyT(func(v *ResourceWithResources) TypeWithResourcesPtrOutput { return v.Nested }).(TypeWithResourcesPtrOutput)
}
func (o ResourceWithResourcesOutput) OptionalResource() pulumi.ResourceOutput {
return o.ApplyT(func(v *ResourceWithResources) pulumi.ResourceOutput { return v.OptionalResource }).(pulumi.ResourceOutput)
}
func (o ResourceWithResourcesOutput) Resource() pulumi.ResourceOutput {
return o.ApplyT(func(v *ResourceWithResources) pulumi.ResourceOutput { return v.Resource }).(pulumi.ResourceOutput)
}
func (o ResourceWithResourcesOutput) ResourceList() pulumi.ResourceArrayOutput {
return o.ApplyT(func(v *ResourceWithResources) pulumi.ResourceArrayOutput { return v.ResourceList }).(pulumi.ResourceArrayOutput)
}
func (o ResourceWithResourcesOutput) ResourceMap() pulumi.ResourceMapOutput {
return o.ApplyT(func(v *ResourceWithResources) pulumi.ResourceMapOutput { return v.ResourceMap }).(pulumi.ResourceMapOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ResourceWithResourcesInput)(nil)).Elem(), &ResourceWithResources{})
pulumi.RegisterOutputType(ResourceWithResourcesOutput{})
}