github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/provider-config-schema/go/configstation/provider.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 configstation 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 11 ) 12 13 type Provider struct { 14 pulumi.ProviderResourceState 15 } 16 17 // NewProvider registers a new resource with the given unique name, arguments, and options. 18 func NewProvider(ctx *pulumi.Context, 19 name string, args *ProviderArgs, opts ...pulumi.ResourceOption) (*Provider, error) { 20 if args == nil { 21 args = &ProviderArgs{} 22 } 23 24 if isZero(args.FavoriteColor) { 25 args.FavoriteColor = pulumi.StringPtr(getEnvOrDefault("", nil, "FAVE_COLOR").(string)) 26 } 27 var resource Provider 28 err := ctx.RegisterResource("pulumi:providers:configstation", name, args, &resource, opts...) 29 if err != nil { 30 return nil, err 31 } 32 return &resource, nil 33 } 34 35 type providerArgs struct { 36 // this is a relaxed string enum which can also be set via env var 37 FavoriteColor *string `pulumi:"favoriteColor"` 38 } 39 40 // The set of arguments for constructing a Provider resource. 41 type ProviderArgs struct { 42 // this is a relaxed string enum which can also be set via env var 43 FavoriteColor pulumi.StringPtrInput 44 } 45 46 func (ProviderArgs) ElementType() reflect.Type { 47 return reflect.TypeOf((*providerArgs)(nil)).Elem() 48 } 49 50 type ProviderInput interface { 51 pulumi.Input 52 53 ToProviderOutput() ProviderOutput 54 ToProviderOutputWithContext(ctx context.Context) ProviderOutput 55 } 56 57 func (*Provider) ElementType() reflect.Type { 58 return reflect.TypeOf((**Provider)(nil)).Elem() 59 } 60 61 func (i *Provider) ToProviderOutput() ProviderOutput { 62 return i.ToProviderOutputWithContext(context.Background()) 63 } 64 65 func (i *Provider) ToProviderOutputWithContext(ctx context.Context) ProviderOutput { 66 return pulumi.ToOutputWithContext(ctx, i).(ProviderOutput) 67 } 68 69 type ProviderOutput struct{ *pulumi.OutputState } 70 71 func (ProviderOutput) ElementType() reflect.Type { 72 return reflect.TypeOf((**Provider)(nil)).Elem() 73 } 74 75 func (o ProviderOutput) ToProviderOutput() ProviderOutput { 76 return o 77 } 78 79 func (o ProviderOutput) ToProviderOutputWithContext(ctx context.Context) ProviderOutput { 80 return o 81 } 82 83 func init() { 84 pulumi.RegisterInputType(reflect.TypeOf((*ProviderInput)(nil)).Elem(), &Provider{}) 85 pulumi.RegisterOutputType(ProviderOutput{}) 86 }