pulumi/tests/testdata/codegen/external-resource-schema/go/example/workload.go

206 lines
6.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"
"external-resource-schema/example/internal"
corev1 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/core/v1"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type Workload struct {
pulumi.CustomResourceState
Pod *corev1.PodTypeOutput `pulumi:"pod"`
}
// NewWorkload registers a new resource with the given unique name, arguments, and options.
func NewWorkload(ctx *pulumi.Context,
name string, args *WorkloadArgs, opts ...pulumi.ResourceOption) (*Workload, error) {
if args == nil {
args = &WorkloadArgs{}
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Workload
err := ctx.RegisterResource("example::Workload", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetWorkload gets an existing Workload 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 GetWorkload(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *WorkloadState, opts ...pulumi.ResourceOption) (*Workload, error) {
var resource Workload
err := ctx.ReadResource("example::Workload", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Workload resources.
type workloadState struct {
}
type WorkloadState struct {
}
func (WorkloadState) ElementType() reflect.Type {
return reflect.TypeOf((*workloadState)(nil)).Elem()
}
type workloadArgs struct {
}
// The set of arguments for constructing a Workload resource.
type WorkloadArgs struct {
}
func (WorkloadArgs) ElementType() reflect.Type {
return reflect.TypeOf((*workloadArgs)(nil)).Elem()
}
type WorkloadInput interface {
pulumi.Input
ToWorkloadOutput() WorkloadOutput
ToWorkloadOutputWithContext(ctx context.Context) WorkloadOutput
}
func (*Workload) ElementType() reflect.Type {
return reflect.TypeOf((**Workload)(nil)).Elem()
}
func (i *Workload) ToWorkloadOutput() WorkloadOutput {
return i.ToWorkloadOutputWithContext(context.Background())
}
func (i *Workload) ToWorkloadOutputWithContext(ctx context.Context) WorkloadOutput {
return pulumi.ToOutputWithContext(ctx, i).(WorkloadOutput)
}
// WorkloadArrayInput is an input type that accepts WorkloadArray and WorkloadArrayOutput values.
// You can construct a concrete instance of `WorkloadArrayInput` via:
//
// WorkloadArray{ WorkloadArgs{...} }
type WorkloadArrayInput interface {
pulumi.Input
ToWorkloadArrayOutput() WorkloadArrayOutput
ToWorkloadArrayOutputWithContext(context.Context) WorkloadArrayOutput
}
type WorkloadArray []WorkloadInput
func (WorkloadArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Workload)(nil)).Elem()
}
func (i WorkloadArray) ToWorkloadArrayOutput() WorkloadArrayOutput {
return i.ToWorkloadArrayOutputWithContext(context.Background())
}
func (i WorkloadArray) ToWorkloadArrayOutputWithContext(ctx context.Context) WorkloadArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(WorkloadArrayOutput)
}
// WorkloadMapInput is an input type that accepts WorkloadMap and WorkloadMapOutput values.
// You can construct a concrete instance of `WorkloadMapInput` via:
//
// WorkloadMap{ "key": WorkloadArgs{...} }
type WorkloadMapInput interface {
pulumi.Input
ToWorkloadMapOutput() WorkloadMapOutput
ToWorkloadMapOutputWithContext(context.Context) WorkloadMapOutput
}
type WorkloadMap map[string]WorkloadInput
func (WorkloadMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Workload)(nil)).Elem()
}
func (i WorkloadMap) ToWorkloadMapOutput() WorkloadMapOutput {
return i.ToWorkloadMapOutputWithContext(context.Background())
}
func (i WorkloadMap) ToWorkloadMapOutputWithContext(ctx context.Context) WorkloadMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(WorkloadMapOutput)
}
type WorkloadOutput struct{ *pulumi.OutputState }
func (WorkloadOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Workload)(nil)).Elem()
}
func (o WorkloadOutput) ToWorkloadOutput() WorkloadOutput {
return o
}
func (o WorkloadOutput) ToWorkloadOutputWithContext(ctx context.Context) WorkloadOutput {
return o
}
func (o WorkloadOutput) Pod() *corev1.PodTypeOutput {
return o.ApplyT(func(v *Workload) *corev1.PodTypeOutput { return v.Pod }).(*corev1.PodTypeOutput)
}
type WorkloadArrayOutput struct{ *pulumi.OutputState }
func (WorkloadArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Workload)(nil)).Elem()
}
func (o WorkloadArrayOutput) ToWorkloadArrayOutput() WorkloadArrayOutput {
return o
}
func (o WorkloadArrayOutput) ToWorkloadArrayOutputWithContext(ctx context.Context) WorkloadArrayOutput {
return o
}
func (o WorkloadArrayOutput) Index(i pulumi.IntInput) WorkloadOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Workload {
return vs[0].([]*Workload)[vs[1].(int)]
}).(WorkloadOutput)
}
type WorkloadMapOutput struct{ *pulumi.OutputState }
func (WorkloadMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Workload)(nil)).Elem()
}
func (o WorkloadMapOutput) ToWorkloadMapOutput() WorkloadMapOutput {
return o
}
func (o WorkloadMapOutput) ToWorkloadMapOutputWithContext(ctx context.Context) WorkloadMapOutput {
return o
}
func (o WorkloadMapOutput) MapIndex(k pulumi.StringInput) WorkloadOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Workload {
return vs[0].(map[string]*Workload)[vs[1].(string)]
}).(WorkloadOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*WorkloadInput)(nil)).Elem(), &Workload{})
pulumi.RegisterInputType(reflect.TypeOf((*WorkloadArrayInput)(nil)).Elem(), WorkloadArray{})
pulumi.RegisterInputType(reflect.TypeOf((*WorkloadMapInput)(nil)).Elem(), WorkloadMap{})
pulumi.RegisterOutputType(WorkloadOutput{})
pulumi.RegisterOutputType(WorkloadArrayOutput{})
pulumi.RegisterOutputType(WorkloadMapOutput{})
}