pulumi/tests/testdata/codegen/external-go-import-aliases/go/example/component.go

288 lines
11 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"
"external-go-import-aliases/example/internal"
awsec2 "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/s3"
accesscontextmanager "github.com/pulumi/pulumi-google-native/sdk/go/google/accesscontextmanager/v1"
dns "github.com/pulumi/pulumi-google-native/sdk/go/google/dns/v1"
gcpiamv1 "github.com/pulumi/pulumi-google-native/sdk/go/google/iam/v1"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type Component struct {
pulumi.CustomResourceState
ResourceLocalAlias awsec2.InstanceOutput `pulumi:"resourceLocalAlias"`
ResourceLocalInsteadOfRemoteAlias gcpiamv1.KeyOutput `pulumi:"resourceLocalInsteadOfRemoteAlias"`
ResourceNoAlias s3.BucketOutput `pulumi:"resourceNoAlias"`
ResourceRemoteAlias dns.PolicyOutput `pulumi:"resourceRemoteAlias"`
TypeLocalAlias awsec2.InstanceLaunchTemplateOutput `pulumi:"typeLocalAlias"`
TypeLocalInsteadOfRemoteAlias gcpiamv1.AuditConfigResponseOutput `pulumi:"typeLocalInsteadOfRemoteAlias"`
TypeNoAlias s3.BucketWebsiteOutput `pulumi:"typeNoAlias"`
TypeRemoteAlias dns.DnsKeySpecResponseOutput `pulumi:"typeRemoteAlias"`
}
// NewComponent registers a new resource with the given unique name, arguments, and options.
func NewComponent(ctx *pulumi.Context,
name string, args *ComponentArgs, opts ...pulumi.ResourceOption) (*Component, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ResourceLocalAlias == nil {
return nil, errors.New("invalid value for required argument 'ResourceLocalAlias'")
}
if args.ResourceLocalInsteadOfRemoteAlias == nil {
return nil, errors.New("invalid value for required argument 'ResourceLocalInsteadOfRemoteAlias'")
}
if args.ResourceNoAlias == nil {
return nil, errors.New("invalid value for required argument 'ResourceNoAlias'")
}
if args.ResourceRemoteAlias == nil {
return nil, errors.New("invalid value for required argument 'ResourceRemoteAlias'")
}
if args.TypeLocalAlias == nil {
return nil, errors.New("invalid value for required argument 'TypeLocalAlias'")
}
if args.TypeLocalInsteadOfRemoteAlias == nil {
return nil, errors.New("invalid value for required argument 'TypeLocalInsteadOfRemoteAlias'")
}
if args.TypeNoAlias == nil {
return nil, errors.New("invalid value for required argument 'TypeNoAlias'")
}
if args.TypeRemoteAlias == nil {
return nil, errors.New("invalid value for required argument 'TypeRemoteAlias'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Component
err := ctx.RegisterResource("example::Component", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetComponent gets an existing Component 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 GetComponent(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ComponentState, opts ...pulumi.ResourceOption) (*Component, error) {
var resource Component
err := ctx.ReadResource("example::Component", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Component resources.
type componentState struct {
}
type ComponentState struct {
}
func (ComponentState) ElementType() reflect.Type {
return reflect.TypeOf((*componentState)(nil)).Elem()
}
type componentArgs struct {
ResourceLocalAlias *awsec2.Instance `pulumi:"resourceLocalAlias"`
ResourceLocalInsteadOfRemoteAlias *gcpiamv1.Key `pulumi:"resourceLocalInsteadOfRemoteAlias"`
ResourceNoAlias *s3.Bucket `pulumi:"resourceNoAlias"`
ResourceRemoteAlias *dns.Policy `pulumi:"resourceRemoteAlias"`
TypeLocalAlias awsec2.InstanceLaunchTemplate `pulumi:"typeLocalAlias"`
TypeLocalInsteadOfRemoteAlias gcpiamv1.AuditConfig `pulumi:"typeLocalInsteadOfRemoteAlias"`
TypeNoAlias s3.BucketWebsite `pulumi:"typeNoAlias"`
TypeRemoteAlias dns.DnsKeySpec `pulumi:"typeRemoteAlias"`
TypeRemoteEnum *accesscontextmanager.DevicePolicyAllowedDeviceManagementLevelsItem `pulumi:"typeRemoteEnum"`
}
// The set of arguments for constructing a Component resource.
type ComponentArgs struct {
ResourceLocalAlias awsec2.InstanceInput
ResourceLocalInsteadOfRemoteAlias gcpiamv1.KeyInput
ResourceNoAlias s3.BucketInput
ResourceRemoteAlias dns.PolicyInput
TypeLocalAlias awsec2.InstanceLaunchTemplateInput
TypeLocalInsteadOfRemoteAlias gcpiamv1.AuditConfigInput
TypeNoAlias s3.BucketWebsiteInput
TypeRemoteAlias dns.DnsKeySpecInput
TypeRemoteEnum accesscontextmanager.DevicePolicyAllowedDeviceManagementLevelsItemPtrInput
}
func (ComponentArgs) ElementType() reflect.Type {
return reflect.TypeOf((*componentArgs)(nil)).Elem()
}
type ComponentInput interface {
pulumi.Input
ToComponentOutput() ComponentOutput
ToComponentOutputWithContext(ctx context.Context) ComponentOutput
}
func (*Component) ElementType() reflect.Type {
return reflect.TypeOf((**Component)(nil)).Elem()
}
func (i *Component) ToComponentOutput() ComponentOutput {
return i.ToComponentOutputWithContext(context.Background())
}
func (i *Component) ToComponentOutputWithContext(ctx context.Context) ComponentOutput {
return pulumi.ToOutputWithContext(ctx, i).(ComponentOutput)
}
// ComponentArrayInput is an input type that accepts ComponentArray and ComponentArrayOutput values.
// You can construct a concrete instance of `ComponentArrayInput` via:
//
// ComponentArray{ ComponentArgs{...} }
type ComponentArrayInput interface {
pulumi.Input
ToComponentArrayOutput() ComponentArrayOutput
ToComponentArrayOutputWithContext(context.Context) ComponentArrayOutput
}
type ComponentArray []ComponentInput
func (ComponentArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Component)(nil)).Elem()
}
func (i ComponentArray) ToComponentArrayOutput() ComponentArrayOutput {
return i.ToComponentArrayOutputWithContext(context.Background())
}
func (i ComponentArray) ToComponentArrayOutputWithContext(ctx context.Context) ComponentArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ComponentArrayOutput)
}
// ComponentMapInput is an input type that accepts ComponentMap and ComponentMapOutput values.
// You can construct a concrete instance of `ComponentMapInput` via:
//
// ComponentMap{ "key": ComponentArgs{...} }
type ComponentMapInput interface {
pulumi.Input
ToComponentMapOutput() ComponentMapOutput
ToComponentMapOutputWithContext(context.Context) ComponentMapOutput
}
type ComponentMap map[string]ComponentInput
func (ComponentMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Component)(nil)).Elem()
}
func (i ComponentMap) ToComponentMapOutput() ComponentMapOutput {
return i.ToComponentMapOutputWithContext(context.Background())
}
func (i ComponentMap) ToComponentMapOutputWithContext(ctx context.Context) ComponentMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ComponentMapOutput)
}
type ComponentOutput struct{ *pulumi.OutputState }
func (ComponentOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Component)(nil)).Elem()
}
func (o ComponentOutput) ToComponentOutput() ComponentOutput {
return o
}
func (o ComponentOutput) ToComponentOutputWithContext(ctx context.Context) ComponentOutput {
return o
}
func (o ComponentOutput) ResourceLocalAlias() awsec2.InstanceOutput {
return o.ApplyT(func(v *Component) awsec2.InstanceOutput { return v.ResourceLocalAlias }).(awsec2.InstanceOutput)
}
func (o ComponentOutput) ResourceLocalInsteadOfRemoteAlias() gcpiamv1.KeyOutput {
return o.ApplyT(func(v *Component) gcpiamv1.KeyOutput { return v.ResourceLocalInsteadOfRemoteAlias }).(gcpiamv1.KeyOutput)
}
func (o ComponentOutput) ResourceNoAlias() s3.BucketOutput {
return o.ApplyT(func(v *Component) s3.BucketOutput { return v.ResourceNoAlias }).(s3.BucketOutput)
}
func (o ComponentOutput) ResourceRemoteAlias() dns.PolicyOutput {
return o.ApplyT(func(v *Component) dns.PolicyOutput { return v.ResourceRemoteAlias }).(dns.PolicyOutput)
}
func (o ComponentOutput) TypeLocalAlias() awsec2.InstanceLaunchTemplateOutput {
return o.ApplyT(func(v *Component) awsec2.InstanceLaunchTemplateOutput { return v.TypeLocalAlias }).(awsec2.InstanceLaunchTemplateOutput)
}
func (o ComponentOutput) TypeLocalInsteadOfRemoteAlias() gcpiamv1.AuditConfigResponseOutput {
return o.ApplyT(func(v *Component) gcpiamv1.AuditConfigResponseOutput { return v.TypeLocalInsteadOfRemoteAlias }).(gcpiamv1.AuditConfigResponseOutput)
}
func (o ComponentOutput) TypeNoAlias() s3.BucketWebsiteOutput {
return o.ApplyT(func(v *Component) s3.BucketWebsiteOutput { return v.TypeNoAlias }).(s3.BucketWebsiteOutput)
}
func (o ComponentOutput) TypeRemoteAlias() dns.DnsKeySpecResponseOutput {
return o.ApplyT(func(v *Component) dns.DnsKeySpecResponseOutput { return v.TypeRemoteAlias }).(dns.DnsKeySpecResponseOutput)
}
type ComponentArrayOutput struct{ *pulumi.OutputState }
func (ComponentArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Component)(nil)).Elem()
}
func (o ComponentArrayOutput) ToComponentArrayOutput() ComponentArrayOutput {
return o
}
func (o ComponentArrayOutput) ToComponentArrayOutputWithContext(ctx context.Context) ComponentArrayOutput {
return o
}
func (o ComponentArrayOutput) Index(i pulumi.IntInput) ComponentOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Component {
return vs[0].([]*Component)[vs[1].(int)]
}).(ComponentOutput)
}
type ComponentMapOutput struct{ *pulumi.OutputState }
func (ComponentMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Component)(nil)).Elem()
}
func (o ComponentMapOutput) ToComponentMapOutput() ComponentMapOutput {
return o
}
func (o ComponentMapOutput) ToComponentMapOutputWithContext(ctx context.Context) ComponentMapOutput {
return o
}
func (o ComponentMapOutput) MapIndex(k pulumi.StringInput) ComponentOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Component {
return vs[0].(map[string]*Component)[vs[1].(string)]
}).(ComponentOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ComponentInput)(nil)).Elem(), &Component{})
pulumi.RegisterInputType(reflect.TypeOf((*ComponentArrayInput)(nil)).Elem(), ComponentArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ComponentMapInput)(nil)).Elem(), ComponentMap{})
pulumi.RegisterOutputType(ComponentOutput{})
pulumi.RegisterOutputType(ComponentArrayOutput{})
pulumi.RegisterOutputType(ComponentMapOutput{})
}