# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import builtins as _builtins
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

__all__ = ['NetworkSecurityPerimeterAssociationArgs', 'NetworkSecurityPerimeterAssociation']

@pulumi.input_type
class NetworkSecurityPerimeterAssociationArgs:
    def __init__(__self__, *,
                 access_mode: pulumi.Input[_builtins.str],
                 network_security_perimeter_profile_id: pulumi.Input[_builtins.str],
                 resource_id: pulumi.Input[_builtins.str],
                 name: Optional[pulumi.Input[_builtins.str]] = None):
        """
        The set of arguments for constructing a NetworkSecurityPerimeterAssociation resource.

        :param pulumi.Input[_builtins.str] access_mode: Access mode for the associated resource on the Network Security Perimeter. Possible values are `Audit`, `Enforced`, and `Learning`.
        :param pulumi.Input[_builtins.str] network_security_perimeter_profile_id: The ID of the Network Security Perimeter Profile. Changing this forces a new Network Security Perimeter Association to be created.
        :param pulumi.Input[_builtins.str] resource_id: The ID of the associated resource. Changing this forces a new Network Security Perimeter Association to be created.
               
               > **Note:** A resource can only be associated with one Network Security Perimeter at a time.
               If the target resource is already associated with another Network Security Perimeter, the creation of this association may appear to succeed in Terraform but will not be reflected in Azure. In such cases, the association will not actually exist and subsequent Terraform operations may show unexpected behavior.
        :param pulumi.Input[_builtins.str] name: The name which should be used for this Network Security Perimeter Association. Changing this forces a new Network Security Perimeter Association to be created.
        """
        pulumi.set(__self__, "access_mode", access_mode)
        pulumi.set(__self__, "network_security_perimeter_profile_id", network_security_perimeter_profile_id)
        pulumi.set(__self__, "resource_id", resource_id)
        if name is not None:
            pulumi.set(__self__, "name", name)

    @_builtins.property
    @pulumi.getter(name="accessMode")
    def access_mode(self) -> pulumi.Input[_builtins.str]:
        """
        Access mode for the associated resource on the Network Security Perimeter. Possible values are `Audit`, `Enforced`, and `Learning`.
        """
        return pulumi.get(self, "access_mode")

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

    @_builtins.property
    @pulumi.getter(name="networkSecurityPerimeterProfileId")
    def network_security_perimeter_profile_id(self) -> pulumi.Input[_builtins.str]:
        """
        The ID of the Network Security Perimeter Profile. Changing this forces a new Network Security Perimeter Association to be created.
        """
        return pulumi.get(self, "network_security_perimeter_profile_id")

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

    @_builtins.property
    @pulumi.getter(name="resourceId")
    def resource_id(self) -> pulumi.Input[_builtins.str]:
        """
        The ID of the associated resource. Changing this forces a new Network Security Perimeter Association to be created.

        > **Note:** A resource can only be associated with one Network Security Perimeter at a time.
        If the target resource is already associated with another Network Security Perimeter, the creation of this association may appear to succeed in Terraform but will not be reflected in Azure. In such cases, the association will not actually exist and subsequent Terraform operations may show unexpected behavior.
        """
        return pulumi.get(self, "resource_id")

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

    @_builtins.property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The name which should be used for this Network Security Perimeter Association. Changing this forces a new Network Security Perimeter Association to be created.
        """
        return pulumi.get(self, "name")

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


@pulumi.input_type
class _NetworkSecurityPerimeterAssociationState:
    def __init__(__self__, *,
                 access_mode: Optional[pulumi.Input[_builtins.str]] = None,
                 name: Optional[pulumi.Input[_builtins.str]] = None,
                 network_security_perimeter_profile_id: Optional[pulumi.Input[_builtins.str]] = None,
                 resource_id: Optional[pulumi.Input[_builtins.str]] = None):
        """
        Input properties used for looking up and filtering NetworkSecurityPerimeterAssociation resources.

        :param pulumi.Input[_builtins.str] access_mode: Access mode for the associated resource on the Network Security Perimeter. Possible values are `Audit`, `Enforced`, and `Learning`.
        :param pulumi.Input[_builtins.str] name: The name which should be used for this Network Security Perimeter Association. Changing this forces a new Network Security Perimeter Association to be created.
        :param pulumi.Input[_builtins.str] network_security_perimeter_profile_id: The ID of the Network Security Perimeter Profile. Changing this forces a new Network Security Perimeter Association to be created.
        :param pulumi.Input[_builtins.str] resource_id: The ID of the associated resource. Changing this forces a new Network Security Perimeter Association to be created.
               
               > **Note:** A resource can only be associated with one Network Security Perimeter at a time.
               If the target resource is already associated with another Network Security Perimeter, the creation of this association may appear to succeed in Terraform but will not be reflected in Azure. In such cases, the association will not actually exist and subsequent Terraform operations may show unexpected behavior.
        """
        if access_mode is not None:
            pulumi.set(__self__, "access_mode", access_mode)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if network_security_perimeter_profile_id is not None:
            pulumi.set(__self__, "network_security_perimeter_profile_id", network_security_perimeter_profile_id)
        if resource_id is not None:
            pulumi.set(__self__, "resource_id", resource_id)

    @_builtins.property
    @pulumi.getter(name="accessMode")
    def access_mode(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Access mode for the associated resource on the Network Security Perimeter. Possible values are `Audit`, `Enforced`, and `Learning`.
        """
        return pulumi.get(self, "access_mode")

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

    @_builtins.property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The name which should be used for this Network Security Perimeter Association. Changing this forces a new Network Security Perimeter Association to be created.
        """
        return pulumi.get(self, "name")

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

    @_builtins.property
    @pulumi.getter(name="networkSecurityPerimeterProfileId")
    def network_security_perimeter_profile_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The ID of the Network Security Perimeter Profile. Changing this forces a new Network Security Perimeter Association to be created.
        """
        return pulumi.get(self, "network_security_perimeter_profile_id")

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

    @_builtins.property
    @pulumi.getter(name="resourceId")
    def resource_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The ID of the associated resource. Changing this forces a new Network Security Perimeter Association to be created.

        > **Note:** A resource can only be associated with one Network Security Perimeter at a time.
        If the target resource is already associated with another Network Security Perimeter, the creation of this association may appear to succeed in Terraform but will not be reflected in Azure. In such cases, the association will not actually exist and subsequent Terraform operations may show unexpected behavior.
        """
        return pulumi.get(self, "resource_id")

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


@pulumi.type_token("azure:network/networkSecurityPerimeterAssociation:NetworkSecurityPerimeterAssociation")
class NetworkSecurityPerimeterAssociation(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 access_mode: Optional[pulumi.Input[_builtins.str]] = None,
                 name: Optional[pulumi.Input[_builtins.str]] = None,
                 network_security_perimeter_profile_id: Optional[pulumi.Input[_builtins.str]] = None,
                 resource_id: Optional[pulumi.Input[_builtins.str]] = None,
                 __props__=None):
        """
        Manages a Network Security Perimeter Association.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure

        example = azure.core.ResourceGroup("example",
            name="example-resources",
            location="West Europe")
        example_analytics_workspace = azure.operationalinsights.AnalyticsWorkspace("example",
            name="example",
            location="West Europe",
            resource_group_name=example.name)
        example_network_security_perimeter = azure.network.NetworkSecurityPerimeter("example",
            name="example",
            resource_group_name=example.name,
            location="West Europe")
        example_network_security_perimeter_profile = azure.network.NetworkSecurityPerimeterProfile("example",
            name="example",
            network_security_perimeter_id=example_network_security_perimeter.id)
        example_network_security_perimeter_association = azure.network.NetworkSecurityPerimeterAssociation("example",
            name="example",
            access_mode="Enforced",
            network_security_perimeter_profile_id=example_network_security_perimeter_profile.id,
            resource_id=example_analytics_workspace.id)
        ```

        ## API Providers

        <!-- This section is generated, changes will be overwritten -->
        This resource uses the following Azure API Providers:

        * `Microsoft.Network` - 2025-01-01

        ## Import

        Network Security Perimeter Associations can be imported using the `resource id`, e.g.

        ```sh
        $ pulumi import azure:network/networkSecurityPerimeterAssociation:NetworkSecurityPerimeterAssociation example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-rg/providers/Microsoft.Network/networkSecurityPerimeters/example-nsp/resourceAssociations/example-assoc
        ```


        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.str] access_mode: Access mode for the associated resource on the Network Security Perimeter. Possible values are `Audit`, `Enforced`, and `Learning`.
        :param pulumi.Input[_builtins.str] name: The name which should be used for this Network Security Perimeter Association. Changing this forces a new Network Security Perimeter Association to be created.
        :param pulumi.Input[_builtins.str] network_security_perimeter_profile_id: The ID of the Network Security Perimeter Profile. Changing this forces a new Network Security Perimeter Association to be created.
        :param pulumi.Input[_builtins.str] resource_id: The ID of the associated resource. Changing this forces a new Network Security Perimeter Association to be created.
               
               > **Note:** A resource can only be associated with one Network Security Perimeter at a time.
               If the target resource is already associated with another Network Security Perimeter, the creation of this association may appear to succeed in Terraform but will not be reflected in Azure. In such cases, the association will not actually exist and subsequent Terraform operations may show unexpected behavior.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: NetworkSecurityPerimeterAssociationArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Manages a Network Security Perimeter Association.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure

        example = azure.core.ResourceGroup("example",
            name="example-resources",
            location="West Europe")
        example_analytics_workspace = azure.operationalinsights.AnalyticsWorkspace("example",
            name="example",
            location="West Europe",
            resource_group_name=example.name)
        example_network_security_perimeter = azure.network.NetworkSecurityPerimeter("example",
            name="example",
            resource_group_name=example.name,
            location="West Europe")
        example_network_security_perimeter_profile = azure.network.NetworkSecurityPerimeterProfile("example",
            name="example",
            network_security_perimeter_id=example_network_security_perimeter.id)
        example_network_security_perimeter_association = azure.network.NetworkSecurityPerimeterAssociation("example",
            name="example",
            access_mode="Enforced",
            network_security_perimeter_profile_id=example_network_security_perimeter_profile.id,
            resource_id=example_analytics_workspace.id)
        ```

        ## API Providers

        <!-- This section is generated, changes will be overwritten -->
        This resource uses the following Azure API Providers:

        * `Microsoft.Network` - 2025-01-01

        ## Import

        Network Security Perimeter Associations can be imported using the `resource id`, e.g.

        ```sh
        $ pulumi import azure:network/networkSecurityPerimeterAssociation:NetworkSecurityPerimeterAssociation example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-rg/providers/Microsoft.Network/networkSecurityPerimeters/example-nsp/resourceAssociations/example-assoc
        ```


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

            if access_mode is None and not opts.urn:
                raise TypeError("Missing required property 'access_mode'")
            __props__.__dict__["access_mode"] = access_mode
            __props__.__dict__["name"] = name
            if network_security_perimeter_profile_id is None and not opts.urn:
                raise TypeError("Missing required property 'network_security_perimeter_profile_id'")
            __props__.__dict__["network_security_perimeter_profile_id"] = network_security_perimeter_profile_id
            if resource_id is None and not opts.urn:
                raise TypeError("Missing required property 'resource_id'")
            __props__.__dict__["resource_id"] = resource_id
        super(NetworkSecurityPerimeterAssociation, __self__).__init__(
            'azure:network/networkSecurityPerimeterAssociation:NetworkSecurityPerimeterAssociation',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            access_mode: Optional[pulumi.Input[_builtins.str]] = None,
            name: Optional[pulumi.Input[_builtins.str]] = None,
            network_security_perimeter_profile_id: Optional[pulumi.Input[_builtins.str]] = None,
            resource_id: Optional[pulumi.Input[_builtins.str]] = None) -> 'NetworkSecurityPerimeterAssociation':
        """
        Get an existing NetworkSecurityPerimeterAssociation 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[_builtins.str] access_mode: Access mode for the associated resource on the Network Security Perimeter. Possible values are `Audit`, `Enforced`, and `Learning`.
        :param pulumi.Input[_builtins.str] name: The name which should be used for this Network Security Perimeter Association. Changing this forces a new Network Security Perimeter Association to be created.
        :param pulumi.Input[_builtins.str] network_security_perimeter_profile_id: The ID of the Network Security Perimeter Profile. Changing this forces a new Network Security Perimeter Association to be created.
        :param pulumi.Input[_builtins.str] resource_id: The ID of the associated resource. Changing this forces a new Network Security Perimeter Association to be created.
               
               > **Note:** A resource can only be associated with one Network Security Perimeter at a time.
               If the target resource is already associated with another Network Security Perimeter, the creation of this association may appear to succeed in Terraform but will not be reflected in Azure. In such cases, the association will not actually exist and subsequent Terraform operations may show unexpected behavior.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _NetworkSecurityPerimeterAssociationState.__new__(_NetworkSecurityPerimeterAssociationState)

        __props__.__dict__["access_mode"] = access_mode
        __props__.__dict__["name"] = name
        __props__.__dict__["network_security_perimeter_profile_id"] = network_security_perimeter_profile_id
        __props__.__dict__["resource_id"] = resource_id
        return NetworkSecurityPerimeterAssociation(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter(name="accessMode")
    def access_mode(self) -> pulumi.Output[_builtins.str]:
        """
        Access mode for the associated resource on the Network Security Perimeter. Possible values are `Audit`, `Enforced`, and `Learning`.
        """
        return pulumi.get(self, "access_mode")

    @_builtins.property
    @pulumi.getter
    def name(self) -> pulumi.Output[_builtins.str]:
        """
        The name which should be used for this Network Security Perimeter Association. Changing this forces a new Network Security Perimeter Association to be created.
        """
        return pulumi.get(self, "name")

    @_builtins.property
    @pulumi.getter(name="networkSecurityPerimeterProfileId")
    def network_security_perimeter_profile_id(self) -> pulumi.Output[_builtins.str]:
        """
        The ID of the Network Security Perimeter Profile. Changing this forces a new Network Security Perimeter Association to be created.
        """
        return pulumi.get(self, "network_security_perimeter_profile_id")

    @_builtins.property
    @pulumi.getter(name="resourceId")
    def resource_id(self) -> pulumi.Output[_builtins.str]:
        """
        The ID of the associated resource. Changing this forces a new Network Security Perimeter Association to be created.

        > **Note:** A resource can only be associated with one Network Security Perimeter at a time.
        If the target resource is already associated with another Network Security Perimeter, the creation of this association may appear to succeed in Terraform but will not be reflected in Azure. In such cases, the association will not actually exist and subsequent Terraform operations may show unexpected behavior.
        """
        return pulumi.get(self, "resource_id")

