/** * @return the SKU */ public Sku sku() { // Return copy of sku to guard VirtualMachineScaleSetSkuTypes from ending up with invalid // sku in case consumer changes the returned Sku instance. // return createCopy(this.sku); }
@Override public boolean equals(Object obj) { String value = this.toString(); if (!(obj instanceof VirtualMachineScaleSetSkuTypes)) { return false; } else if (obj == this) { return true; } else if (value == null) { return ((VirtualMachineScaleSetSkuTypes) obj).value == null; } else { return value.equalsIgnoreCase(((VirtualMachineScaleSetSkuTypes) obj).value.toLowerCase()); } }
@Override public VirtualMachineScaleSetSkuTypes skuType() { return VirtualMachineScaleSetSkuTypes.fromSku(this.inner().sku()); }
@Override public VirtualMachineScaleSetImpl withSku(VirtualMachineScaleSetSkuTypes skuType) { this.inner() .withSku(skuType.sku()); return this; }
/** * 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 VirtualMachineScaleSetSkuTypes sku() { return VirtualMachineScaleSetSkuTypes.fromSku(this.inner().sku()); }
@Override public VirtualMachineScaleSetImpl withSku(VirtualMachineScaleSetSkuTypes skuType) { this.inner() .withSku(skuType.sku()); return this; }
/** * 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 VirtualMachineScaleSetSkuTypes skuType() { return VirtualMachineScaleSetSkuTypes.fromSku(this.inner().sku()); }
/** * @return the SKU */ public Sku sku() { // Return copy of sku to guard VirtualMachineScaleSetSkuTypes from ending up with invalid // sku in case consumer changes the returned Sku instance. // return createCopy(this.sku); }
@Override public boolean equals(Object obj) { String value = this.toString(); if (!(obj instanceof VirtualMachineScaleSetSkuTypes)) { return false; } else if (obj == this) { return true; } else if (value == null) { return ((VirtualMachineScaleSetSkuTypes) obj).value == null; } else { return value.equalsIgnoreCase(((VirtualMachineScaleSetSkuTypes) obj).value.toLowerCase()); } }
@Override public VirtualMachineScaleSetSkuTypes sku() { return VirtualMachineScaleSetSkuTypes.fromSku(this.inner().sku()); }
/** * 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); }
/** * 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)); }
/** * 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); }
/** * 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)); }