github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/provider-config-schema/python/pulumi_configstation/provider.py (about)

     1  # coding=utf-8
     2  # *** WARNING: this file was generated by test. ***
     3  # *** Do not edit by hand unless you're certain you know what you are doing! ***
     4  
     5  import copy
     6  import warnings
     7  import pulumi
     8  import pulumi.runtime
     9  from typing import Any, Mapping, Optional, Sequence, Union, overload
    10  from . import _utilities
    11  from ._enums import *
    12  
    13  __all__ = ['ProviderArgs', 'Provider']
    14  
    15  @pulumi.input_type
    16  class ProviderArgs:
    17      def __init__(__self__, *,
    18                   favorite_color: Optional[pulumi.Input[Union[str, 'Color']]] = None):
    19          """
    20          The set of arguments for constructing a Provider resource.
    21          :param pulumi.Input[Union[str, 'Color']] favorite_color: this is a relaxed string enum which can also be set via env var
    22          """
    23          if favorite_color is None:
    24              favorite_color = _utilities.get_env('FAVE_COLOR')
    25          if favorite_color is not None:
    26              pulumi.set(__self__, "favorite_color", favorite_color)
    27  
    28      @property
    29      @pulumi.getter(name="favoriteColor")
    30      def favorite_color(self) -> Optional[pulumi.Input[Union[str, 'Color']]]:
    31          """
    32          this is a relaxed string enum which can also be set via env var
    33          """
    34          return pulumi.get(self, "favorite_color")
    35  
    36      @favorite_color.setter
    37      def favorite_color(self, value: Optional[pulumi.Input[Union[str, 'Color']]]):
    38          pulumi.set(self, "favorite_color", value)
    39  
    40  
    41  class Provider(pulumi.ProviderResource):
    42      @overload
    43      def __init__(__self__,
    44                   resource_name: str,
    45                   opts: Optional[pulumi.ResourceOptions] = None,
    46                   favorite_color: Optional[pulumi.Input[Union[str, 'Color']]] = None,
    47                   __props__=None):
    48          """
    49          Create a Configstation resource with the given unique name, props, and options.
    50          :param str resource_name: The name of the resource.
    51          :param pulumi.ResourceOptions opts: Options for the resource.
    52          :param pulumi.Input[Union[str, 'Color']] favorite_color: this is a relaxed string enum which can also be set via env var
    53          """
    54          ...
    55      @overload
    56      def __init__(__self__,
    57                   resource_name: str,
    58                   args: Optional[ProviderArgs] = None,
    59                   opts: Optional[pulumi.ResourceOptions] = None):
    60          """
    61          Create a Configstation resource with the given unique name, props, and options.
    62          :param str resource_name: The name of the resource.
    63          :param ProviderArgs args: The arguments to use to populate this resource's properties.
    64          :param pulumi.ResourceOptions opts: Options for the resource.
    65          """
    66          ...
    67      def __init__(__self__, resource_name: str, *args, **kwargs):
    68          resource_args, opts = _utilities.get_resource_args_opts(ProviderArgs, pulumi.ResourceOptions, *args, **kwargs)
    69          if resource_args is not None:
    70              __self__._internal_init(resource_name, opts, **resource_args.__dict__)
    71          else:
    72              __self__._internal_init(resource_name, *args, **kwargs)
    73  
    74      def _internal_init(__self__,
    75                   resource_name: str,
    76                   opts: Optional[pulumi.ResourceOptions] = None,
    77                   favorite_color: Optional[pulumi.Input[Union[str, 'Color']]] = None,
    78                   __props__=None):
    79          opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
    80          if not isinstance(opts, pulumi.ResourceOptions):
    81              raise TypeError('Expected resource options to be a ResourceOptions instance')
    82          if opts.id is None:
    83              if __props__ is not None:
    84                  raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
    85              __props__ = ProviderArgs.__new__(ProviderArgs)
    86  
    87              if favorite_color is None:
    88                  favorite_color = _utilities.get_env('FAVE_COLOR')
    89              __props__.__dict__["favorite_color"] = pulumi.Output.from_input(favorite_color).apply(pulumi.runtime.to_json) if favorite_color is not None else None
    90          super(Provider, __self__).__init__(
    91              'configstation',
    92              resource_name,
    93              __props__,
    94              opts)
    95