# 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

__all__ = ['DiskPoolIscsiTargetLunArgs', 'DiskPoolIscsiTargetLun']

@pulumi.input_type
class DiskPoolIscsiTargetLunArgs:
    def __init__(__self__, *,
                 disk_pool_managed_disk_attachment_id: pulumi.Input[str],
                 iscsi_target_id: pulumi.Input[str],
                 name: Optional[pulumi.Input[str]] = None):
        """
        The set of arguments for constructing a DiskPoolIscsiTargetLun resource.
        :param pulumi.Input[str] disk_pool_managed_disk_attachment_id: The ID of the `compute.DiskPoolManagedDiskAttachment`. Changing this forces a new iSCSI Target LUN to be created.
        :param pulumi.Input[str] iscsi_target_id: The ID of the iSCSI Target. Changing this forces a new iSCSI Target LUN to be created.
        :param pulumi.Input[str] name: User defined name for iSCSI LUN. Supported characters include uppercase letters, lowercase letters, numbers, periods, underscores or hyphens. Name should end with an alphanumeric character. The length must be between `1` and `90`. Changing this forces a new iSCSI Target LUN to be created.
        """
        pulumi.set(__self__, "disk_pool_managed_disk_attachment_id", disk_pool_managed_disk_attachment_id)
        pulumi.set(__self__, "iscsi_target_id", iscsi_target_id)
        if name is not None:
            pulumi.set(__self__, "name", name)

    @property
    @pulumi.getter(name="diskPoolManagedDiskAttachmentId")
    def disk_pool_managed_disk_attachment_id(self) -> pulumi.Input[str]:
        """
        The ID of the `compute.DiskPoolManagedDiskAttachment`. Changing this forces a new iSCSI Target LUN to be created.
        """
        return pulumi.get(self, "disk_pool_managed_disk_attachment_id")

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

    @property
    @pulumi.getter(name="iscsiTargetId")
    def iscsi_target_id(self) -> pulumi.Input[str]:
        """
        The ID of the iSCSI Target. Changing this forces a new iSCSI Target LUN to be created.
        """
        return pulumi.get(self, "iscsi_target_id")

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

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[str]]:
        """
        User defined name for iSCSI LUN. Supported characters include uppercase letters, lowercase letters, numbers, periods, underscores or hyphens. Name should end with an alphanumeric character. The length must be between `1` and `90`. Changing this forces a new iSCSI Target LUN 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 _DiskPoolIscsiTargetLunState:
    def __init__(__self__, *,
                 disk_pool_managed_disk_attachment_id: Optional[pulumi.Input[str]] = None,
                 iscsi_target_id: Optional[pulumi.Input[str]] = None,
                 lun: Optional[pulumi.Input[int]] = None,
                 name: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering DiskPoolIscsiTargetLun resources.
        :param pulumi.Input[str] disk_pool_managed_disk_attachment_id: The ID of the `compute.DiskPoolManagedDiskAttachment`. Changing this forces a new iSCSI Target LUN to be created.
        :param pulumi.Input[str] iscsi_target_id: The ID of the iSCSI Target. Changing this forces a new iSCSI Target LUN to be created.
        :param pulumi.Input[int] lun: The Logical Unit Number of the iSCSI Target LUN.
        :param pulumi.Input[str] name: User defined name for iSCSI LUN. Supported characters include uppercase letters, lowercase letters, numbers, periods, underscores or hyphens. Name should end with an alphanumeric character. The length must be between `1` and `90`. Changing this forces a new iSCSI Target LUN to be created.
        """
        if disk_pool_managed_disk_attachment_id is not None:
            pulumi.set(__self__, "disk_pool_managed_disk_attachment_id", disk_pool_managed_disk_attachment_id)
        if iscsi_target_id is not None:
            pulumi.set(__self__, "iscsi_target_id", iscsi_target_id)
        if lun is not None:
            pulumi.set(__self__, "lun", lun)
        if name is not None:
            pulumi.set(__self__, "name", name)

    @property
    @pulumi.getter(name="diskPoolManagedDiskAttachmentId")
    def disk_pool_managed_disk_attachment_id(self) -> Optional[pulumi.Input[str]]:
        """
        The ID of the `compute.DiskPoolManagedDiskAttachment`. Changing this forces a new iSCSI Target LUN to be created.
        """
        return pulumi.get(self, "disk_pool_managed_disk_attachment_id")

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

    @property
    @pulumi.getter(name="iscsiTargetId")
    def iscsi_target_id(self) -> Optional[pulumi.Input[str]]:
        """
        The ID of the iSCSI Target. Changing this forces a new iSCSI Target LUN to be created.
        """
        return pulumi.get(self, "iscsi_target_id")

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

    @property
    @pulumi.getter
    def lun(self) -> Optional[pulumi.Input[int]]:
        """
        The Logical Unit Number of the iSCSI Target LUN.
        """
        return pulumi.get(self, "lun")

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

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[str]]:
        """
        User defined name for iSCSI LUN. Supported characters include uppercase letters, lowercase letters, numbers, periods, underscores or hyphens. Name should end with an alphanumeric character. The length must be between `1` and `90`. Changing this forces a new iSCSI Target LUN to be created.
        """
        return pulumi.get(self, "name")

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


class DiskPoolIscsiTargetLun(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 disk_pool_managed_disk_attachment_id: Optional[pulumi.Input[str]] = None,
                 iscsi_target_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        Manages an iSCSI Target lun.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure
        import pulumi_azuread as azuread

        example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
        example_virtual_network = azure.network.VirtualNetwork("exampleVirtualNetwork",
            resource_group_name=example_resource_group.name,
            location=example_resource_group.location,
            address_spaces=["10.0.0.0/16"])
        example_subnet = azure.network.Subnet("exampleSubnet",
            resource_group_name=example_resource_group.name,
            virtual_network_name=example_virtual_network.name,
            address_prefixes=["10.0.0.0/24"],
            delegations=[azure.network.SubnetDelegationArgs(
                name="diskspool",
                service_delegation=azure.network.SubnetDelegationServiceDelegationArgs(
                    actions=["Microsoft.Network/virtualNetworks/read"],
                    name="Microsoft.StoragePool/diskPools",
                ),
            )])
        example_disk_pool = azure.compute.DiskPool("exampleDiskPool",
            resource_group_name=example_resource_group.name,
            location=example_resource_group.location,
            subnet_id=example_subnet.id,
            zones=["1"],
            sku_name="Basic_B1")
        example_managed_disk = azure.compute.ManagedDisk("exampleManagedDisk",
            resource_group_name=example_resource_group.name,
            location=example_resource_group.location,
            create_option="Empty",
            storage_account_type="Premium_LRS",
            disk_size_gb=4,
            max_shares=2,
            zone="1")
        example_service_principal = azuread.get_service_principal(display_name="StoragePool Resource Provider")
        roles = [
            "Disk Pool Operator",
            "Virtual Machine Contributor",
        ]
        example_assignment = []
        for range in [{"value": i} for i in range(0, len(roles))]:
            example_assignment.append(azure.authorization.Assignment(f"exampleAssignment-{range['value']}",
                principal_id=example_service_principal.id,
                role_definition_name=roles[range["value"]],
                scope=example_managed_disk.id))
        example_disk_pool_managed_disk_attachment = azure.compute.DiskPoolManagedDiskAttachment("exampleDiskPoolManagedDiskAttachment",
            disk_pool_id=example_disk_pool.id,
            managed_disk_id=example_managed_disk.id,
            opts=pulumi.ResourceOptions(depends_on=[example_assignment]))
        example_disk_pool_iscsi_target = azure.compute.DiskPoolIscsiTarget("exampleDiskPoolIscsiTarget",
            acl_mode="Dynamic",
            disks_pool_id=example_disk_pool.id,
            target_iqn="iqn.2021-11.com.microsoft:test",
            opts=pulumi.ResourceOptions(depends_on=[example_disk_pool_managed_disk_attachment]))
        example_disk_pool_iscsi_target_lun = azure.compute.DiskPoolIscsiTargetLun("exampleDiskPoolIscsiTargetLun",
            iscsi_target_id=example_disk_pool_iscsi_target.id,
            disk_pool_managed_disk_attachment_id=example_disk_pool_managed_disk_attachment.id)
        ```

        ## Import

        iSCSI Target Luns can be imported using the `resource id`, e.g.

        ```sh
         $ pulumi import azure:compute/diskPoolIscsiTargetLun:DiskPoolIscsiTargetLun example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StoragePool/diskPools/diskPoolValue/iscsiTargets/iscsiTargetValue/lun|/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/disks/disk1
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] disk_pool_managed_disk_attachment_id: The ID of the `compute.DiskPoolManagedDiskAttachment`. Changing this forces a new iSCSI Target LUN to be created.
        :param pulumi.Input[str] iscsi_target_id: The ID of the iSCSI Target. Changing this forces a new iSCSI Target LUN to be created.
        :param pulumi.Input[str] name: User defined name for iSCSI LUN. Supported characters include uppercase letters, lowercase letters, numbers, periods, underscores or hyphens. Name should end with an alphanumeric character. The length must be between `1` and `90`. Changing this forces a new iSCSI Target LUN to be created.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: DiskPoolIscsiTargetLunArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Manages an iSCSI Target lun.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure
        import pulumi_azuread as azuread

        example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
        example_virtual_network = azure.network.VirtualNetwork("exampleVirtualNetwork",
            resource_group_name=example_resource_group.name,
            location=example_resource_group.location,
            address_spaces=["10.0.0.0/16"])
        example_subnet = azure.network.Subnet("exampleSubnet",
            resource_group_name=example_resource_group.name,
            virtual_network_name=example_virtual_network.name,
            address_prefixes=["10.0.0.0/24"],
            delegations=[azure.network.SubnetDelegationArgs(
                name="diskspool",
                service_delegation=azure.network.SubnetDelegationServiceDelegationArgs(
                    actions=["Microsoft.Network/virtualNetworks/read"],
                    name="Microsoft.StoragePool/diskPools",
                ),
            )])
        example_disk_pool = azure.compute.DiskPool("exampleDiskPool",
            resource_group_name=example_resource_group.name,
            location=example_resource_group.location,
            subnet_id=example_subnet.id,
            zones=["1"],
            sku_name="Basic_B1")
        example_managed_disk = azure.compute.ManagedDisk("exampleManagedDisk",
            resource_group_name=example_resource_group.name,
            location=example_resource_group.location,
            create_option="Empty",
            storage_account_type="Premium_LRS",
            disk_size_gb=4,
            max_shares=2,
            zone="1")
        example_service_principal = azuread.get_service_principal(display_name="StoragePool Resource Provider")
        roles = [
            "Disk Pool Operator",
            "Virtual Machine Contributor",
        ]
        example_assignment = []
        for range in [{"value": i} for i in range(0, len(roles))]:
            example_assignment.append(azure.authorization.Assignment(f"exampleAssignment-{range['value']}",
                principal_id=example_service_principal.id,
                role_definition_name=roles[range["value"]],
                scope=example_managed_disk.id))
        example_disk_pool_managed_disk_attachment = azure.compute.DiskPoolManagedDiskAttachment("exampleDiskPoolManagedDiskAttachment",
            disk_pool_id=example_disk_pool.id,
            managed_disk_id=example_managed_disk.id,
            opts=pulumi.ResourceOptions(depends_on=[example_assignment]))
        example_disk_pool_iscsi_target = azure.compute.DiskPoolIscsiTarget("exampleDiskPoolIscsiTarget",
            acl_mode="Dynamic",
            disks_pool_id=example_disk_pool.id,
            target_iqn="iqn.2021-11.com.microsoft:test",
            opts=pulumi.ResourceOptions(depends_on=[example_disk_pool_managed_disk_attachment]))
        example_disk_pool_iscsi_target_lun = azure.compute.DiskPoolIscsiTargetLun("exampleDiskPoolIscsiTargetLun",
            iscsi_target_id=example_disk_pool_iscsi_target.id,
            disk_pool_managed_disk_attachment_id=example_disk_pool_managed_disk_attachment.id)
        ```

        ## Import

        iSCSI Target Luns can be imported using the `resource id`, e.g.

        ```sh
         $ pulumi import azure:compute/diskPoolIscsiTargetLun:DiskPoolIscsiTargetLun example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StoragePool/diskPools/diskPoolValue/iscsiTargets/iscsiTargetValue/lun|/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/disks/disk1
        ```

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

            if disk_pool_managed_disk_attachment_id is None and not opts.urn:
                raise TypeError("Missing required property 'disk_pool_managed_disk_attachment_id'")
            __props__.__dict__["disk_pool_managed_disk_attachment_id"] = disk_pool_managed_disk_attachment_id
            if iscsi_target_id is None and not opts.urn:
                raise TypeError("Missing required property 'iscsi_target_id'")
            __props__.__dict__["iscsi_target_id"] = iscsi_target_id
            __props__.__dict__["name"] = name
            __props__.__dict__["lun"] = None
        super(DiskPoolIscsiTargetLun, __self__).__init__(
            'azure:compute/diskPoolIscsiTargetLun:DiskPoolIscsiTargetLun',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            disk_pool_managed_disk_attachment_id: Optional[pulumi.Input[str]] = None,
            iscsi_target_id: Optional[pulumi.Input[str]] = None,
            lun: Optional[pulumi.Input[int]] = None,
            name: Optional[pulumi.Input[str]] = None) -> 'DiskPoolIscsiTargetLun':
        """
        Get an existing DiskPoolIscsiTargetLun 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] disk_pool_managed_disk_attachment_id: The ID of the `compute.DiskPoolManagedDiskAttachment`. Changing this forces a new iSCSI Target LUN to be created.
        :param pulumi.Input[str] iscsi_target_id: The ID of the iSCSI Target. Changing this forces a new iSCSI Target LUN to be created.
        :param pulumi.Input[int] lun: The Logical Unit Number of the iSCSI Target LUN.
        :param pulumi.Input[str] name: User defined name for iSCSI LUN. Supported characters include uppercase letters, lowercase letters, numbers, periods, underscores or hyphens. Name should end with an alphanumeric character. The length must be between `1` and `90`. Changing this forces a new iSCSI Target LUN to be created.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _DiskPoolIscsiTargetLunState.__new__(_DiskPoolIscsiTargetLunState)

        __props__.__dict__["disk_pool_managed_disk_attachment_id"] = disk_pool_managed_disk_attachment_id
        __props__.__dict__["iscsi_target_id"] = iscsi_target_id
        __props__.__dict__["lun"] = lun
        __props__.__dict__["name"] = name
        return DiskPoolIscsiTargetLun(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="diskPoolManagedDiskAttachmentId")
    def disk_pool_managed_disk_attachment_id(self) -> pulumi.Output[str]:
        """
        The ID of the `compute.DiskPoolManagedDiskAttachment`. Changing this forces a new iSCSI Target LUN to be created.
        """
        return pulumi.get(self, "disk_pool_managed_disk_attachment_id")

    @property
    @pulumi.getter(name="iscsiTargetId")
    def iscsi_target_id(self) -> pulumi.Output[str]:
        """
        The ID of the iSCSI Target. Changing this forces a new iSCSI Target LUN to be created.
        """
        return pulumi.get(self, "iscsi_target_id")

    @property
    @pulumi.getter
    def lun(self) -> pulumi.Output[int]:
        """
        The Logical Unit Number of the iSCSI Target LUN.
        """
        return pulumi.get(self, "lun")

    @property
    @pulumi.getter
    def name(self) -> pulumi.Output[str]:
        """
        User defined name for iSCSI LUN. Supported characters include uppercase letters, lowercase letters, numbers, periods, underscores or hyphens. Name should end with an alphanumeric character. The length must be between `1` and `90`. Changing this forces a new iSCSI Target LUN to be created.
        """
        return pulumi.get(self, "name")

