github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/plain-and-default/go/foo/pulumiEnums.go (about) 1 // Code generated by test DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package foo 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 11 ) 12 13 type EnumThing int 14 15 const ( 16 EnumThingFour = EnumThing(4) 17 EnumThingSix = EnumThing(6) 18 EnumThingEight = EnumThing(8) 19 ) 20 21 func (EnumThing) ElementType() reflect.Type { 22 return reflect.TypeOf((*EnumThing)(nil)).Elem() 23 } 24 25 func (e EnumThing) ToEnumThingOutput() EnumThingOutput { 26 return pulumi.ToOutput(e).(EnumThingOutput) 27 } 28 29 func (e EnumThing) ToEnumThingOutputWithContext(ctx context.Context) EnumThingOutput { 30 return pulumi.ToOutputWithContext(ctx, e).(EnumThingOutput) 31 } 32 33 func (e EnumThing) ToEnumThingPtrOutput() EnumThingPtrOutput { 34 return e.ToEnumThingPtrOutputWithContext(context.Background()) 35 } 36 37 func (e EnumThing) ToEnumThingPtrOutputWithContext(ctx context.Context) EnumThingPtrOutput { 38 return EnumThing(e).ToEnumThingOutputWithContext(ctx).ToEnumThingPtrOutputWithContext(ctx) 39 } 40 41 func (e EnumThing) ToIntOutput() pulumi.IntOutput { 42 return pulumi.ToOutput(pulumi.Int(e)).(pulumi.IntOutput) 43 } 44 45 func (e EnumThing) ToIntOutputWithContext(ctx context.Context) pulumi.IntOutput { 46 return pulumi.ToOutputWithContext(ctx, pulumi.Int(e)).(pulumi.IntOutput) 47 } 48 49 func (e EnumThing) ToIntPtrOutput() pulumi.IntPtrOutput { 50 return pulumi.Int(e).ToIntPtrOutputWithContext(context.Background()) 51 } 52 53 func (e EnumThing) ToIntPtrOutputWithContext(ctx context.Context) pulumi.IntPtrOutput { 54 return pulumi.Int(e).ToIntOutputWithContext(ctx).ToIntPtrOutputWithContext(ctx) 55 } 56 57 type EnumThingOutput struct{ *pulumi.OutputState } 58 59 func (EnumThingOutput) ElementType() reflect.Type { 60 return reflect.TypeOf((*EnumThing)(nil)).Elem() 61 } 62 63 func (o EnumThingOutput) ToEnumThingOutput() EnumThingOutput { 64 return o 65 } 66 67 func (o EnumThingOutput) ToEnumThingOutputWithContext(ctx context.Context) EnumThingOutput { 68 return o 69 } 70 71 func (o EnumThingOutput) ToEnumThingPtrOutput() EnumThingPtrOutput { 72 return o.ToEnumThingPtrOutputWithContext(context.Background()) 73 } 74 75 func (o EnumThingOutput) ToEnumThingPtrOutputWithContext(ctx context.Context) EnumThingPtrOutput { 76 return o.ApplyTWithContext(ctx, func(_ context.Context, v EnumThing) *EnumThing { 77 return &v 78 }).(EnumThingPtrOutput) 79 } 80 81 func (o EnumThingOutput) ToIntOutput() pulumi.IntOutput { 82 return o.ToIntOutputWithContext(context.Background()) 83 } 84 85 func (o EnumThingOutput) ToIntOutputWithContext(ctx context.Context) pulumi.IntOutput { 86 return o.ApplyTWithContext(ctx, func(_ context.Context, e EnumThing) int { 87 return int(e) 88 }).(pulumi.IntOutput) 89 } 90 91 func (o EnumThingOutput) ToIntPtrOutput() pulumi.IntPtrOutput { 92 return o.ToIntPtrOutputWithContext(context.Background()) 93 } 94 95 func (o EnumThingOutput) ToIntPtrOutputWithContext(ctx context.Context) pulumi.IntPtrOutput { 96 return o.ApplyTWithContext(ctx, func(_ context.Context, e EnumThing) *int { 97 v := int(e) 98 return &v 99 }).(pulumi.IntPtrOutput) 100 } 101 102 type EnumThingPtrOutput struct{ *pulumi.OutputState } 103 104 func (EnumThingPtrOutput) ElementType() reflect.Type { 105 return reflect.TypeOf((**EnumThing)(nil)).Elem() 106 } 107 108 func (o EnumThingPtrOutput) ToEnumThingPtrOutput() EnumThingPtrOutput { 109 return o 110 } 111 112 func (o EnumThingPtrOutput) ToEnumThingPtrOutputWithContext(ctx context.Context) EnumThingPtrOutput { 113 return o 114 } 115 116 func (o EnumThingPtrOutput) Elem() EnumThingOutput { 117 return o.ApplyT(func(v *EnumThing) EnumThing { 118 if v != nil { 119 return *v 120 } 121 var ret EnumThing 122 return ret 123 }).(EnumThingOutput) 124 } 125 126 func (o EnumThingPtrOutput) ToIntPtrOutput() pulumi.IntPtrOutput { 127 return o.ToIntPtrOutputWithContext(context.Background()) 128 } 129 130 func (o EnumThingPtrOutput) ToIntPtrOutputWithContext(ctx context.Context) pulumi.IntPtrOutput { 131 return o.ApplyTWithContext(ctx, func(_ context.Context, e *EnumThing) *int { 132 if e == nil { 133 return nil 134 } 135 v := int(*e) 136 return &v 137 }).(pulumi.IntPtrOutput) 138 } 139 140 // EnumThingInput is an input type that accepts EnumThingArgs and EnumThingOutput values. 141 // You can construct a concrete instance of `EnumThingInput` via: 142 // 143 // EnumThingArgs{...} 144 type EnumThingInput interface { 145 pulumi.Input 146 147 ToEnumThingOutput() EnumThingOutput 148 ToEnumThingOutputWithContext(context.Context) EnumThingOutput 149 } 150 151 var enumThingPtrType = reflect.TypeOf((**EnumThing)(nil)).Elem() 152 153 type EnumThingPtrInput interface { 154 pulumi.Input 155 156 ToEnumThingPtrOutput() EnumThingPtrOutput 157 ToEnumThingPtrOutputWithContext(context.Context) EnumThingPtrOutput 158 } 159 160 type enumThingPtr int 161 162 func EnumThingPtr(v int) EnumThingPtrInput { 163 return (*enumThingPtr)(&v) 164 } 165 166 func (*enumThingPtr) ElementType() reflect.Type { 167 return enumThingPtrType 168 } 169 170 func (in *enumThingPtr) ToEnumThingPtrOutput() EnumThingPtrOutput { 171 return pulumi.ToOutput(in).(EnumThingPtrOutput) 172 } 173 174 func (in *enumThingPtr) ToEnumThingPtrOutputWithContext(ctx context.Context) EnumThingPtrOutput { 175 return pulumi.ToOutputWithContext(ctx, in).(EnumThingPtrOutput) 176 } 177 178 func init() { 179 pulumi.RegisterInputType(reflect.TypeOf((*EnumThingInput)(nil)).Elem(), EnumThing(4)) 180 pulumi.RegisterInputType(reflect.TypeOf((*EnumThingPtrInput)(nil)).Elem(), EnumThing(4)) 181 pulumi.RegisterOutputType(EnumThingOutput{}) 182 pulumi.RegisterOutputType(EnumThingPtrOutput{}) 183 }