pulumi/tests/testdata/codegen/kubernetes20/python/pulumi_kubernetes/provider.py

158 lines
7.1 KiB
Python

# coding=utf-8
# *** WARNING: this file was generated by test. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import sys
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
if sys.version_info >= (3, 11):
from typing import NotRequired, TypedDict, TypeAlias
else:
from typing_extensions import NotRequired, TypedDict, TypeAlias
from . import _utilities
from ._inputs import *
__all__ = ['ProviderArgs', 'Provider']
@pulumi.input_type
class ProviderArgs:
def __init__(__self__, *,
kube_client_settings: Optional[pulumi.Input['KubeClientSettingsArgs']] = None,
kubeconfig: Optional[pulumi.Input[str]] = None,
namespace: Optional[pulumi.Input[str]] = None):
"""
The set of arguments for constructing a Provider resource.
:param pulumi.Input['KubeClientSettingsArgs'] kube_client_settings: Options for tuning the Kubernetes client used by a Provider.
:param pulumi.Input[str] kubeconfig: The contents of a kubeconfig file or the path to a kubeconfig file.
:param pulumi.Input[str] namespace: If present, the default namespace to use. This flag is ignored for cluster-scoped resources.
A namespace can be specified in multiple places, and the precedence is as follows:
1. `.metadata.namespace` set on the resource.
2. This `namespace` parameter.
3. `namespace` set for the active context in the kubeconfig.
"""
if kube_client_settings is not None:
pulumi.set(__self__, "kube_client_settings", kube_client_settings)
if kubeconfig is None:
kubeconfig = _utilities.get_env('KUBECONFIG')
if kubeconfig is not None:
pulumi.set(__self__, "kubeconfig", kubeconfig)
if namespace is not None:
pulumi.set(__self__, "namespace", namespace)
@property
@pulumi.getter(name="kubeClientSettings")
def kube_client_settings(self) -> Optional[pulumi.Input['KubeClientSettingsArgs']]:
"""
Options for tuning the Kubernetes client used by a Provider.
"""
return pulumi.get(self, "kube_client_settings")
@kube_client_settings.setter
def kube_client_settings(self, value: Optional[pulumi.Input['KubeClientSettingsArgs']]):
pulumi.set(self, "kube_client_settings", value)
@property
@pulumi.getter
def kubeconfig(self) -> Optional[pulumi.Input[str]]:
"""
The contents of a kubeconfig file or the path to a kubeconfig file.
"""
return pulumi.get(self, "kubeconfig")
@kubeconfig.setter
def kubeconfig(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "kubeconfig", value)
@property
@pulumi.getter
def namespace(self) -> Optional[pulumi.Input[str]]:
"""
If present, the default namespace to use. This flag is ignored for cluster-scoped resources.
A namespace can be specified in multiple places, and the precedence is as follows:
1. `.metadata.namespace` set on the resource.
2. This `namespace` parameter.
3. `namespace` set for the active context in the kubeconfig.
"""
return pulumi.get(self, "namespace")
@namespace.setter
def namespace(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "namespace", value)
class Provider(pulumi.ProviderResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
kube_client_settings: Optional[pulumi.Input[Union['KubeClientSettingsArgs', 'KubeClientSettingsArgsDict']]] = None,
kubeconfig: Optional[pulumi.Input[str]] = None,
namespace: Optional[pulumi.Input[str]] = None,
__props__=None):
"""
The provider type for the kubernetes package.
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[Union['KubeClientSettingsArgs', 'KubeClientSettingsArgsDict']] kube_client_settings: Options for tuning the Kubernetes client used by a Provider.
:param pulumi.Input[str] kubeconfig: The contents of a kubeconfig file or the path to a kubeconfig file.
:param pulumi.Input[str] namespace: If present, the default namespace to use. This flag is ignored for cluster-scoped resources.
A namespace can be specified in multiple places, and the precedence is as follows:
1. `.metadata.namespace` set on the resource.
2. This `namespace` parameter.
3. `namespace` set for the active context in the kubeconfig.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: Optional[ProviderArgs] = None,
opts: Optional[pulumi.ResourceOptions] = None):
"""
The provider type for the kubernetes package.
:param str resource_name: The name of the resource.
:param ProviderArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
def __init__(__self__, resource_name: str, *args, **kwargs):
resource_args, opts = _utilities.get_resource_args_opts(ProviderArgs, pulumi.ResourceOptions, *args, **kwargs)
if resource_args is not None:
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
else:
__self__._internal_init(resource_name, *args, **kwargs)
def _internal_init(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
kube_client_settings: Optional[pulumi.Input[Union['KubeClientSettingsArgs', 'KubeClientSettingsArgsDict']]] = None,
kubeconfig: Optional[pulumi.Input[str]] = None,
namespace: Optional[pulumi.Input[str]] = None,
__props__=None):
opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = ProviderArgs.__new__(ProviderArgs)
__props__.__dict__["kube_client_settings"] = pulumi.Output.from_input(kube_client_settings).apply(pulumi.runtime.to_json) if kube_client_settings is not None else None
if kubeconfig is None:
kubeconfig = _utilities.get_env('KUBECONFIG')
__props__.__dict__["kubeconfig"] = kubeconfig
__props__.__dict__["namespace"] = namespace
super(Provider, __self__).__init__(
'kubernetes',
resource_name,
__props__,
opts)