# 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

__all__ = ['OutboundFirewallRuleArgs', 'OutboundFirewallRule']

@pulumi.input_type
class OutboundFirewallRuleArgs:
    def __init__(__self__, *,
                 server_id: pulumi.Input[str],
                 name: Optional[pulumi.Input[str]] = None):
        """
        The set of arguments for constructing a OutboundFirewallRule resource.
        :param pulumi.Input[str] server_id: The resource ID of the SQL Server on which to create the Outbound Firewall Rule. Changing this forces a new resource to be created.
        :param pulumi.Input[str] name: The name of the outbound firewall rule. This should be a FQDN. Changing this forces a new resource to be created.
        """
        pulumi.set(__self__, "server_id", server_id)
        if name is not None:
            pulumi.set(__self__, "name", name)

    @property
    @pulumi.getter(name="serverId")
    def server_id(self) -> pulumi.Input[str]:
        """
        The resource ID of the SQL Server on which to create the Outbound Firewall Rule. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "server_id")

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

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[str]]:
        """
        The name of the outbound firewall rule. This should be a FQDN. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "name")

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


@pulumi.input_type
class _OutboundFirewallRuleState:
    def __init__(__self__, *,
                 name: Optional[pulumi.Input[str]] = None,
                 server_id: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering OutboundFirewallRule resources.
        :param pulumi.Input[str] name: The name of the outbound firewall rule. This should be a FQDN. Changing this forces a new resource to be created.
        :param pulumi.Input[str] server_id: The resource ID of the SQL Server on which to create the Outbound Firewall Rule. Changing this forces a new resource to be created.
        """
        if name is not None:
            pulumi.set(__self__, "name", name)
        if server_id is not None:
            pulumi.set(__self__, "server_id", server_id)

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[str]]:
        """
        The name of the outbound firewall rule. This should be a FQDN. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "name")

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

    @property
    @pulumi.getter(name="serverId")
    def server_id(self) -> Optional[pulumi.Input[str]]:
        """
        The resource ID of the SQL Server on which to create the Outbound Firewall Rule. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "server_id")

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


class OutboundFirewallRule(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 server_id: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        Allows you to manage an Azure SQL Outbound Firewall Rule.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure

        example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
        example_server = azure.mssql.Server("exampleServer",
            resource_group_name=example_resource_group.name,
            location=example_resource_group.location,
            version="12.0",
            administrator_login="4dm1n157r470r",
            administrator_login_password="4-v3ry-53cr37-p455w0rd",
            outbound_network_restriction_enabled=True)
        example_outbound_firewall_rule = azure.mssql.OutboundFirewallRule("exampleOutboundFirewallRule", server_id=example_server.id)
        ```

        ## Import

        SQL Outbound Firewall Rules can be imported using the `resource id`, e.g.

        ```sh
         $ pulumi import azure:mssql/outboundFirewallRule:OutboundFirewallRule rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver/outboundFirewallRules/fqdn1
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] name: The name of the outbound firewall rule. This should be a FQDN. Changing this forces a new resource to be created.
        :param pulumi.Input[str] server_id: The resource ID of the SQL Server on which to create the Outbound Firewall Rule. Changing this forces a new resource to be created.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: OutboundFirewallRuleArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Allows you to manage an Azure SQL Outbound Firewall Rule.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure

        example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
        example_server = azure.mssql.Server("exampleServer",
            resource_group_name=example_resource_group.name,
            location=example_resource_group.location,
            version="12.0",
            administrator_login="4dm1n157r470r",
            administrator_login_password="4-v3ry-53cr37-p455w0rd",
            outbound_network_restriction_enabled=True)
        example_outbound_firewall_rule = azure.mssql.OutboundFirewallRule("exampleOutboundFirewallRule", server_id=example_server.id)
        ```

        ## Import

        SQL Outbound Firewall Rules can be imported using the `resource id`, e.g.

        ```sh
         $ pulumi import azure:mssql/outboundFirewallRule:OutboundFirewallRule rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver/outboundFirewallRules/fqdn1
        ```

        :param str resource_name: The name of the resource.
        :param OutboundFirewallRuleArgs 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(OutboundFirewallRuleArgs, 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,
                 name: Optional[pulumi.Input[str]] = None,
                 server_id: 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__ = OutboundFirewallRuleArgs.__new__(OutboundFirewallRuleArgs)

            __props__.__dict__["name"] = name
            if server_id is None and not opts.urn:
                raise TypeError("Missing required property 'server_id'")
            __props__.__dict__["server_id"] = server_id
        super(OutboundFirewallRule, __self__).__init__(
            'azure:mssql/outboundFirewallRule:OutboundFirewallRule',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            name: Optional[pulumi.Input[str]] = None,
            server_id: Optional[pulumi.Input[str]] = None) -> 'OutboundFirewallRule':
        """
        Get an existing OutboundFirewallRule resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] name: The name of the outbound firewall rule. This should be a FQDN. Changing this forces a new resource to be created.
        :param pulumi.Input[str] server_id: The resource ID of the SQL Server on which to create the Outbound Firewall Rule. Changing this forces a new resource to be created.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _OutboundFirewallRuleState.__new__(_OutboundFirewallRuleState)

        __props__.__dict__["name"] = name
        __props__.__dict__["server_id"] = server_id
        return OutboundFirewallRule(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter
    def name(self) -> pulumi.Output[str]:
        """
        The name of the outbound firewall rule. This should be a FQDN. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "name")

    @property
    @pulumi.getter(name="serverId")
    def server_id(self) -> pulumi.Output[str]:
        """
        The resource ID of the SQL Server on which to create the Outbound Firewall Rule. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "server_id")

