pulumi/tests/testdata/codegen/different-enum/go/plant/pulumiEnums.go

542 lines
18 KiB
Go
Raw Normal View History

// Code generated by test DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package plant
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// The log_name to populate in the Cloud Audit Record. This is added to regress pulumi/pulumi issue #7913
type CloudAuditOptionsLogName string
const (
// Default. Should not be used.
CloudAuditOptionsLogNameUnspecifiedLogName = CloudAuditOptionsLogName("UNSPECIFIED_LOG_NAME")
// Corresponds to "cloudaudit.googleapis.com/activity"
CloudAuditOptionsLogNameAdminActivity = CloudAuditOptionsLogName("ADMIN_ACTIVITY")
// Corresponds to "cloudaudit.googleapis.com/data_access"
CloudAuditOptionsLogNameDataAccess = CloudAuditOptionsLogName("DATA_ACCESS")
// What if triple quotes """ are used in the description
CloudAuditOptionsLogNameSynthetic = CloudAuditOptionsLogName("SYNTHETIC")
)
type ContainerBrightness float64
const (
ContainerBrightnessZeroPointOne = ContainerBrightness(0.1)
ContainerBrightnessOne = ContainerBrightness(1)
)
func (ContainerBrightness) ElementType() reflect.Type {
return reflect.TypeOf((*ContainerBrightness)(nil)).Elem()
}
func (e ContainerBrightness) ToContainerBrightnessOutput() ContainerBrightnessOutput {
return pulumi.ToOutput(e).(ContainerBrightnessOutput)
}
func (e ContainerBrightness) ToContainerBrightnessOutputWithContext(ctx context.Context) ContainerBrightnessOutput {
return pulumi.ToOutputWithContext(ctx, e).(ContainerBrightnessOutput)
}
func (e ContainerBrightness) ToContainerBrightnessPtrOutput() ContainerBrightnessPtrOutput {
return e.ToContainerBrightnessPtrOutputWithContext(context.Background())
}
func (e ContainerBrightness) ToContainerBrightnessPtrOutputWithContext(ctx context.Context) ContainerBrightnessPtrOutput {
return ContainerBrightness(e).ToContainerBrightnessOutputWithContext(ctx).ToContainerBrightnessPtrOutputWithContext(ctx)
}
func (e ContainerBrightness) ToFloat64Output() pulumi.Float64Output {
return pulumi.ToOutput(pulumi.Float64(e)).(pulumi.Float64Output)
}
func (e ContainerBrightness) ToFloat64OutputWithContext(ctx context.Context) pulumi.Float64Output {
return pulumi.ToOutputWithContext(ctx, pulumi.Float64(e)).(pulumi.Float64Output)
}
func (e ContainerBrightness) ToFloat64PtrOutput() pulumi.Float64PtrOutput {
return pulumi.Float64(e).ToFloat64PtrOutputWithContext(context.Background())
}
func (e ContainerBrightness) ToFloat64PtrOutputWithContext(ctx context.Context) pulumi.Float64PtrOutput {
return pulumi.Float64(e).ToFloat64OutputWithContext(ctx).ToFloat64PtrOutputWithContext(ctx)
}
type ContainerBrightnessOutput struct{ *pulumi.OutputState }
func (ContainerBrightnessOutput) ElementType() reflect.Type {
return reflect.TypeOf((*ContainerBrightness)(nil)).Elem()
}
func (o ContainerBrightnessOutput) ToContainerBrightnessOutput() ContainerBrightnessOutput {
return o
}
func (o ContainerBrightnessOutput) ToContainerBrightnessOutputWithContext(ctx context.Context) ContainerBrightnessOutput {
return o
}
func (o ContainerBrightnessOutput) ToContainerBrightnessPtrOutput() ContainerBrightnessPtrOutput {
return o.ToContainerBrightnessPtrOutputWithContext(context.Background())
}
func (o ContainerBrightnessOutput) ToContainerBrightnessPtrOutputWithContext(ctx context.Context) ContainerBrightnessPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v ContainerBrightness) *ContainerBrightness {
return &v
}).(ContainerBrightnessPtrOutput)
}
func (o ContainerBrightnessOutput) ToFloat64Output() pulumi.Float64Output {
return o.ToFloat64OutputWithContext(context.Background())
}
func (o ContainerBrightnessOutput) ToFloat64OutputWithContext(ctx context.Context) pulumi.Float64Output {
return o.ApplyTWithContext(ctx, func(_ context.Context, e ContainerBrightness) float64 {
return float64(e)
}).(pulumi.Float64Output)
}
func (o ContainerBrightnessOutput) ToFloat64PtrOutput() pulumi.Float64PtrOutput {
return o.ToFloat64PtrOutputWithContext(context.Background())
}
func (o ContainerBrightnessOutput) ToFloat64PtrOutputWithContext(ctx context.Context) pulumi.Float64PtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, e ContainerBrightness) *float64 {
v := float64(e)
return &v
}).(pulumi.Float64PtrOutput)
}
type ContainerBrightnessPtrOutput struct{ *pulumi.OutputState }
func (ContainerBrightnessPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ContainerBrightness)(nil)).Elem()
}
func (o ContainerBrightnessPtrOutput) ToContainerBrightnessPtrOutput() ContainerBrightnessPtrOutput {
return o
}
func (o ContainerBrightnessPtrOutput) ToContainerBrightnessPtrOutputWithContext(ctx context.Context) ContainerBrightnessPtrOutput {
return o
}
func (o ContainerBrightnessPtrOutput) Elem() ContainerBrightnessOutput {
return o.ApplyT(func(v *ContainerBrightness) ContainerBrightness {
if v != nil {
return *v
}
var ret ContainerBrightness
return ret
}).(ContainerBrightnessOutput)
}
func (o ContainerBrightnessPtrOutput) ToFloat64PtrOutput() pulumi.Float64PtrOutput {
return o.ToFloat64PtrOutputWithContext(context.Background())
}
func (o ContainerBrightnessPtrOutput) ToFloat64PtrOutputWithContext(ctx context.Context) pulumi.Float64PtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, e *ContainerBrightness) *float64 {
if e == nil {
return nil
}
v := float64(*e)
return &v
}).(pulumi.Float64PtrOutput)
}
// ContainerBrightnessInput is an input type that accepts values of the ContainerBrightness enum
// A concrete instance of `ContainerBrightnessInput` can be one of the following:
//
// ContainerBrightnessZeroPointOne
// ContainerBrightnessOne
type ContainerBrightnessInput interface {
pulumi.Input
ToContainerBrightnessOutput() ContainerBrightnessOutput
ToContainerBrightnessOutputWithContext(context.Context) ContainerBrightnessOutput
}
var containerBrightnessPtrType = reflect.TypeOf((**ContainerBrightness)(nil)).Elem()
type ContainerBrightnessPtrInput interface {
pulumi.Input
ToContainerBrightnessPtrOutput() ContainerBrightnessPtrOutput
ToContainerBrightnessPtrOutputWithContext(context.Context) ContainerBrightnessPtrOutput
}
type containerBrightnessPtr float64
func ContainerBrightnessPtr(v float64) ContainerBrightnessPtrInput {
return (*containerBrightnessPtr)(&v)
}
func (*containerBrightnessPtr) ElementType() reflect.Type {
return containerBrightnessPtrType
}
func (in *containerBrightnessPtr) ToContainerBrightnessPtrOutput() ContainerBrightnessPtrOutput {
return pulumi.ToOutput(in).(ContainerBrightnessPtrOutput)
}
func (in *containerBrightnessPtr) ToContainerBrightnessPtrOutputWithContext(ctx context.Context) ContainerBrightnessPtrOutput {
return pulumi.ToOutputWithContext(ctx, in).(ContainerBrightnessPtrOutput)
}
// plant container colors
type ContainerColor string
const (
ContainerColorRed = ContainerColor("red")
ContainerColorBlue = ContainerColor("blue")
ContainerColorYellow = ContainerColor("yellow")
)
[sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions (#14679) # Description When using types in union cases (using `oneOf` in the schema) then Go SDK-gen doesn't detect these types as being used as inputs and only emits the plain version of a type. That is unless `generateExtraInputTypes: true` is specified in which case Go SDK-gen will emit the non-plain types as well. In the case of azure-native modules, `generateExtraInputTypes` is currently set to `false` (default) as of latest v2.19.0 and is missing a few non-plain type variants (for example `FirewallPolicyFilterRuleCollection` from [this file](https://raw.githubusercontent.com/pulumi/pulumi-azure-native-sdk/master/network/pulumiTypes.go)). There no single plain type in azure-native and yet it is missing these non-plain variants. This PR fixes that by also traversing the element types of schema union definitions when determining plain-ness of types and how they are used. I added an example schema with an array of unions (common case in azure-native) and confirmed that the change actually results in the non-plain types being generated when `generateExtraInputTypes` is set to `false` Fixes https://github.com/pulumi/pulumi-azure-native/issues/1922 ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2023-11-29 12:37:53 +00:00
func (ContainerColor) ElementType() reflect.Type {
return reflect.TypeOf((*ContainerColor)(nil)).Elem()
}
func (e ContainerColor) ToContainerColorOutput() ContainerColorOutput {
return pulumi.ToOutput(e).(ContainerColorOutput)
}
func (e ContainerColor) ToContainerColorOutputWithContext(ctx context.Context) ContainerColorOutput {
return pulumi.ToOutputWithContext(ctx, e).(ContainerColorOutput)
}
func (e ContainerColor) ToContainerColorPtrOutput() ContainerColorPtrOutput {
return e.ToContainerColorPtrOutputWithContext(context.Background())
}
func (e ContainerColor) ToContainerColorPtrOutputWithContext(ctx context.Context) ContainerColorPtrOutput {
return ContainerColor(e).ToContainerColorOutputWithContext(ctx).ToContainerColorPtrOutputWithContext(ctx)
}
func (e ContainerColor) ToStringOutput() pulumi.StringOutput {
return pulumi.ToOutput(pulumi.String(e)).(pulumi.StringOutput)
}
func (e ContainerColor) ToStringOutputWithContext(ctx context.Context) pulumi.StringOutput {
return pulumi.ToOutputWithContext(ctx, pulumi.String(e)).(pulumi.StringOutput)
}
func (e ContainerColor) ToStringPtrOutput() pulumi.StringPtrOutput {
return pulumi.String(e).ToStringPtrOutputWithContext(context.Background())
}
func (e ContainerColor) ToStringPtrOutputWithContext(ctx context.Context) pulumi.StringPtrOutput {
return pulumi.String(e).ToStringOutputWithContext(ctx).ToStringPtrOutputWithContext(ctx)
}
type ContainerColorOutput struct{ *pulumi.OutputState }
func (ContainerColorOutput) ElementType() reflect.Type {
return reflect.TypeOf((*ContainerColor)(nil)).Elem()
}
func (o ContainerColorOutput) ToContainerColorOutput() ContainerColorOutput {
return o
}
func (o ContainerColorOutput) ToContainerColorOutputWithContext(ctx context.Context) ContainerColorOutput {
return o
}
func (o ContainerColorOutput) ToContainerColorPtrOutput() ContainerColorPtrOutput {
return o.ToContainerColorPtrOutputWithContext(context.Background())
}
func (o ContainerColorOutput) ToContainerColorPtrOutputWithContext(ctx context.Context) ContainerColorPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v ContainerColor) *ContainerColor {
return &v
}).(ContainerColorPtrOutput)
}
func (o ContainerColorOutput) ToStringOutput() pulumi.StringOutput {
return o.ToStringOutputWithContext(context.Background())
}
func (o ContainerColorOutput) ToStringOutputWithContext(ctx context.Context) pulumi.StringOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, e ContainerColor) string {
return string(e)
}).(pulumi.StringOutput)
}
func (o ContainerColorOutput) ToStringPtrOutput() pulumi.StringPtrOutput {
return o.ToStringPtrOutputWithContext(context.Background())
}
func (o ContainerColorOutput) ToStringPtrOutputWithContext(ctx context.Context) pulumi.StringPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, e ContainerColor) *string {
v := string(e)
return &v
}).(pulumi.StringPtrOutput)
}
type ContainerColorPtrOutput struct{ *pulumi.OutputState }
func (ContainerColorPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ContainerColor)(nil)).Elem()
}
func (o ContainerColorPtrOutput) ToContainerColorPtrOutput() ContainerColorPtrOutput {
return o
}
func (o ContainerColorPtrOutput) ToContainerColorPtrOutputWithContext(ctx context.Context) ContainerColorPtrOutput {
return o
}
func (o ContainerColorPtrOutput) Elem() ContainerColorOutput {
return o.ApplyT(func(v *ContainerColor) ContainerColor {
if v != nil {
return *v
}
var ret ContainerColor
return ret
}).(ContainerColorOutput)
}
func (o ContainerColorPtrOutput) ToStringPtrOutput() pulumi.StringPtrOutput {
return o.ToStringPtrOutputWithContext(context.Background())
}
func (o ContainerColorPtrOutput) ToStringPtrOutputWithContext(ctx context.Context) pulumi.StringPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, e *ContainerColor) *string {
if e == nil {
return nil
}
v := string(*e)
return &v
}).(pulumi.StringPtrOutput)
}
// ContainerColorInput is an input type that accepts values of the ContainerColor enum
// A concrete instance of `ContainerColorInput` can be one of the following:
[sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions (#14679) # Description When using types in union cases (using `oneOf` in the schema) then Go SDK-gen doesn't detect these types as being used as inputs and only emits the plain version of a type. That is unless `generateExtraInputTypes: true` is specified in which case Go SDK-gen will emit the non-plain types as well. In the case of azure-native modules, `generateExtraInputTypes` is currently set to `false` (default) as of latest v2.19.0 and is missing a few non-plain type variants (for example `FirewallPolicyFilterRuleCollection` from [this file](https://raw.githubusercontent.com/pulumi/pulumi-azure-native-sdk/master/network/pulumiTypes.go)). There no single plain type in azure-native and yet it is missing these non-plain variants. This PR fixes that by also traversing the element types of schema union definitions when determining plain-ness of types and how they are used. I added an example schema with an array of unions (common case in azure-native) and confirmed that the change actually results in the non-plain types being generated when `generateExtraInputTypes` is set to `false` Fixes https://github.com/pulumi/pulumi-azure-native/issues/1922 ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2023-11-29 12:37:53 +00:00
//
// ContainerColorRed
// ContainerColorBlue
// ContainerColorYellow
[sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions (#14679) # Description When using types in union cases (using `oneOf` in the schema) then Go SDK-gen doesn't detect these types as being used as inputs and only emits the plain version of a type. That is unless `generateExtraInputTypes: true` is specified in which case Go SDK-gen will emit the non-plain types as well. In the case of azure-native modules, `generateExtraInputTypes` is currently set to `false` (default) as of latest v2.19.0 and is missing a few non-plain type variants (for example `FirewallPolicyFilterRuleCollection` from [this file](https://raw.githubusercontent.com/pulumi/pulumi-azure-native-sdk/master/network/pulumiTypes.go)). There no single plain type in azure-native and yet it is missing these non-plain variants. This PR fixes that by also traversing the element types of schema union definitions when determining plain-ness of types and how they are used. I added an example schema with an array of unions (common case in azure-native) and confirmed that the change actually results in the non-plain types being generated when `generateExtraInputTypes` is set to `false` Fixes https://github.com/pulumi/pulumi-azure-native/issues/1922 ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2023-11-29 12:37:53 +00:00
type ContainerColorInput interface {
pulumi.Input
ToContainerColorOutput() ContainerColorOutput
ToContainerColorOutputWithContext(context.Context) ContainerColorOutput
}
var containerColorPtrType = reflect.TypeOf((**ContainerColor)(nil)).Elem()
type ContainerColorPtrInput interface {
pulumi.Input
ToContainerColorPtrOutput() ContainerColorPtrOutput
ToContainerColorPtrOutputWithContext(context.Context) ContainerColorPtrOutput
}
type containerColorPtr string
func ContainerColorPtr(v string) ContainerColorPtrInput {
return (*containerColorPtr)(&v)
}
func (*containerColorPtr) ElementType() reflect.Type {
return containerColorPtrType
}
func (in *containerColorPtr) ToContainerColorPtrOutput() ContainerColorPtrOutput {
return pulumi.ToOutput(in).(ContainerColorPtrOutput)
}
func (in *containerColorPtr) ToContainerColorPtrOutputWithContext(ctx context.Context) ContainerColorPtrOutput {
return pulumi.ToOutputWithContext(ctx, in).(ContainerColorPtrOutput)
}
// plant container sizes
type ContainerSize int
const (
ContainerSizeFourInch = ContainerSize(4)
ContainerSizeSixInch = ContainerSize(6)
// Deprecated: Eight inch pots are no longer supported.
ContainerSizeEightInch = ContainerSize(8)
)
func (ContainerSize) ElementType() reflect.Type {
return reflect.TypeOf((*ContainerSize)(nil)).Elem()
}
func (e ContainerSize) ToContainerSizeOutput() ContainerSizeOutput {
return pulumi.ToOutput(e).(ContainerSizeOutput)
}
func (e ContainerSize) ToContainerSizeOutputWithContext(ctx context.Context) ContainerSizeOutput {
return pulumi.ToOutputWithContext(ctx, e).(ContainerSizeOutput)
}
func (e ContainerSize) ToContainerSizePtrOutput() ContainerSizePtrOutput {
return e.ToContainerSizePtrOutputWithContext(context.Background())
}
func (e ContainerSize) ToContainerSizePtrOutputWithContext(ctx context.Context) ContainerSizePtrOutput {
return ContainerSize(e).ToContainerSizeOutputWithContext(ctx).ToContainerSizePtrOutputWithContext(ctx)
}
func (e ContainerSize) ToIntOutput() pulumi.IntOutput {
return pulumi.ToOutput(pulumi.Int(e)).(pulumi.IntOutput)
}
func (e ContainerSize) ToIntOutputWithContext(ctx context.Context) pulumi.IntOutput {
return pulumi.ToOutputWithContext(ctx, pulumi.Int(e)).(pulumi.IntOutput)
}
func (e ContainerSize) ToIntPtrOutput() pulumi.IntPtrOutput {
return pulumi.Int(e).ToIntPtrOutputWithContext(context.Background())
}
func (e ContainerSize) ToIntPtrOutputWithContext(ctx context.Context) pulumi.IntPtrOutput {
return pulumi.Int(e).ToIntOutputWithContext(ctx).ToIntPtrOutputWithContext(ctx)
}
type ContainerSizeOutput struct{ *pulumi.OutputState }
func (ContainerSizeOutput) ElementType() reflect.Type {
return reflect.TypeOf((*ContainerSize)(nil)).Elem()
}
func (o ContainerSizeOutput) ToContainerSizeOutput() ContainerSizeOutput {
return o
}
func (o ContainerSizeOutput) ToContainerSizeOutputWithContext(ctx context.Context) ContainerSizeOutput {
return o
}
func (o ContainerSizeOutput) ToContainerSizePtrOutput() ContainerSizePtrOutput {
return o.ToContainerSizePtrOutputWithContext(context.Background())
}
func (o ContainerSizeOutput) ToContainerSizePtrOutputWithContext(ctx context.Context) ContainerSizePtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v ContainerSize) *ContainerSize {
return &v
}).(ContainerSizePtrOutput)
}
func (o ContainerSizeOutput) ToIntOutput() pulumi.IntOutput {
return o.ToIntOutputWithContext(context.Background())
}
func (o ContainerSizeOutput) ToIntOutputWithContext(ctx context.Context) pulumi.IntOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, e ContainerSize) int {
return int(e)
}).(pulumi.IntOutput)
}
func (o ContainerSizeOutput) ToIntPtrOutput() pulumi.IntPtrOutput {
return o.ToIntPtrOutputWithContext(context.Background())
}
func (o ContainerSizeOutput) ToIntPtrOutputWithContext(ctx context.Context) pulumi.IntPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, e ContainerSize) *int {
v := int(e)
return &v
}).(pulumi.IntPtrOutput)
}
type ContainerSizePtrOutput struct{ *pulumi.OutputState }
func (ContainerSizePtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ContainerSize)(nil)).Elem()
}
func (o ContainerSizePtrOutput) ToContainerSizePtrOutput() ContainerSizePtrOutput {
return o
}
func (o ContainerSizePtrOutput) ToContainerSizePtrOutputWithContext(ctx context.Context) ContainerSizePtrOutput {
return o
}
func (o ContainerSizePtrOutput) Elem() ContainerSizeOutput {
return o.ApplyT(func(v *ContainerSize) ContainerSize {
if v != nil {
return *v
}
var ret ContainerSize
return ret
}).(ContainerSizeOutput)
}
func (o ContainerSizePtrOutput) ToIntPtrOutput() pulumi.IntPtrOutput {
return o.ToIntPtrOutputWithContext(context.Background())
}
func (o ContainerSizePtrOutput) ToIntPtrOutputWithContext(ctx context.Context) pulumi.IntPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, e *ContainerSize) *int {
if e == nil {
return nil
}
v := int(*e)
return &v
}).(pulumi.IntPtrOutput)
}
// ContainerSizeInput is an input type that accepts values of the ContainerSize enum
// A concrete instance of `ContainerSizeInput` can be one of the following:
//
// ContainerSizeFourInch
// ContainerSizeSixInch
type ContainerSizeInput interface {
pulumi.Input
ToContainerSizeOutput() ContainerSizeOutput
ToContainerSizeOutputWithContext(context.Context) ContainerSizeOutput
}
var containerSizePtrType = reflect.TypeOf((**ContainerSize)(nil)).Elem()
type ContainerSizePtrInput interface {
pulumi.Input
ToContainerSizePtrOutput() ContainerSizePtrOutput
ToContainerSizePtrOutputWithContext(context.Context) ContainerSizePtrOutput
}
type containerSizePtr int
func ContainerSizePtr(v int) ContainerSizePtrInput {
return (*containerSizePtr)(&v)
}
func (*containerSizePtr) ElementType() reflect.Type {
return containerSizePtrType
}
func (in *containerSizePtr) ToContainerSizePtrOutput() ContainerSizePtrOutput {
return pulumi.ToOutput(in).(ContainerSizePtrOutput)
}
func (in *containerSizePtr) ToContainerSizePtrOutputWithContext(ctx context.Context) ContainerSizePtrOutput {
return pulumi.ToOutputWithContext(ctx, in).(ContainerSizePtrOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ContainerBrightnessInput)(nil)).Elem(), ContainerBrightness(0.1))
pulumi.RegisterInputType(reflect.TypeOf((*ContainerBrightnessPtrInput)(nil)).Elem(), ContainerBrightness(0.1))
[sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions (#14679) # Description When using types in union cases (using `oneOf` in the schema) then Go SDK-gen doesn't detect these types as being used as inputs and only emits the plain version of a type. That is unless `generateExtraInputTypes: true` is specified in which case Go SDK-gen will emit the non-plain types as well. In the case of azure-native modules, `generateExtraInputTypes` is currently set to `false` (default) as of latest v2.19.0 and is missing a few non-plain type variants (for example `FirewallPolicyFilterRuleCollection` from [this file](https://raw.githubusercontent.com/pulumi/pulumi-azure-native-sdk/master/network/pulumiTypes.go)). There no single plain type in azure-native and yet it is missing these non-plain variants. This PR fixes that by also traversing the element types of schema union definitions when determining plain-ness of types and how they are used. I added an example schema with an array of unions (common case in azure-native) and confirmed that the change actually results in the non-plain types being generated when `generateExtraInputTypes` is set to `false` Fixes https://github.com/pulumi/pulumi-azure-native/issues/1922 ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2023-11-29 12:37:53 +00:00
pulumi.RegisterInputType(reflect.TypeOf((*ContainerColorInput)(nil)).Elem(), ContainerColor("red"))
pulumi.RegisterInputType(reflect.TypeOf((*ContainerColorPtrInput)(nil)).Elem(), ContainerColor("red"))
pulumi.RegisterInputType(reflect.TypeOf((*ContainerSizeInput)(nil)).Elem(), ContainerSize(4))
pulumi.RegisterInputType(reflect.TypeOf((*ContainerSizePtrInput)(nil)).Elem(), ContainerSize(4))
pulumi.RegisterOutputType(ContainerBrightnessOutput{})
pulumi.RegisterOutputType(ContainerBrightnessPtrOutput{})
[sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions (#14679) # Description When using types in union cases (using `oneOf` in the schema) then Go SDK-gen doesn't detect these types as being used as inputs and only emits the plain version of a type. That is unless `generateExtraInputTypes: true` is specified in which case Go SDK-gen will emit the non-plain types as well. In the case of azure-native modules, `generateExtraInputTypes` is currently set to `false` (default) as of latest v2.19.0 and is missing a few non-plain type variants (for example `FirewallPolicyFilterRuleCollection` from [this file](https://raw.githubusercontent.com/pulumi/pulumi-azure-native-sdk/master/network/pulumiTypes.go)). There no single plain type in azure-native and yet it is missing these non-plain variants. This PR fixes that by also traversing the element types of schema union definitions when determining plain-ness of types and how they are used. I added an example schema with an array of unions (common case in azure-native) and confirmed that the change actually results in the non-plain types being generated when `generateExtraInputTypes` is set to `false` Fixes https://github.com/pulumi/pulumi-azure-native/issues/1922 ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2023-11-29 12:37:53 +00:00
pulumi.RegisterOutputType(ContainerColorOutput{})
pulumi.RegisterOutputType(ContainerColorPtrOutput{})
pulumi.RegisterOutputType(ContainerSizeOutput{})
pulumi.RegisterOutputType(ContainerSizePtrOutput{})
}