pulumi/tests/testdata/codegen/plain-object-defaults/go/example/moduleTest.go

116 lines
3.2 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"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"plain-object-defaults/example/internal"
"plain-object-defaults/example/mod1"
)
type ModuleTest struct {
pulumi.CustomResourceState
}
// NewModuleTest registers a new resource with the given unique name, arguments, and options.
func NewModuleTest(ctx *pulumi.Context,
name string, args *ModuleTestArgs, opts ...pulumi.ResourceOption) (*ModuleTest, error) {
if args == nil {
args = &ModuleTestArgs{}
}
if args.Mod1 != nil {
args.Mod1 = args.Mod1.ToTypPtrOutput().ApplyT(func(v *mod1.Typ) *mod1.Typ { return v.Defaults() }).(mod1.TypPtrOutput)
}
if args.Val != nil {
args.Val = args.Val.ToTypPtrOutput().ApplyT(func(v *Typ) *Typ { return v.Defaults() }).(TypPtrOutput)
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource ModuleTest
err := ctx.RegisterResource("example:index:moduleTest", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetModuleTest gets an existing ModuleTest 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 GetModuleTest(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ModuleTestState, opts ...pulumi.ResourceOption) (*ModuleTest, error) {
var resource ModuleTest
err := ctx.ReadResource("example:index:moduleTest", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ModuleTest resources.
type moduleTestState struct {
}
type ModuleTestState struct {
}
func (ModuleTestState) ElementType() reflect.Type {
return reflect.TypeOf((*moduleTestState)(nil)).Elem()
}
type moduleTestArgs struct {
Mod1 *mod1.Typ `pulumi:"mod1"`
Val *Typ `pulumi:"val"`
}
// The set of arguments for constructing a ModuleTest resource.
type ModuleTestArgs struct {
Mod1 mod1.TypPtrInput
Val TypPtrInput
}
func (ModuleTestArgs) ElementType() reflect.Type {
return reflect.TypeOf((*moduleTestArgs)(nil)).Elem()
}
type ModuleTestInput interface {
pulumi.Input
ToModuleTestOutput() ModuleTestOutput
ToModuleTestOutputWithContext(ctx context.Context) ModuleTestOutput
}
func (*ModuleTest) ElementType() reflect.Type {
return reflect.TypeOf((**ModuleTest)(nil)).Elem()
}
func (i *ModuleTest) ToModuleTestOutput() ModuleTestOutput {
return i.ToModuleTestOutputWithContext(context.Background())
}
func (i *ModuleTest) ToModuleTestOutputWithContext(ctx context.Context) ModuleTestOutput {
return pulumi.ToOutputWithContext(ctx, i).(ModuleTestOutput)
}
type ModuleTestOutput struct{ *pulumi.OutputState }
func (ModuleTestOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ModuleTest)(nil)).Elem()
}
func (o ModuleTestOutput) ToModuleTestOutput() ModuleTestOutput {
return o
}
func (o ModuleTestOutput) ToModuleTestOutputWithContext(ctx context.Context) ModuleTestOutput {
return o
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ModuleTestInput)(nil)).Elem(), &ModuleTest{})
pulumi.RegisterOutputType(ModuleTestOutput{})
}