|
15 | 15 | import com.azure.resourcemanager.resources.fluentcore.model.Refreshable;
|
16 | 16 | import com.azure.resourcemanager.resources.fluentcore.model.Updatable;
|
17 | 17 | import com.azure.resourcemanager.storage.models.StorageAccount;
|
| 18 | + |
| 19 | +import java.util.List; |
18 | 20 | import java.util.Set;
|
19 | 21 | import reactor.core.publisher.Mono;
|
20 | 22 |
|
@@ -44,12 +46,23 @@ public interface Disk extends GroupableResource<ComputeManager, DiskInner>, Refr
|
44 | 46 |
|
45 | 47 | /**
|
46 | 48 | * Gets the resource ID of the virtual machine this disk is attached to.
|
| 49 | + * <p> |
| 50 | + * If the disk can be shared, use {@link #virtualMachineIds()} to get the list of all virtual machines. |
47 | 51 | *
|
48 | 52 | * @return the resource ID of the virtual machine this disk is attached to, or null if the disk is in a detached
|
49 | 53 | * state
|
50 | 54 | */
|
51 | 55 | String virtualMachineId();
|
52 | 56 |
|
| 57 | + /** |
| 58 | + * Gets the list of the virtual machines that this disk is attached to. |
| 59 | + * <p> |
| 60 | + * A disk could be attached to multiple virtual machines. |
| 61 | + * |
| 62 | + * @return the resource ID of the virtual machines this disk is attached to |
| 63 | + */ |
| 64 | + List<String> virtualMachineIds(); |
| 65 | + |
53 | 66 | /**
|
54 | 67 | * Gets disk size in GB.
|
55 | 68 | *
|
@@ -153,6 +166,41 @@ public interface Disk extends GroupableResource<ComputeManager, DiskInner>, Refr
|
153 | 166 | */
|
154 | 167 | PublicNetworkAccess publicNetworkAccess();
|
155 | 168 |
|
| 169 | + /** |
| 170 | + * Gets the number of IOPS allowed for this disk. |
| 171 | + * |
| 172 | + * @return the number of IOPS allowed for this disk. |
| 173 | + */ |
| 174 | + Long diskIopsReadWrite(); |
| 175 | + |
| 176 | + /** |
| 177 | + * Gets the throughput (MBps) allowed for this disk. |
| 178 | + * |
| 179 | + * @return the throughput (MBps) allowed for this disk. |
| 180 | + */ |
| 181 | + Long diskMBpsReadWrite(); |
| 182 | + |
| 183 | + /** |
| 184 | + * Gets the total number of IOPS allowed across all VMs mounting this shared disk as read-only. |
| 185 | + * |
| 186 | + * @return the total number of IOPS allowed for this shared read-only disk. |
| 187 | + */ |
| 188 | + Long diskIopsReadOnly(); |
| 189 | + |
| 190 | + /** |
| 191 | + * Gets the total throughput (MBps) allowed across all VMs mounting this shared disk as read-only. |
| 192 | + * |
| 193 | + * @return the total throughput (MBps) allowed for this shared read-only disk. |
| 194 | + */ |
| 195 | + Long diskMBpsReadOnly(); |
| 196 | + |
| 197 | + /** |
| 198 | + * Gets the maximum number of VMs that can attach to the disk at the same time. |
| 199 | + * |
| 200 | + * @return the maximum number of VMs that can attach to the disk at the same time. |
| 201 | + */ |
| 202 | + int maximumShares(); |
| 203 | + |
156 | 204 | /** The entirety of the managed disk definition. */
|
157 | 205 | interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithDiskSource,
|
158 | 206 | DefinitionStages.WithWindowsDiskSource, DefinitionStages.WithLinuxDiskSource, DefinitionStages.WithData,
|
@@ -521,13 +569,63 @@ interface WithPublicNetworkAccess {
|
521 | 569 | WithCreate disablePublicNetworkAccess();
|
522 | 570 | }
|
523 | 571 |
|
| 572 | + /** The stage of disk definition allowing to configure IOPS and throughput settings. */ |
| 573 | + interface WithIopsThroughput { |
| 574 | + /** |
| 575 | + * Sets the number of IOPS allowed for this disk. |
| 576 | + * It is only settable for UltraSSD disks or Premium SSD v2 disks. |
| 577 | + * |
| 578 | + * @param diskIopsReadWrite The number of IOPS allowed for this disk. One operation can transfer between 4k and 256k bytes. |
| 579 | + * @return the next stage of the definition |
| 580 | + */ |
| 581 | + WithCreate withIopsReadWrite(long diskIopsReadWrite); |
| 582 | + |
| 583 | + /** |
| 584 | + * Sets the throughput (MBps) allowed for this disk. |
| 585 | + * It is only settable for UltraSSD disks or Premium SSD v2 disks. |
| 586 | + * |
| 587 | + * @param diskMBpsReadWrite The bandwidth allowed for this disk. |
| 588 | + * @return the next stage of the definition |
| 589 | + */ |
| 590 | + WithCreate withMBpsReadWrite(long diskMBpsReadWrite); |
| 591 | + |
| 592 | + /** |
| 593 | + * Sets the total number of IOPS allowed across all VMs mounting this shared disk as read-only. |
| 594 | + * It is only settable for UltraSSD disks or Premium SSD v2 disks. |
| 595 | + * |
| 596 | + * @param diskIopsReadOnly The total number of IOPS allowed across all VMs mounting this shared disk as read-only. One operation can transfer between 4k and 256k bytes. |
| 597 | + * @return the next stage of the definition |
| 598 | + */ |
| 599 | + WithCreate withIopsReadOnly(long diskIopsReadOnly); |
| 600 | + |
| 601 | + /** |
| 602 | + * Sets the total throughput (MBps) allowed across all VMs mounting this shared disk as read-only. |
| 603 | + * It is only settable for UltraSSD disks or Premium SSD v2 disks. |
| 604 | + * |
| 605 | + * @param diskMBpsReadOnly The total throughput (MBps) allowed across all VMs mounting this shared disk as read-only. |
| 606 | + * @return the next stage of the definition |
| 607 | + */ |
| 608 | + WithCreate withMBpsReadOnly(long diskMBpsReadOnly); |
| 609 | + } |
| 610 | + |
| 611 | + /** The stage of disk definition allowing to configure managed disk sharing settings. */ |
| 612 | + interface WithDiskSharing { |
| 613 | + /** |
| 614 | + * Sets the maximum number of VMs that can attach to the disk at the same time. |
| 615 | + * |
| 616 | + * @param maximumShares the maximum number of VMs that can attach to the disk at the same time |
| 617 | + * @return the next stage of the definition |
| 618 | + */ |
| 619 | + WithCreate withMaximumShares(int maximumShares); |
| 620 | + } |
| 621 | + |
524 | 622 | /**
|
525 | 623 | * The stage of the definition which contains all the minimum required inputs for the resource to be created,
|
526 | 624 | * but also allows for any other optional settings to be specified.
|
527 | 625 | */
|
528 | 626 | interface WithCreate extends Creatable<Disk>, Resource.DefinitionWithTags<Disk.DefinitionStages.WithCreate>,
|
529 | 627 | WithSku, WithAvailabilityZone, WithDiskEncryption, WithHibernationSupport, WithLogicalSectorSize,
|
530 |
| - WithHyperVGeneration, WithPublicNetworkAccess { |
| 628 | + WithHyperVGeneration, WithPublicNetworkAccess, WithIopsThroughput, WithDiskSharing { |
531 | 629 |
|
532 | 630 | /**
|
533 | 631 | * Begins creating the disk resource.
|
@@ -628,11 +726,62 @@ interface WithPublicNetworkAccess {
|
628 | 726 | */
|
629 | 727 | Update disablePublicNetworkAccess();
|
630 | 728 | }
|
| 729 | + |
| 730 | + /** The stage of disk update allowing to configure IOPS and throughput settings. */ |
| 731 | + interface WithIopsThroughput { |
| 732 | + /** |
| 733 | + * Sets the number of IOPS allowed for this disk. |
| 734 | + * It is only settable for UltraSSD disks or Premium SSD v2 disks. |
| 735 | + * |
| 736 | + * @param diskIopsReadWrite The number of IOPS allowed for this disk. One operation can transfer between 4k and 256k bytes. |
| 737 | + * @return the next stage of the definition |
| 738 | + */ |
| 739 | + Update withIopsReadWrite(long diskIopsReadWrite); |
| 740 | + |
| 741 | + /** |
| 742 | + * Sets the throughput (MBps) allowed for this disk. |
| 743 | + * It is only settable for UltraSSD disks or Premium SSD v2 disks. |
| 744 | + * |
| 745 | + * @param diskMBpsReadWrite The bandwidth allowed for this disk. |
| 746 | + * @return the next stage of the definition |
| 747 | + */ |
| 748 | + Update withMBpsReadWrite(long diskMBpsReadWrite); |
| 749 | + |
| 750 | + /** |
| 751 | + * Sets the total number of IOPS allowed across all VMs mounting this shared disk as read-only. |
| 752 | + * It is only settable for UltraSSD disks or Premium SSD v2 disks. |
| 753 | + * |
| 754 | + * @param diskIopsReadOnly The total number of IOPS allowed across all VMs mounting this shared disk as read-only. One operation can transfer between 4k and 256k bytes. |
| 755 | + * @return the next stage of the definition |
| 756 | + */ |
| 757 | + Update withIopsReadOnly(long diskIopsReadOnly); |
| 758 | + |
| 759 | + /** |
| 760 | + * Sets the total throughput (MBps) allowed across all VMs mounting this shared disk as read-only. |
| 761 | + * It is only settable for UltraSSD disks or Premium SSD v2 disks. |
| 762 | + * |
| 763 | + * @param diskMBpsReadOnly The total throughput (MBps) allowed across all VMs mounting this shared disk as read-only. |
| 764 | + * @return the next stage of the definition |
| 765 | + */ |
| 766 | + Update withMBpsReadOnly(long diskMBpsReadOnly); |
| 767 | + } |
| 768 | + |
| 769 | + /** The stage of disk update allowing to configure managed disk sharing settings. */ |
| 770 | + interface WithDiskSharing { |
| 771 | + /** |
| 772 | + * Sets the maximum number of VMs that can attach to the disk at the same time. |
| 773 | + * |
| 774 | + * @param maximumShares the maximum number of VMs that can attach to the disk at the same time |
| 775 | + * @return the next stage of the update |
| 776 | + */ |
| 777 | + Update withMaximumShares(int maximumShares); |
| 778 | + } |
631 | 779 | }
|
632 | 780 |
|
633 | 781 | /** The template for an update operation, containing all the settings that can be modified. */
|
634 | 782 | interface Update extends Appliable<Disk>, Resource.UpdateWithTags<Disk.Update>, UpdateStages.WithSku,
|
635 | 783 | UpdateStages.WithSize, UpdateStages.WithOSSettings, UpdateStages.WithDiskEncryption,
|
636 |
| - UpdateStages.WithHibernationSupport, UpdateStages.WithHyperVGeneration, UpdateStages.WithPublicNetworkAccess { |
| 784 | + UpdateStages.WithHibernationSupport, UpdateStages.WithHyperVGeneration, UpdateStages.WithPublicNetworkAccess, |
| 785 | + UpdateStages.WithIopsThroughput, UpdateStages.WithDiskSharing { |
637 | 786 | }
|
638 | 787 | }
|
0 commit comments