# 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__ = ['DiskPoolManagedDiskAttachmentArgs', 'DiskPoolManagedDiskAttachment']

@pulumi.input_type
class DiskPoolManagedDiskAttachmentArgs:
    def __init__(__self__, *,
                 disk_pool_id: pulumi.Input[str],
                 managed_disk_id: pulumi.Input[str]):
        """
        The set of arguments for constructing a DiskPoolManagedDiskAttachment resource.
        :param pulumi.Input[str] disk_pool_id: The ID of the Disk Pool. Changing this forces a new Disk Pool Managed Disk Attachment to be created.
        :param pulumi.Input[str] managed_disk_id: The ID of the Managed Disk. Changing this forces a new Disks Pool Managed Disk Attachment to be created.
        """
        pulumi.set(__self__, "disk_pool_id", disk_pool_id)
        pulumi.set(__self__, "managed_disk_id", managed_disk_id)

    @property
    @pulumi.getter(name="diskPoolId")
    def disk_pool_id(self) -> pulumi.Input[str]:
        """
        The ID of the Disk Pool. Changing this forces a new Disk Pool Managed Disk Attachment to be created.
        """
        return pulumi.get(self, "disk_pool_id")

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

    @property
    @pulumi.getter(name="managedDiskId")
    def managed_disk_id(self) -> pulumi.Input[str]:
        """
        The ID of the Managed Disk. Changing this forces a new Disks Pool Managed Disk Attachment to be created.
        """
        return pulumi.get(self, "managed_disk_id")

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


@pulumi.input_type
class _DiskPoolManagedDiskAttachmentState:
    def __init__(__self__, *,
                 disk_pool_id: Optional[pulumi.Input[str]] = None,
                 managed_disk_id: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering DiskPoolManagedDiskAttachment resources.
        :param pulumi.Input[str] disk_pool_id: The ID of the Disk Pool. Changing this forces a new Disk Pool Managed Disk Attachment to be created.
        :param pulumi.Input[str] managed_disk_id: The ID of the Managed Disk. Changing this forces a new Disks Pool Managed Disk Attachment to be created.
        """
        if disk_pool_id is not None:
            pulumi.set(__self__, "disk_pool_id", disk_pool_id)
        if managed_disk_id is not None:
            pulumi.set(__self__, "managed_disk_id", managed_disk_id)

    @property
    @pulumi.getter(name="diskPoolId")
    def disk_pool_id(self) -> Optional[pulumi.Input[str]]:
        """
        The ID of the Disk Pool. Changing this forces a new Disk Pool Managed Disk Attachment to be created.
        """
        return pulumi.get(self, "disk_pool_id")

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

    @property
    @pulumi.getter(name="managedDiskId")
    def managed_disk_id(self) -> Optional[pulumi.Input[str]]:
        """
        The ID of the Managed Disk. Changing this forces a new Disks Pool Managed Disk Attachment to be created.
        """
        return pulumi.get(self, "managed_disk_id")

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


class DiskPoolManagedDiskAttachment(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 disk_pool_id: Optional[pulumi.Input[str]] = None,
                 managed_disk_id: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        Manages a Disk Pool Managed Disk Attachment.

        !> **Note:** Azure are officially [halting](https://learn.microsoft.com/en-us/azure/azure-vmware/attach-disk-pools-to-azure-vmware-solution-hosts?tabs=azure-cli) the preview of Azure Disk Pools, and it **will not** be made generally available. New customers will not be able to register the Microsoft.StoragePool resource provider on their subscription and deploy new Disk Pools. Existing subscriptions registered with Microsoft.StoragePool may continue to deploy and manage disk pools for the time being.

        > **Note:** Must be either a premium SSD, standard SSD, or an ultra disk in the same region and availability zone as the disk pool.

        > **Note:** Ultra disks must have a disk sector size of 512 bytes.

        > **Note:** Must be a shared disk, with a maxShares value of two or greater.

        > **Note:** You must provide the StoragePool resource provider RBAC permissions to the disks that will be added to the disk pool.

        ## 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]))
        ```

        ## Import

        Disks Pool Managed Disk Attachments can be imported using the `resource id`, e.g.

        ```sh
         $ pulumi import azure:compute/diskPoolManagedDiskAttachment:DiskPoolManagedDiskAttachment example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.StoragePool/diskPools/storagePool1/managedDisks|/subscriptions/00000000-0000-0000-0000-000000000000/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_id: The ID of the Disk Pool. Changing this forces a new Disk Pool Managed Disk Attachment to be created.
        :param pulumi.Input[str] managed_disk_id: The ID of the Managed Disk. Changing this forces a new Disks Pool Managed Disk Attachment to be created.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: DiskPoolManagedDiskAttachmentArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Manages a Disk Pool Managed Disk Attachment.

        !> **Note:** Azure are officially [halting](https://learn.microsoft.com/en-us/azure/azure-vmware/attach-disk-pools-to-azure-vmware-solution-hosts?tabs=azure-cli) the preview of Azure Disk Pools, and it **will not** be made generally available. New customers will not be able to register the Microsoft.StoragePool resource provider on their subscription and deploy new Disk Pools. Existing subscriptions registered with Microsoft.StoragePool may continue to deploy and manage disk pools for the time being.

        > **Note:** Must be either a premium SSD, standard SSD, or an ultra disk in the same region and availability zone as the disk pool.

        > **Note:** Ultra disks must have a disk sector size of 512 bytes.

        > **Note:** Must be a shared disk, with a maxShares value of two or greater.

        > **Note:** You must provide the StoragePool resource provider RBAC permissions to the disks that will be added to the disk pool.

        ## 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]))
        ```

        ## Import

        Disks Pool Managed Disk Attachments can be imported using the `resource id`, e.g.

        ```sh
         $ pulumi import azure:compute/diskPoolManagedDiskAttachment:DiskPoolManagedDiskAttachment example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.StoragePool/diskPools/storagePool1/managedDisks|/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.Compute/disks/disk1
        ```

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

            if disk_pool_id is None and not opts.urn:
                raise TypeError("Missing required property 'disk_pool_id'")
            __props__.__dict__["disk_pool_id"] = disk_pool_id
            if managed_disk_id is None and not opts.urn:
                raise TypeError("Missing required property 'managed_disk_id'")
            __props__.__dict__["managed_disk_id"] = managed_disk_id
        super(DiskPoolManagedDiskAttachment, __self__).__init__(
            'azure:compute/diskPoolManagedDiskAttachment:DiskPoolManagedDiskAttachment',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            disk_pool_id: Optional[pulumi.Input[str]] = None,
            managed_disk_id: Optional[pulumi.Input[str]] = None) -> 'DiskPoolManagedDiskAttachment':
        """
        Get an existing DiskPoolManagedDiskAttachment 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_id: The ID of the Disk Pool. Changing this forces a new Disk Pool Managed Disk Attachment to be created.
        :param pulumi.Input[str] managed_disk_id: The ID of the Managed Disk. Changing this forces a new Disks Pool Managed Disk Attachment to be created.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _DiskPoolManagedDiskAttachmentState.__new__(_DiskPoolManagedDiskAttachmentState)

        __props__.__dict__["disk_pool_id"] = disk_pool_id
        __props__.__dict__["managed_disk_id"] = managed_disk_id
        return DiskPoolManagedDiskAttachment(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="diskPoolId")
    def disk_pool_id(self) -> pulumi.Output[str]:
        """
        The ID of the Disk Pool. Changing this forces a new Disk Pool Managed Disk Attachment to be created.
        """
        return pulumi.get(self, "disk_pool_id")

    @property
    @pulumi.getter(name="managedDiskId")
    def managed_disk_id(self) -> pulumi.Output[str]:
        """
        The ID of the Managed Disk. Changing this forces a new Disks Pool Managed Disk Attachment to be created.
        """
        return pulumi.get(self, "managed_disk_id")

