# 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 warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
from . import outputs
from ._inputs import *

__all__ = ['NamedLocationArgs', 'NamedLocation']

@pulumi.input_type
class NamedLocationArgs:
    def __init__(__self__, *,
                 display_name: pulumi.Input[str],
                 country: Optional[pulumi.Input['NamedLocationCountryArgs']] = None,
                 ip: Optional[pulumi.Input['NamedLocationIpArgs']] = None):
        """
        The set of arguments for constructing a NamedLocation resource.
        :param pulumi.Input[str] display_name: The friendly name for this named location.
        :param pulumi.Input['NamedLocationCountryArgs'] country: A `country` block as documented below, which configures a country-based named location.
        :param pulumi.Input['NamedLocationIpArgs'] ip: An `ip` block as documented below, which configures an IP-based named location.
        """
        pulumi.set(__self__, "display_name", display_name)
        if country is not None:
            pulumi.set(__self__, "country", country)
        if ip is not None:
            pulumi.set(__self__, "ip", ip)

    @property
    @pulumi.getter(name="displayName")
    def display_name(self) -> pulumi.Input[str]:
        """
        The friendly name for this named location.
        """
        return pulumi.get(self, "display_name")

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

    @property
    @pulumi.getter
    def country(self) -> Optional[pulumi.Input['NamedLocationCountryArgs']]:
        """
        A `country` block as documented below, which configures a country-based named location.
        """
        return pulumi.get(self, "country")

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

    @property
    @pulumi.getter
    def ip(self) -> Optional[pulumi.Input['NamedLocationIpArgs']]:
        """
        An `ip` block as documented below, which configures an IP-based named location.
        """
        return pulumi.get(self, "ip")

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


@pulumi.input_type
class _NamedLocationState:
    def __init__(__self__, *,
                 country: Optional[pulumi.Input['NamedLocationCountryArgs']] = None,
                 display_name: Optional[pulumi.Input[str]] = None,
                 ip: Optional[pulumi.Input['NamedLocationIpArgs']] = None):
        """
        Input properties used for looking up and filtering NamedLocation resources.
        :param pulumi.Input['NamedLocationCountryArgs'] country: A `country` block as documented below, which configures a country-based named location.
        :param pulumi.Input[str] display_name: The friendly name for this named location.
        :param pulumi.Input['NamedLocationIpArgs'] ip: An `ip` block as documented below, which configures an IP-based named location.
        """
        if country is not None:
            pulumi.set(__self__, "country", country)
        if display_name is not None:
            pulumi.set(__self__, "display_name", display_name)
        if ip is not None:
            pulumi.set(__self__, "ip", ip)

    @property
    @pulumi.getter
    def country(self) -> Optional[pulumi.Input['NamedLocationCountryArgs']]:
        """
        A `country` block as documented below, which configures a country-based named location.
        """
        return pulumi.get(self, "country")

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

    @property
    @pulumi.getter(name="displayName")
    def display_name(self) -> Optional[pulumi.Input[str]]:
        """
        The friendly name for this named location.
        """
        return pulumi.get(self, "display_name")

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

    @property
    @pulumi.getter
    def ip(self) -> Optional[pulumi.Input['NamedLocationIpArgs']]:
        """
        An `ip` block as documented below, which configures an IP-based named location.
        """
        return pulumi.get(self, "ip")

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


class NamedLocation(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 country: Optional[pulumi.Input[pulumi.InputType['NamedLocationCountryArgs']]] = None,
                 display_name: Optional[pulumi.Input[str]] = None,
                 ip: Optional[pulumi.Input[pulumi.InputType['NamedLocationIpArgs']]] = None,
                 __props__=None):
        """
        Manages a Named Location within Azure Active Directory.

        ## API Permissions

        The following API permissions are required in order to use this resource.

        When authenticated with a service principal, this resource requires the following application roles: `Policy.ReadWrite.ConditionalAccess` and `Policy.Read.All`

        When authenticated with a user principal, this resource requires one of the following directory roles: `Conditional Access Administrator` or `Global Administrator`

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azuread as azuread

        example_ip = azuread.NamedLocation("example-ip",
            display_name="IP Named Location",
            ip=azuread.NamedLocationIpArgs(
                ip_ranges=[
                    "1.1.1.1/32",
                    "2.2.2.2/32",
                ],
                trusted=True,
            ))
        example_country = azuread.NamedLocation("example-country",
            country=azuread.NamedLocationCountryArgs(
                countries_and_regions=[
                    "GB",
                    "US",
                ],
                include_unknown_countries_and_regions=False,
            ),
            display_name="Country Named Location")
        ```

        ## Import

        Named Locations can be imported using the `id`, e.g.

        ```sh
         $ pulumi import azuread:index/namedLocation:NamedLocation my_location 00000000-0000-0000-0000-000000000000
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[pulumi.InputType['NamedLocationCountryArgs']] country: A `country` block as documented below, which configures a country-based named location.
        :param pulumi.Input[str] display_name: The friendly name for this named location.
        :param pulumi.Input[pulumi.InputType['NamedLocationIpArgs']] ip: An `ip` block as documented below, which configures an IP-based named location.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: NamedLocationArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Manages a Named Location within Azure Active Directory.

        ## API Permissions

        The following API permissions are required in order to use this resource.

        When authenticated with a service principal, this resource requires the following application roles: `Policy.ReadWrite.ConditionalAccess` and `Policy.Read.All`

        When authenticated with a user principal, this resource requires one of the following directory roles: `Conditional Access Administrator` or `Global Administrator`

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azuread as azuread

        example_ip = azuread.NamedLocation("example-ip",
            display_name="IP Named Location",
            ip=azuread.NamedLocationIpArgs(
                ip_ranges=[
                    "1.1.1.1/32",
                    "2.2.2.2/32",
                ],
                trusted=True,
            ))
        example_country = azuread.NamedLocation("example-country",
            country=azuread.NamedLocationCountryArgs(
                countries_and_regions=[
                    "GB",
                    "US",
                ],
                include_unknown_countries_and_regions=False,
            ),
            display_name="Country Named Location")
        ```

        ## Import

        Named Locations can be imported using the `id`, e.g.

        ```sh
         $ pulumi import azuread:index/namedLocation:NamedLocation my_location 00000000-0000-0000-0000-000000000000
        ```

        :param str resource_name: The name of the resource.
        :param NamedLocationArgs 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(NamedLocationArgs, 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,
                 country: Optional[pulumi.Input[pulumi.InputType['NamedLocationCountryArgs']]] = None,
                 display_name: Optional[pulumi.Input[str]] = None,
                 ip: Optional[pulumi.Input[pulumi.InputType['NamedLocationIpArgs']]] = None,
                 __props__=None):
        if opts is None:
            opts = pulumi.ResourceOptions()
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.version is None:
            opts.version = _utilities.get_version()
        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__ = NamedLocationArgs.__new__(NamedLocationArgs)

            __props__.__dict__["country"] = country
            if display_name is None and not opts.urn:
                raise TypeError("Missing required property 'display_name'")
            __props__.__dict__["display_name"] = display_name
            __props__.__dict__["ip"] = ip
        super(NamedLocation, __self__).__init__(
            'azuread:index/namedLocation:NamedLocation',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            country: Optional[pulumi.Input[pulumi.InputType['NamedLocationCountryArgs']]] = None,
            display_name: Optional[pulumi.Input[str]] = None,
            ip: Optional[pulumi.Input[pulumi.InputType['NamedLocationIpArgs']]] = None) -> 'NamedLocation':
        """
        Get an existing NamedLocation 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[pulumi.InputType['NamedLocationCountryArgs']] country: A `country` block as documented below, which configures a country-based named location.
        :param pulumi.Input[str] display_name: The friendly name for this named location.
        :param pulumi.Input[pulumi.InputType['NamedLocationIpArgs']] ip: An `ip` block as documented below, which configures an IP-based named location.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _NamedLocationState.__new__(_NamedLocationState)

        __props__.__dict__["country"] = country
        __props__.__dict__["display_name"] = display_name
        __props__.__dict__["ip"] = ip
        return NamedLocation(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter
    def country(self) -> pulumi.Output[Optional['outputs.NamedLocationCountry']]:
        """
        A `country` block as documented below, which configures a country-based named location.
        """
        return pulumi.get(self, "country")

    @property
    @pulumi.getter(name="displayName")
    def display_name(self) -> pulumi.Output[str]:
        """
        The friendly name for this named location.
        """
        return pulumi.get(self, "display_name")

    @property
    @pulumi.getter
    def ip(self) -> pulumi.Output[Optional['outputs.NamedLocationIp']]:
        """
        An `ip` block as documented below, which configures an IP-based named location.
        """
        return pulumi.get(self, "ip")

