Example #1
0
 public static ManagedDiskParameters GetReference(
     this IEngine engine, ResourceConfig <Disk> disk, StorageAccountTypes storageAccountTypes)
 => new ManagedDiskParameters
 {
     Id = engine.GetId(disk),
     StorageAccountType = storageAccountTypes
 };
 ///GENMHASH:26BC80239F0CCAAB14CDBC15A85351B8:5C4E68981DCB985DABC30CE2B145CC62
 public DiskImpl WithSku(DiskSkuTypes sku)
 {
     Inner.Sku = new DiskSku
     {
         Name = StorageAccountTypes.Parse(sku.AccountType.Value)
     };
     return(this);
 }
Example #3
0
 ///GENMHASH:F792F6C8C594AA68FA7A0FCA92F55B55:A57B8C47BCE45BC6F3DA10CAF14C67BE
 public DiskSkuTypes Sku()
 {
     if (Inner.Sku != null && Inner.Sku.Name != null && Inner.Sku.Name != null)
     {
         return(DiskSkuTypes.FromStorageAccountType(StorageAccountTypes.Parse(Inner.Sku.Name)));
     }
     return(null);
 }
 ///GENMHASH:529D413DA27B62CF8FA74DD34751A761:2AB50F106A2C0F2D00579F7B1825D8B0
 public StorageAccountTypes StorageAccountType()
 {
     if (Inner.ManagedDisk == null || Inner.ManagedDisk.StorageAccountType == null)
     {
         return(null);
     }
     return(StorageAccountTypes.Parse(Inner.ManagedDisk.StorageAccountType));
 }
Example #5
0
        internal static string ToSerializedValue(this StorageAccountTypes value)
        {
            switch (value)
            {
            case StorageAccountTypes.StandardLRS:
                return("Standard_LRS");

            case StorageAccountTypes.PremiumLRS:
                return("Premium_LRS");
            }
            return(null);
        }
 ///GENMHASH:46AD705474F82EB01989BDC537143CDA:E24CCAC647CB1E84A09989E367AC3866
 public IReadOnlyList <Models.DiskSkuTypes> UnsupportedDiskTypes()
 {
     if (this.Inner.Disallowed == null || this.Inner.Disallowed.DiskTypes == null)
     {
         return(new List <Models.DiskSkuTypes>());
     }
     else
     {
         List <DiskSkuTypes> diskTypes = new List <DiskSkuTypes>();
         foreach (var diskTypeStr in this.Inner.Disallowed.DiskTypes)
         {
             diskTypes.Add(DiskSkuTypes.FromStorageAccountType(StorageAccountTypes.Parse(diskTypeStr)));
         }
         return(diskTypes);
     }
 }
        public VirtualMachineScaleSetVM.Update.IUpdate WithExistingDataDisk(IDisk dataDisk, int lun, CachingTypes cachingType, StorageAccountTypes storageAccountType)
        {
            if (!IsManagedDiskEnabled())
            {
                throw new System.InvalidOperationException(ManagedUnmanagedDiskErrors.VM_Both_Unmanaged_And_Managed_Disk_Not_Allowed);
            }
            if (dataDisk.Inner.DiskState != DiskState.Unattached)
            {
                throw new System.InvalidOperationException("Disk need to be in unattached state");
            }

            DataDisk attachDataDisk = new DataDisk
            {
                CreateOption = DiskCreateOptionTypes.Attach,
                Lun          = lun,
                Caching      = cachingType,
                ManagedDisk  = new ManagedDiskParametersInner
                {
                    StorageAccountType = storageAccountType,
                    Id = dataDisk.Id
                }
            };

            WithExistingDataDisk(attachDataDisk, lun);
            return(this);
        }
 public VirtualMachineScaleSetVM.Update.IUpdate WithExistingDataDisk(IDisk disk, int lun, CachingTypes cachingType)
 {
     return(WithExistingDataDisk(disk, lun, cachingType, StorageAccountTypes.Parse(disk.Sku.AccountType.ToString())));
 }