/** * Creates a custom value for VirtualMachineSizeTypes. * @param sku the SKU */ public VirtualMachineScaleSetSkuTypes(Sku sku) { // TODO: This constructor should really be private // Store Sku copy since original user provided sku can be modified // by the user. // this.sku = createCopy(sku); if (this.sku.tier() == null) { this.value = this.sku.name(); } else { this.value = this.sku.name() + '_' + this.sku.tier(); } VALUES_BY_NAME.put(this.value.toLowerCase(), this); }
@Override public int capacity() { return Utils.toPrimitiveInt(this.inner().sku().capacity()); }
@Override public VirtualMachineScaleSetImpl withCapacity(int capacity) { this.inner() .sku().withCapacity(new Long(capacity)); return this; }
/** * Creates a custom value for VirtualMachineSizeTypes. * @param sku the SKU */ public VirtualMachineScaleSetSkuTypes(Sku sku) { // TODO: This constructor should really be private // Store Sku copy since original user provided sku can be modified // by the user. // this.sku = createCopy(sku); if (this.sku.tier() == null) { this.value = this.sku.name(); } else { this.value = this.sku.name() + '_' + this.sku.tier(); } VALUES_BY_NAME.put(this.value.toLowerCase(), this); }
@Override public int capacity() { return Utils.toPrimitiveInt(this.inner().sku().capacity()); }
@Override public VirtualMachineScaleSetImpl withCapacity(int capacity) { this.inner() .sku().withCapacity(new Long(capacity)); return this; }
/** * Parses into a VMSS SKU type and creates a new VMSS SKU type instance if not found among the existing ones. * @param skuName a SKU name * @param skuTier a SKU tier * @return a VMSS SKU type */ public static VirtualMachineScaleSetSkuTypes fromSkuNameAndTier(String skuName, String skuTier) { return fromSku(new Sku().withName(skuName).withTier(skuTier)); }
/** * Parses a SKU into a VMSS SKU type and creates a new VirtualMachineScaleSetSkuType instance if not found among the existing ones. * * @param sku a VMSS SKU * @return the parsed or created VMSS SKU type */ public static VirtualMachineScaleSetSkuTypes fromSku(Sku sku) { if (sku == null) { return null; } String nameToLookFor = sku.name(); if (sku.tier() != null) { nameToLookFor += '_' + sku.tier(); } VirtualMachineScaleSetSkuTypes result = VALUES_BY_NAME.get(nameToLookFor.toLowerCase()); if (result != null) { return result; } else { return new VirtualMachineScaleSetSkuTypes(sku); } }
@Override public VirtualMachineSizeTypes size() { if (this.inner().hardwareProfile() != null && this.inner().hardwareProfile().vmSize() != null) { return this.inner().hardwareProfile().vmSize(); } if (this.sku() != null && this.sku().name() != null) { return VirtualMachineSizeTypes.fromString(this.sku().name()); } return null; }
return; if (this.inner().sku().capacity() == null) { this.withCapacity(2);
/** * Parses into a VMSS SKU type and creates a new VMSS SKU type instance if not found among the existing ones. * @param skuName a SKU name * @param skuTier a SKU tier * @return a VMSS SKU type */ public static VirtualMachineScaleSetSkuTypes fromSkuNameAndTier(String skuName, String skuTier) { return fromSku(new Sku().withName(skuName).withTier(skuTier)); }
/** * Parses a SKU into a VMSS SKU type and creates a new VirtualMachineScaleSetSkuType instance if not found among the existing ones. * * @param sku a VMSS SKU * @return the parsed or created VMSS SKU type */ public static VirtualMachineScaleSetSkuTypes fromSku(Sku sku) { if (sku == null) { return null; } String nameToLookFor = sku.name(); if (sku.tier() != null) { nameToLookFor += '_' + sku.tier(); } VirtualMachineScaleSetSkuTypes result = VALUES_BY_NAME.get(nameToLookFor.toLowerCase()); if (result != null) { return result; } else { return new VirtualMachineScaleSetSkuTypes(sku); } }