use of com.microsoft.azure.management.compute.VirtualMachineScaleSetDataDisk in project azure-sdk-for-java by Azure.
the class VirtualMachineScaleSetImpl method withNewDataDisk.
@Override
public VirtualMachineScaleSetImpl withNewDataDisk(int sizeInGB) {
throwIfManagedDiskDisabled(ManagedUnmanagedDiskErrors.VMSS_BOTH_UNMANAGED_AND_MANAGED_DISK_NOT_ALLOWED);
this.managedDataDisks.implicitDisksToAssociate.add(new VirtualMachineScaleSetDataDisk().withLun(-1).withDiskSizeGB(sizeInGB));
return this;
}
use of com.microsoft.azure.management.compute.VirtualMachineScaleSetDataDisk in project azure-sdk-for-java by Azure.
the class VirtualMachineScaleSetImpl method withNewDataDiskFromImage.
@Override
public VirtualMachineScaleSetImpl withNewDataDiskFromImage(int imageLun, int newSizeInGB, CachingTypes cachingType, StorageAccountTypes storageAccountType) {
VirtualMachineScaleSetManagedDiskParameters managedDiskParameters = new VirtualMachineScaleSetManagedDiskParameters();
managedDiskParameters.withStorageAccountType(storageAccountType);
this.managedDataDisks.newDisksFromImage.add(new VirtualMachineScaleSetDataDisk().withLun(imageLun).withDiskSizeGB(newSizeInGB).withManagedDisk(managedDiskParameters).withCaching(cachingType));
return this;
}
use of com.microsoft.azure.management.compute.VirtualMachineScaleSetDataDisk in project azure-sdk-for-java by Azure.
the class VirtualMachineScaleSetUnmanagedDataDiskImpl method setDataDisksDefaults.
protected static void setDataDisksDefaults(List<VirtualMachineScaleSetDataDisk> dataDisks, String namePrefix) {
if (dataDisks == null) {
return;
}
List<Integer> usedLuns = new ArrayList<>();
for (VirtualMachineScaleSetDataDisk dataDisk : dataDisks) {
if (dataDisk.lun() != -1) {
usedLuns.add(dataDisk.lun());
}
}
for (VirtualMachineScaleSetDataDisk dataDisk : dataDisks) {
if (dataDisk.lun() == -1) {
Integer i = 0;
while (usedLuns.contains(i)) {
i++;
}
dataDisk.withLun(i);
usedLuns.add(i);
}
if (dataDisk.name() == null) {
dataDisk.withName(namePrefix + "-data-disk-" + dataDisk.lun());
}
if (dataDisk.caching() == null) {
dataDisk.withCaching(CachingTypes.READ_WRITE);
}
}
}
use of com.microsoft.azure.management.compute.VirtualMachineScaleSetDataDisk in project azure-sdk-for-java by Azure.
the class VirtualMachineScaleSetUnmanagedDataDiskImpl method prepareDataDisk.
protected static VirtualMachineScaleSetUnmanagedDataDiskImpl prepareDataDisk(String name, VirtualMachineScaleSetImpl parent) {
VirtualMachineScaleSetDataDisk dataDiskInner = new VirtualMachineScaleSetDataDisk();
dataDiskInner.withLun(-1).withName(name);
return new VirtualMachineScaleSetUnmanagedDataDiskImpl(dataDiskInner, parent);
}
use of com.microsoft.azure.management.compute.VirtualMachineScaleSetDataDisk in project azure-sdk-for-java by Azure.
the class VirtualMachineScaleSetImpl method withNewDataDisk.
@Override
public VirtualMachineScaleSetImpl withNewDataDisk(int sizeInGB, int lun, CachingTypes cachingType, StorageAccountTypes storageAccountType) {
throwIfManagedDiskDisabled(ManagedUnmanagedDiskErrors.VMSS_BOTH_UNMANAGED_AND_MANAGED_DISK_NOT_ALLOWED);
VirtualMachineScaleSetManagedDiskParameters managedDiskParameters = new VirtualMachineScaleSetManagedDiskParameters();
managedDiskParameters.withStorageAccountType(storageAccountType);
this.managedDataDisks.implicitDisksToAssociate.add(new VirtualMachineScaleSetDataDisk().withLun(lun).withDiskSizeGB(sizeInGB).withCaching(cachingType).withManagedDisk(managedDiskParameters));
return this;
}
Aggregations