# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
from ._inputs import *

__all__ = ['ProviderArgs', 'Provider']

@pulumi.input_type
class ProviderArgs:
    def __init__(__self__, *,
                 azure_auth: Optional[pulumi.Input['ProviderAzureAuthArgs']] = None,
                 hostname: Optional[pulumi.Input[str]] = None,
                 port: Optional[pulumi.Input[int]] = None,
                 sql_auth: Optional[pulumi.Input['ProviderSqlAuthArgs']] = None):
        """
        The set of arguments for constructing a Provider resource.
        :param pulumi.Input['ProviderAzureAuthArgs'] azure_auth: When provided, Azure AD authentication will be used when connecting.
        :param pulumi.Input[str] hostname: FQDN or IP address of the SQL endpoint. Can be also set using `MSSQL_HOSTNAME` environment variable.
        :param pulumi.Input[int] port: TCP port of SQL endpoint. Defaults to `1433`. Can be also set using `MSSQL_PORT` environment variable.
        :param pulumi.Input['ProviderSqlAuthArgs'] sql_auth: When provided, SQL authentication will be used when connecting.
        """
        if azure_auth is not None:
            pulumi.set(__self__, "azure_auth", azure_auth)
        if hostname is None:
            hostname = _utilities.get_env('MSSQL_HOSTNAME')
        if hostname is not None:
            pulumi.set(__self__, "hostname", hostname)
        if port is None:
            port = (_utilities.get_env_int('MSSQL_PORT') or 1433)
        if port is not None:
            pulumi.set(__self__, "port", port)
        if sql_auth is not None:
            pulumi.set(__self__, "sql_auth", sql_auth)

    @property
    @pulumi.getter(name="azureAuth")
    def azure_auth(self) -> Optional[pulumi.Input['ProviderAzureAuthArgs']]:
        """
        When provided, Azure AD authentication will be used when connecting.
        """
        return pulumi.get(self, "azure_auth")

    @azure_auth.setter
    def azure_auth(self, value: Optional[pulumi.Input['ProviderAzureAuthArgs']]):
        pulumi.set(self, "azure_auth", value)

    @property
    @pulumi.getter
    def hostname(self) -> Optional[pulumi.Input[str]]:
        """
        FQDN or IP address of the SQL endpoint. Can be also set using `MSSQL_HOSTNAME` environment variable.
        """
        return pulumi.get(self, "hostname")

    @hostname.setter
    def hostname(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "hostname", value)

    @property
    @pulumi.getter
    def port(self) -> Optional[pulumi.Input[int]]:
        """
        TCP port of SQL endpoint. Defaults to `1433`. Can be also set using `MSSQL_PORT` environment variable.
        """
        return pulumi.get(self, "port")

    @port.setter
    def port(self, value: Optional[pulumi.Input[int]]):
        pulumi.set(self, "port", value)

    @property
    @pulumi.getter(name="sqlAuth")
    def sql_auth(self) -> Optional[pulumi.Input['ProviderSqlAuthArgs']]:
        """
        When provided, SQL authentication will be used when connecting.
        """
        return pulumi.get(self, "sql_auth")

    @sql_auth.setter
    def sql_auth(self, value: Optional[pulumi.Input['ProviderSqlAuthArgs']]):
        pulumi.set(self, "sql_auth", value)


class Provider(pulumi.ProviderResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 azure_auth: Optional[pulumi.Input[Union['ProviderAzureAuthArgs', 'ProviderAzureAuthArgsDict']]] = None,
                 hostname: Optional[pulumi.Input[str]] = None,
                 port: Optional[pulumi.Input[int]] = None,
                 sql_auth: Optional[pulumi.Input[Union['ProviderSqlAuthArgs', 'ProviderSqlAuthArgsDict']]] = None,
                 __props__=None):
        """
        The provider type for the mssql package. By default, resources use package-wide configuration
        settings, however an explicit `Provider` instance may be created and passed during resource
        construction to achieve fine-grained programmatic control over provider settings. See the
        [documentation](https://www.pulumi.com/docs/reference/programming-model/#providers) for more information.

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[Union['ProviderAzureAuthArgs', 'ProviderAzureAuthArgsDict']] azure_auth: When provided, Azure AD authentication will be used when connecting.
        :param pulumi.Input[str] hostname: FQDN or IP address of the SQL endpoint. Can be also set using `MSSQL_HOSTNAME` environment variable.
        :param pulumi.Input[int] port: TCP port of SQL endpoint. Defaults to `1433`. Can be also set using `MSSQL_PORT` environment variable.
        :param pulumi.Input[Union['ProviderSqlAuthArgs', 'ProviderSqlAuthArgsDict']] sql_auth: When provided, SQL authentication will be used when connecting.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: Optional[ProviderArgs] = None,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        The provider type for the mssql package. By default, resources use package-wide configuration
        settings, however an explicit `Provider` instance may be created and passed during resource
        construction to achieve fine-grained programmatic control over provider settings. See the
        [documentation](https://www.pulumi.com/docs/reference/programming-model/#providers) for more information.

        :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,
                 azure_auth: Optional[pulumi.Input[Union['ProviderAzureAuthArgs', 'ProviderAzureAuthArgsDict']]] = None,
                 hostname: Optional[pulumi.Input[str]] = None,
                 port: Optional[pulumi.Input[int]] = None,
                 sql_auth: Optional[pulumi.Input[Union['ProviderSqlAuthArgs', 'ProviderSqlAuthArgsDict']]] = 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__["azure_auth"] = pulumi.Output.from_input(azure_auth).apply(pulumi.runtime.to_json) if azure_auth is not None else None
            if hostname is None:
                hostname = _utilities.get_env('MSSQL_HOSTNAME')
            __props__.__dict__["hostname"] = hostname
            if port is None:
                port = (_utilities.get_env_int('MSSQL_PORT') or 1433)
            __props__.__dict__["port"] = pulumi.Output.from_input(port).apply(pulumi.runtime.to_json) if port is not None else None
            __props__.__dict__["sql_auth"] = pulumi.Output.from_input(sql_auth).apply(pulumi.runtime.to_json) if sql_auth is not None else None
        super(Provider, __self__).__init__(
            'mssql',
            resource_name,
            __props__,
            opts)

    @property
    @pulumi.getter
    def hostname(self) -> pulumi.Output[Optional[str]]:
        """
        FQDN or IP address of the SQL endpoint. Can be also set using `MSSQL_HOSTNAME` environment variable.
        """
        return pulumi.get(self, "hostname")

