com.azure.resourcemanager.compute.models.VirtualMachineScaleSetUpdate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-compute Show documentation
Show all versions of azure-resourcemanager-compute Show documentation
This package contains Microsoft Azure Compute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.compute.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.management.SubResource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineScaleSetUpdateProperties;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* Describes a Virtual Machine Scale Set.
*/
@Fluent
public final class VirtualMachineScaleSetUpdate extends UpdateResource {
/*
* The virtual machine scale set sku.
*/
private Sku sku;
/*
* The purchase plan when deploying a virtual machine scale set from VM Marketplace images.
*/
private Plan plan;
/*
* Describes the properties of a Virtual Machine Scale Set.
*/
private VirtualMachineScaleSetUpdateProperties innerProperties;
/*
* The identity of the virtual machine scale set, if configured.
*/
private VirtualMachineScaleSetIdentity identity;
/*
* The virtual machine scale set zones.
*/
private List zones;
/**
* Creates an instance of VirtualMachineScaleSetUpdate class.
*/
public VirtualMachineScaleSetUpdate() {
}
/**
* Get the sku property: The virtual machine scale set sku.
*
* @return the sku value.
*/
public Sku sku() {
return this.sku;
}
/**
* Set the sku property: The virtual machine scale set sku.
*
* @param sku the sku value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate withSku(Sku sku) {
this.sku = sku;
return this;
}
/**
* Get the plan property: The purchase plan when deploying a virtual machine scale set from VM Marketplace images.
*
* @return the plan value.
*/
public Plan plan() {
return this.plan;
}
/**
* Set the plan property: The purchase plan when deploying a virtual machine scale set from VM Marketplace images.
*
* @param plan the plan value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate withPlan(Plan plan) {
this.plan = plan;
return this;
}
/**
* Get the innerProperties property: Describes the properties of a Virtual Machine Scale Set.
*
* @return the innerProperties value.
*/
private VirtualMachineScaleSetUpdateProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the identity property: The identity of the virtual machine scale set, if configured.
*
* @return the identity value.
*/
public VirtualMachineScaleSetIdentity identity() {
return this.identity;
}
/**
* Set the identity property: The identity of the virtual machine scale set, if configured.
*
* @param identity the identity value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate withIdentity(VirtualMachineScaleSetIdentity identity) {
this.identity = identity;
return this;
}
/**
* Get the zones property: The virtual machine scale set zones.
*
* @return the zones value.
*/
public List zones() {
return this.zones;
}
/**
* Set the zones property: The virtual machine scale set zones.
*
* @param zones the zones value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate withZones(List zones) {
this.zones = zones;
return this;
}
/**
* {@inheritDoc}
*/
@Override
public VirtualMachineScaleSetUpdate withTags(Map tags) {
super.withTags(tags);
return this;
}
/**
* Get the upgradePolicy property: The upgrade policy.
*
* @return the upgradePolicy value.
*/
public UpgradePolicy upgradePolicy() {
return this.innerProperties() == null ? null : this.innerProperties().upgradePolicy();
}
/**
* Set the upgradePolicy property: The upgrade policy.
*
* @param upgradePolicy the upgradePolicy value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate withUpgradePolicy(UpgradePolicy upgradePolicy) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetUpdateProperties();
}
this.innerProperties().withUpgradePolicy(upgradePolicy);
return this;
}
/**
* Get the automaticRepairsPolicy property: Policy for automatic repairs.
*
* @return the automaticRepairsPolicy value.
*/
public AutomaticRepairsPolicy automaticRepairsPolicy() {
return this.innerProperties() == null ? null : this.innerProperties().automaticRepairsPolicy();
}
/**
* Set the automaticRepairsPolicy property: Policy for automatic repairs.
*
* @param automaticRepairsPolicy the automaticRepairsPolicy value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate withAutomaticRepairsPolicy(AutomaticRepairsPolicy automaticRepairsPolicy) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetUpdateProperties();
}
this.innerProperties().withAutomaticRepairsPolicy(automaticRepairsPolicy);
return this;
}
/**
* Get the virtualMachineProfile property: The virtual machine profile.
*
* @return the virtualMachineProfile value.
*/
public VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile() {
return this.innerProperties() == null ? null : this.innerProperties().virtualMachineProfile();
}
/**
* Set the virtualMachineProfile property: The virtual machine profile.
*
* @param virtualMachineProfile the virtualMachineProfile value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate
withVirtualMachineProfile(VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetUpdateProperties();
}
this.innerProperties().withVirtualMachineProfile(virtualMachineProfile);
return this;
}
/**
* Get the overprovision property: Specifies whether the Virtual Machine Scale Set should be overprovisioned.
*
* @return the overprovision value.
*/
public Boolean overprovision() {
return this.innerProperties() == null ? null : this.innerProperties().overprovision();
}
/**
* Set the overprovision property: Specifies whether the Virtual Machine Scale Set should be overprovisioned.
*
* @param overprovision the overprovision value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate withOverprovision(Boolean overprovision) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetUpdateProperties();
}
this.innerProperties().withOverprovision(overprovision);
return this;
}
/**
* Get the doNotRunExtensionsOnOverprovisionedVMs property: When Overprovision is enabled, extensions are launched
* only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions
* do not run on the extra overprovisioned VMs.
*
* @return the doNotRunExtensionsOnOverprovisionedVMs value.
*/
public Boolean doNotRunExtensionsOnOverprovisionedVMs() {
return this.innerProperties() == null ? null : this.innerProperties().doNotRunExtensionsOnOverprovisionedVMs();
}
/**
* Set the doNotRunExtensionsOnOverprovisionedVMs property: When Overprovision is enabled, extensions are launched
* only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions
* do not run on the extra overprovisioned VMs.
*
* @param doNotRunExtensionsOnOverprovisionedVMs the doNotRunExtensionsOnOverprovisionedVMs value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate
withDoNotRunExtensionsOnOverprovisionedVMs(Boolean doNotRunExtensionsOnOverprovisionedVMs) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetUpdateProperties();
}
this.innerProperties().withDoNotRunExtensionsOnOverprovisionedVMs(doNotRunExtensionsOnOverprovisionedVMs);
return this;
}
/**
* Get the singlePlacementGroup property: When true this limits the scale set to a single placement group, of max
* size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if
* singlePlacementGroup is false, it may not be modified to true.
*
* @return the singlePlacementGroup value.
*/
public Boolean singlePlacementGroup() {
return this.innerProperties() == null ? null : this.innerProperties().singlePlacementGroup();
}
/**
* Set the singlePlacementGroup property: When true this limits the scale set to a single placement group, of max
* size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if
* singlePlacementGroup is false, it may not be modified to true.
*
* @param singlePlacementGroup the singlePlacementGroup value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate withSinglePlacementGroup(Boolean singlePlacementGroup) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetUpdateProperties();
}
this.innerProperties().withSinglePlacementGroup(singlePlacementGroup);
return this;
}
/**
* Get the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the Virtual
* Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to
* support attaching managed data disks with UltraSSD_LRS storage account type.
*
* @return the additionalCapabilities value.
*/
public AdditionalCapabilities additionalCapabilities() {
return this.innerProperties() == null ? null : this.innerProperties().additionalCapabilities();
}
/**
* Set the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the Virtual
* Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to
* support attaching managed data disks with UltraSSD_LRS storage account type.
*
* @param additionalCapabilities the additionalCapabilities value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate withAdditionalCapabilities(AdditionalCapabilities additionalCapabilities) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetUpdateProperties();
}
this.innerProperties().withAdditionalCapabilities(additionalCapabilities);
return this;
}
/**
* Get the scaleInPolicy property: Specifies the policies applied when scaling in Virtual Machines in the Virtual
* Machine Scale Set.
*
* @return the scaleInPolicy value.
*/
public ScaleInPolicy scaleInPolicy() {
return this.innerProperties() == null ? null : this.innerProperties().scaleInPolicy();
}
/**
* Set the scaleInPolicy property: Specifies the policies applied when scaling in Virtual Machines in the Virtual
* Machine Scale Set.
*
* @param scaleInPolicy the scaleInPolicy value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate withScaleInPolicy(ScaleInPolicy scaleInPolicy) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetUpdateProperties();
}
this.innerProperties().withScaleInPolicy(scaleInPolicy);
return this;
}
/**
* Get the proximityPlacementGroup property: Specifies information about the proximity placement group that the
* virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01.
*
* @return the proximityPlacementGroup value.
*/
public SubResource proximityPlacementGroup() {
return this.innerProperties() == null ? null : this.innerProperties().proximityPlacementGroup();
}
/**
* Set the proximityPlacementGroup property: Specifies information about the proximity placement group that the
* virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01.
*
* @param proximityPlacementGroup the proximityPlacementGroup value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate withProximityPlacementGroup(SubResource proximityPlacementGroup) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetUpdateProperties();
}
this.innerProperties().withProximityPlacementGroup(proximityPlacementGroup);
return this;
}
/**
* Get the priorityMixPolicy property: Specifies the desired targets for mixing Spot and Regular priority VMs within
* the same VMSS Flex instance.
*
* @return the priorityMixPolicy value.
*/
public PriorityMixPolicy priorityMixPolicy() {
return this.innerProperties() == null ? null : this.innerProperties().priorityMixPolicy();
}
/**
* Set the priorityMixPolicy property: Specifies the desired targets for mixing Spot and Regular priority VMs within
* the same VMSS Flex instance.
*
* @param priorityMixPolicy the priorityMixPolicy value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate withPriorityMixPolicy(PriorityMixPolicy priorityMixPolicy) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetUpdateProperties();
}
this.innerProperties().withPriorityMixPolicy(priorityMixPolicy);
return this;
}
/**
* Get the spotRestorePolicy property: Specifies the Spot Restore properties for the virtual machine scale set.
*
* @return the spotRestorePolicy value.
*/
public SpotRestorePolicy spotRestorePolicy() {
return this.innerProperties() == null ? null : this.innerProperties().spotRestorePolicy();
}
/**
* Set the spotRestorePolicy property: Specifies the Spot Restore properties for the virtual machine scale set.
*
* @param spotRestorePolicy the spotRestorePolicy value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate withSpotRestorePolicy(SpotRestorePolicy spotRestorePolicy) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetUpdateProperties();
}
this.innerProperties().withSpotRestorePolicy(spotRestorePolicy);
return this;
}
/**
* Get the resiliencyPolicy property: Policy for Resiliency.
*
* @return the resiliencyPolicy value.
*/
public ResiliencyPolicy resiliencyPolicy() {
return this.innerProperties() == null ? null : this.innerProperties().resiliencyPolicy();
}
/**
* Set the resiliencyPolicy property: Policy for Resiliency.
*
* @param resiliencyPolicy the resiliencyPolicy value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate withResiliencyPolicy(ResiliencyPolicy resiliencyPolicy) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetUpdateProperties();
}
this.innerProperties().withResiliencyPolicy(resiliencyPolicy);
return this;
}
/**
* Get the zonalPlatformFaultDomainAlignMode property: Specifies the align mode between Virtual Machine Scale Set
* compute and storage Fault Domain count.
*
* @return the zonalPlatformFaultDomainAlignMode value.
*/
public ZonalPlatformFaultDomainAlignMode zonalPlatformFaultDomainAlignMode() {
return this.innerProperties() == null ? null : this.innerProperties().zonalPlatformFaultDomainAlignMode();
}
/**
* Set the zonalPlatformFaultDomainAlignMode property: Specifies the align mode between Virtual Machine Scale Set
* compute and storage Fault Domain count.
*
* @param zonalPlatformFaultDomainAlignMode the zonalPlatformFaultDomainAlignMode value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate
withZonalPlatformFaultDomainAlignMode(ZonalPlatformFaultDomainAlignMode zonalPlatformFaultDomainAlignMode) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetUpdateProperties();
}
this.innerProperties().withZonalPlatformFaultDomainAlignMode(zonalPlatformFaultDomainAlignMode);
return this;
}
/**
* Get the skuProfile property: Specifies the sku profile for the virtual machine scale set.
*
* @return the skuProfile value.
*/
public SkuProfile skuProfile() {
return this.innerProperties() == null ? null : this.innerProperties().skuProfile();
}
/**
* Set the skuProfile property: Specifies the sku profile for the virtual machine scale set.
*
* @param skuProfile the skuProfile value to set.
* @return the VirtualMachineScaleSetUpdate object itself.
*/
public VirtualMachineScaleSetUpdate withSkuProfile(SkuProfile skuProfile) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetUpdateProperties();
}
this.innerProperties().withSkuProfile(skuProfile);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
super.validate();
if (sku() != null) {
sku().validate();
}
if (plan() != null) {
plan().validate();
}
if (innerProperties() != null) {
innerProperties().validate();
}
if (identity() != null) {
identity().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
jsonWriter.writeJsonField("sku", this.sku);
jsonWriter.writeJsonField("plan", this.plan);
jsonWriter.writeJsonField("properties", this.innerProperties);
jsonWriter.writeJsonField("identity", this.identity);
jsonWriter.writeArrayField("zones", this.zones, (writer, element) -> writer.writeString(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of VirtualMachineScaleSetUpdate from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of VirtualMachineScaleSetUpdate if the JsonReader was pointing to an instance of it, or null
* if it was pointing to JSON null.
* @throws IOException If an error occurs while reading the VirtualMachineScaleSetUpdate.
*/
public static VirtualMachineScaleSetUpdate fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
VirtualMachineScaleSetUpdate deserializedVirtualMachineScaleSetUpdate = new VirtualMachineScaleSetUpdate();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("tags".equals(fieldName)) {
Map tags = reader.readMap(reader1 -> reader1.getString());
deserializedVirtualMachineScaleSetUpdate.withTags(tags);
} else if ("sku".equals(fieldName)) {
deserializedVirtualMachineScaleSetUpdate.sku = Sku.fromJson(reader);
} else if ("plan".equals(fieldName)) {
deserializedVirtualMachineScaleSetUpdate.plan = Plan.fromJson(reader);
} else if ("properties".equals(fieldName)) {
deserializedVirtualMachineScaleSetUpdate.innerProperties
= VirtualMachineScaleSetUpdateProperties.fromJson(reader);
} else if ("identity".equals(fieldName)) {
deserializedVirtualMachineScaleSetUpdate.identity = VirtualMachineScaleSetIdentity.fromJson(reader);
} else if ("zones".equals(fieldName)) {
List zones = reader.readArray(reader1 -> reader1.getString());
deserializedVirtualMachineScaleSetUpdate.zones = zones;
} else {
reader.skipChildren();
}
}
return deserializedVirtualMachineScaleSetUpdate;
});
}
}