com.azure.resourcemanager.compute.fluent.models.VirtualMachineScaleSetVMInner 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.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
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.models.AdditionalCapabilities;
import com.azure.resourcemanager.compute.models.DiagnosticsProfile;
import com.azure.resourcemanager.compute.models.HardwareProfile;
import com.azure.resourcemanager.compute.models.NetworkProfile;
import com.azure.resourcemanager.compute.models.OSProfile;
import com.azure.resourcemanager.compute.models.Plan;
import com.azure.resourcemanager.compute.models.SecurityProfile;
import com.azure.resourcemanager.compute.models.Sku;
import com.azure.resourcemanager.compute.models.StorageProfile;
import com.azure.resourcemanager.compute.models.VirtualMachineIdentity;
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetVMNetworkProfileConfiguration;
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetVMProtectionPolicy;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;
/**
* Describes a virtual machine scale set virtual machine.
*/
@Fluent
public final class VirtualMachineScaleSetVMInner extends Resource {
/*
* The virtual machine instance ID.
*/
private String instanceId;
/*
* The virtual machine SKU.
*/
private Sku sku;
/*
* Describes the properties of a virtual machine scale set virtual machine.
*/
private VirtualMachineScaleSetVMPropertiesInner innerProperties;
/*
* Specifies information about the marketplace image used to create the virtual machine. This element is only used
* for marketplace images. Before you can use a marketplace image from an API, you must enable the image for
* programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to
* deploy programmatically, Get Started ->**. Enter any required information and then click **Save**.
*/
private Plan plan;
/*
* The virtual machine child extension resources.
*/
private List resources;
/*
* The virtual machine zones.
*/
private List zones;
/*
* The identity of the virtual machine, if configured.
*/
private VirtualMachineIdentity identity;
/*
* Etag is property returned in Update/Get response of the VMSS VM, so that customer can supply it in the header to
* ensure optimistic updates.
*/
private String etag;
/*
* Fully qualified resource Id for the resource.
*/
private String id;
/*
* The name of the resource.
*/
private String name;
/*
* The type of the resource.
*/
private String type;
/**
* Creates an instance of VirtualMachineScaleSetVMInner class.
*/
public VirtualMachineScaleSetVMInner() {
}
/**
* Get the instanceId property: The virtual machine instance ID.
*
* @return the instanceId value.
*/
public String instanceId() {
return this.instanceId;
}
/**
* Get the sku property: The virtual machine SKU.
*
* @return the sku value.
*/
public Sku sku() {
return this.sku;
}
/**
* Get the innerProperties property: Describes the properties of a virtual machine scale set virtual machine.
*
* @return the innerProperties value.
*/
private VirtualMachineScaleSetVMPropertiesInner innerProperties() {
return this.innerProperties;
}
/**
* Get the plan property: Specifies information about the marketplace image used to create the virtual machine. This
* element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable
* the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then
* click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click
* **Save**.
*
* @return the plan value.
*/
public Plan plan() {
return this.plan;
}
/**
* Set the plan property: Specifies information about the marketplace image used to create the virtual machine. This
* element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable
* the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then
* click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click
* **Save**.
*
* @param plan the plan value to set.
* @return the VirtualMachineScaleSetVMInner object itself.
*/
public VirtualMachineScaleSetVMInner withPlan(Plan plan) {
this.plan = plan;
return this;
}
/**
* Get the resources property: The virtual machine child extension resources.
*
* @return the resources value.
*/
public List resources() {
return this.resources;
}
/**
* Get the zones property: The virtual machine zones.
*
* @return the zones value.
*/
public List zones() {
return this.zones;
}
/**
* Get the identity property: The identity of the virtual machine, if configured.
*
* @return the identity value.
*/
public VirtualMachineIdentity identity() {
return this.identity;
}
/**
* Set the identity property: The identity of the virtual machine, if configured.
*
* @param identity the identity value to set.
* @return the VirtualMachineScaleSetVMInner object itself.
*/
public VirtualMachineScaleSetVMInner withIdentity(VirtualMachineIdentity identity) {
this.identity = identity;
return this;
}
/**
* Get the etag property: Etag is property returned in Update/Get response of the VMSS VM, so that customer can
* supply it in the header to ensure optimistic updates.
*
* @return the etag value.
*/
public String etag() {
return this.etag;
}
/**
* Get the id property: Fully qualified resource Id for the resource.
*
* @return the id value.
*/
@Override
public String id() {
return this.id;
}
/**
* Get the name property: The name of the resource.
*
* @return the name value.
*/
@Override
public String name() {
return this.name;
}
/**
* Get the type property: The type of the resource.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}
/**
* {@inheritDoc}
*/
@Override
public VirtualMachineScaleSetVMInner withLocation(String location) {
super.withLocation(location);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public VirtualMachineScaleSetVMInner withTags(Map tags) {
super.withTags(tags);
return this;
}
/**
* Get the latestModelApplied property: Specifies whether the latest model has been applied to the virtual machine.
*
* @return the latestModelApplied value.
*/
public Boolean latestModelApplied() {
return this.innerProperties() == null ? null : this.innerProperties().latestModelApplied();
}
/**
* Get the vmId property: Azure VM unique ID.
*
* @return the vmId value.
*/
public String vmId() {
return this.innerProperties() == null ? null : this.innerProperties().vmId();
}
/**
* Get the instanceView property: The virtual machine instance view.
*
* @return the instanceView value.
*/
public VirtualMachineScaleSetVMInstanceViewInner instanceView() {
return this.innerProperties() == null ? null : this.innerProperties().instanceView();
}
/**
* Get the hardwareProfile property: Specifies the hardware settings for the virtual machine.
*
* @return the hardwareProfile value.
*/
public HardwareProfile hardwareProfile() {
return this.innerProperties() == null ? null : this.innerProperties().hardwareProfile();
}
/**
* Set the hardwareProfile property: Specifies the hardware settings for the virtual machine.
*
* @param hardwareProfile the hardwareProfile value to set.
* @return the VirtualMachineScaleSetVMInner object itself.
*/
public VirtualMachineScaleSetVMInner withHardwareProfile(HardwareProfile hardwareProfile) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner();
}
this.innerProperties().withHardwareProfile(hardwareProfile);
return this;
}
/**
* Get the storageProfile property: Specifies the storage settings for the virtual machine disks.
*
* @return the storageProfile value.
*/
public StorageProfile storageProfile() {
return this.innerProperties() == null ? null : this.innerProperties().storageProfile();
}
/**
* Set the storageProfile property: Specifies the storage settings for the virtual machine disks.
*
* @param storageProfile the storageProfile value to set.
* @return the VirtualMachineScaleSetVMInner object itself.
*/
public VirtualMachineScaleSetVMInner withStorageProfile(StorageProfile storageProfile) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner();
}
this.innerProperties().withStorageProfile(storageProfile);
return this;
}
/**
* Get the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual
* machine in the scale set. For instance: whether the virtual machine has 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
* machine in the scale set. For instance: whether the virtual machine has the capability to support attaching
* managed data disks with UltraSSD_LRS storage account type.
*
* @param additionalCapabilities the additionalCapabilities value to set.
* @return the VirtualMachineScaleSetVMInner object itself.
*/
public VirtualMachineScaleSetVMInner withAdditionalCapabilities(AdditionalCapabilities additionalCapabilities) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner();
}
this.innerProperties().withAdditionalCapabilities(additionalCapabilities);
return this;
}
/**
* Get the osProfile property: Specifies the operating system settings for the virtual machine.
*
* @return the osProfile value.
*/
public OSProfile osProfile() {
return this.innerProperties() == null ? null : this.innerProperties().osProfile();
}
/**
* Set the osProfile property: Specifies the operating system settings for the virtual machine.
*
* @param osProfile the osProfile value to set.
* @return the VirtualMachineScaleSetVMInner object itself.
*/
public VirtualMachineScaleSetVMInner withOsProfile(OSProfile osProfile) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner();
}
this.innerProperties().withOsProfile(osProfile);
return this;
}
/**
* Get the securityProfile property: Specifies the Security related profile settings for the virtual machine.
*
* @return the securityProfile value.
*/
public SecurityProfile securityProfile() {
return this.innerProperties() == null ? null : this.innerProperties().securityProfile();
}
/**
* Set the securityProfile property: Specifies the Security related profile settings for the virtual machine.
*
* @param securityProfile the securityProfile value to set.
* @return the VirtualMachineScaleSetVMInner object itself.
*/
public VirtualMachineScaleSetVMInner withSecurityProfile(SecurityProfile securityProfile) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner();
}
this.innerProperties().withSecurityProfile(securityProfile);
return this;
}
/**
* Get the networkProfile property: Specifies the network interfaces of the virtual machine.
*
* @return the networkProfile value.
*/
public NetworkProfile networkProfile() {
return this.innerProperties() == null ? null : this.innerProperties().networkProfile();
}
/**
* Set the networkProfile property: Specifies the network interfaces of the virtual machine.
*
* @param networkProfile the networkProfile value to set.
* @return the VirtualMachineScaleSetVMInner object itself.
*/
public VirtualMachineScaleSetVMInner withNetworkProfile(NetworkProfile networkProfile) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner();
}
this.innerProperties().withNetworkProfile(networkProfile);
return this;
}
/**
* Get the networkProfileConfiguration property: Specifies the network profile configuration of the virtual machine.
*
* @return the networkProfileConfiguration value.
*/
public VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration() {
return this.innerProperties() == null ? null : this.innerProperties().networkProfileConfiguration();
}
/**
* Set the networkProfileConfiguration property: Specifies the network profile configuration of the virtual machine.
*
* @param networkProfileConfiguration the networkProfileConfiguration value to set.
* @return the VirtualMachineScaleSetVMInner object itself.
*/
public VirtualMachineScaleSetVMInner withNetworkProfileConfiguration(
VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner();
}
this.innerProperties().withNetworkProfileConfiguration(networkProfileConfiguration);
return this;
}
/**
* Get the diagnosticsProfile property: Specifies the boot diagnostic settings state. Minimum api-version:
* 2015-06-15.
*
* @return the diagnosticsProfile value.
*/
public DiagnosticsProfile diagnosticsProfile() {
return this.innerProperties() == null ? null : this.innerProperties().diagnosticsProfile();
}
/**
* Set the diagnosticsProfile property: Specifies the boot diagnostic settings state. Minimum api-version:
* 2015-06-15.
*
* @param diagnosticsProfile the diagnosticsProfile value to set.
* @return the VirtualMachineScaleSetVMInner object itself.
*/
public VirtualMachineScaleSetVMInner withDiagnosticsProfile(DiagnosticsProfile diagnosticsProfile) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner();
}
this.innerProperties().withDiagnosticsProfile(diagnosticsProfile);
return this;
}
/**
* Get the availabilitySet property: Specifies information about the availability set that the virtual machine
* should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes
* to maximize availability. For more information about availability sets, see [Availability sets
* overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). For more information on
* Azure planned maintenance, see [Maintenance and updates for Virtual Machines in
* Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates). Currently, a VM can only be
* added to availability set at creation time. An existing VM cannot be added to an availability set.
*
* @return the availabilitySet value.
*/
public SubResource availabilitySet() {
return this.innerProperties() == null ? null : this.innerProperties().availabilitySet();
}
/**
* Set the availabilitySet property: Specifies information about the availability set that the virtual machine
* should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes
* to maximize availability. For more information about availability sets, see [Availability sets
* overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). For more information on
* Azure planned maintenance, see [Maintenance and updates for Virtual Machines in
* Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates). Currently, a VM can only be
* added to availability set at creation time. An existing VM cannot be added to an availability set.
*
* @param availabilitySet the availabilitySet value to set.
* @return the VirtualMachineScaleSetVMInner object itself.
*/
public VirtualMachineScaleSetVMInner withAvailabilitySet(SubResource availabilitySet) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner();
}
this.innerProperties().withAvailabilitySet(availabilitySet);
return this;
}
/**
* Get the provisioningState property: The provisioning state, which only appears in the response.
*
* @return the provisioningState value.
*/
public String provisioningState() {
return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
}
/**
* Get the licenseType property: Specifies that the image or disk that is being used was licensed on-premises.
* <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client
* <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are:
* <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more
* information, see [Azure Hybrid Use Benefit for Windows
* Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing)
* <br><br> [Azure Hybrid Use Benefit for Linux
* Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br>
* Minimum api-version: 2015-06-15.
*
* @return the licenseType value.
*/
public String licenseType() {
return this.innerProperties() == null ? null : this.innerProperties().licenseType();
}
/**
* Set the licenseType property: Specifies that the image or disk that is being used was licensed on-premises.
* <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client
* <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are:
* <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more
* information, see [Azure Hybrid Use Benefit for Windows
* Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing)
* <br><br> [Azure Hybrid Use Benefit for Linux
* Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br>
* Minimum api-version: 2015-06-15.
*
* @param licenseType the licenseType value to set.
* @return the VirtualMachineScaleSetVMInner object itself.
*/
public VirtualMachineScaleSetVMInner withLicenseType(String licenseType) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner();
}
this.innerProperties().withLicenseType(licenseType);
return this;
}
/**
* Get the modelDefinitionApplied property: Specifies whether the model applied to the virtual machine is the model
* of the virtual machine scale set or the customized model for the virtual machine.
*
* @return the modelDefinitionApplied value.
*/
public String modelDefinitionApplied() {
return this.innerProperties() == null ? null : this.innerProperties().modelDefinitionApplied();
}
/**
* Get the protectionPolicy property: Specifies the protection policy of the virtual machine.
*
* @return the protectionPolicy value.
*/
public VirtualMachineScaleSetVMProtectionPolicy protectionPolicy() {
return this.innerProperties() == null ? null : this.innerProperties().protectionPolicy();
}
/**
* Set the protectionPolicy property: Specifies the protection policy of the virtual machine.
*
* @param protectionPolicy the protectionPolicy value to set.
* @return the VirtualMachineScaleSetVMInner object itself.
*/
public VirtualMachineScaleSetVMInner
withProtectionPolicy(VirtualMachineScaleSetVMProtectionPolicy protectionPolicy) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner();
}
this.innerProperties().withProtectionPolicy(protectionPolicy);
return this;
}
/**
* Get the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any
* secrets in here. Minimum api-version: 2021-03-01.
*
* @return the userData value.
*/
public String userData() {
return this.innerProperties() == null ? null : this.innerProperties().userData();
}
/**
* Set the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any
* secrets in here. Minimum api-version: 2021-03-01.
*
* @param userData the userData value to set.
* @return the VirtualMachineScaleSetVMInner object itself.
*/
public VirtualMachineScaleSetVMInner withUserData(String userData) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner();
}
this.innerProperties().withUserData(userData);
return this;
}
/**
* Get the timeCreated property: Specifies the time at which the Virtual Machine resource was created.
*
* @return the timeCreated value.
*/
public OffsetDateTime timeCreated() {
return this.innerProperties() == null ? null : this.innerProperties().timeCreated();
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (sku() != null) {
sku().validate();
}
if (innerProperties() != null) {
innerProperties().validate();
}
if (plan() != null) {
plan().validate();
}
if (resources() != null) {
resources().forEach(e -> e.validate());
}
if (identity() != null) {
identity().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("location", location());
jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
jsonWriter.writeJsonField("properties", this.innerProperties);
jsonWriter.writeJsonField("plan", this.plan);
jsonWriter.writeJsonField("identity", this.identity);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of VirtualMachineScaleSetVMInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of VirtualMachineScaleSetVMInner if the JsonReader was pointing to an instance of it, or null
* if it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the VirtualMachineScaleSetVMInner.
*/
public static VirtualMachineScaleSetVMInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
VirtualMachineScaleSetVMInner deserializedVirtualMachineScaleSetVMInner
= new VirtualMachineScaleSetVMInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedVirtualMachineScaleSetVMInner.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedVirtualMachineScaleSetVMInner.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedVirtualMachineScaleSetVMInner.type = reader.getString();
} else if ("location".equals(fieldName)) {
deserializedVirtualMachineScaleSetVMInner.withLocation(reader.getString());
} else if ("tags".equals(fieldName)) {
Map tags = reader.readMap(reader1 -> reader1.getString());
deserializedVirtualMachineScaleSetVMInner.withTags(tags);
} else if ("instanceId".equals(fieldName)) {
deserializedVirtualMachineScaleSetVMInner.instanceId = reader.getString();
} else if ("sku".equals(fieldName)) {
deserializedVirtualMachineScaleSetVMInner.sku = Sku.fromJson(reader);
} else if ("properties".equals(fieldName)) {
deserializedVirtualMachineScaleSetVMInner.innerProperties
= VirtualMachineScaleSetVMPropertiesInner.fromJson(reader);
} else if ("plan".equals(fieldName)) {
deserializedVirtualMachineScaleSetVMInner.plan = Plan.fromJson(reader);
} else if ("resources".equals(fieldName)) {
List resources
= reader.readArray(reader1 -> VirtualMachineExtensionInner.fromJson(reader1));
deserializedVirtualMachineScaleSetVMInner.resources = resources;
} else if ("zones".equals(fieldName)) {
List zones = reader.readArray(reader1 -> reader1.getString());
deserializedVirtualMachineScaleSetVMInner.zones = zones;
} else if ("identity".equals(fieldName)) {
deserializedVirtualMachineScaleSetVMInner.identity = VirtualMachineIdentity.fromJson(reader);
} else if ("etag".equals(fieldName)) {
deserializedVirtualMachineScaleSetVMInner.etag = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedVirtualMachineScaleSetVMInner;
});
}
}