VirtualMachineInner.java
// 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.annotation.JsonFlatten;
import com.azure.core.management.Resource;
import com.azure.core.management.SubResource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.compute.models.AdditionalCapabilities;
import com.azure.resourcemanager.compute.models.BillingProfile;
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.StorageProfile;
import com.azure.resourcemanager.compute.models.VirtualMachineEvictionPolicyTypes;
import com.azure.resourcemanager.compute.models.VirtualMachineIdentity;
import com.azure.resourcemanager.compute.models.VirtualMachinePriorityTypes;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
/** Describes a Virtual Machine. */
@JsonFlatten
@Fluent
public class VirtualMachineInner extends Resource {
@JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineInner.class);
/*
* 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**.
*/
@JsonProperty(value = "plan")
private Plan plan;
/*
* The virtual machine child extension resources.
*/
@JsonProperty(value = "resources", access = JsonProperty.Access.WRITE_ONLY)
private List<VirtualMachineExtensionInner> resources;
/*
* The identity of the virtual machine, if configured.
*/
@JsonProperty(value = "identity")
private VirtualMachineIdentity identity;
/*
* The virtual machine zones.
*/
@JsonProperty(value = "zones")
private List<String> zones;
/*
* Specifies the hardware settings for the virtual machine.
*/
@JsonProperty(value = "properties.hardwareProfile")
private HardwareProfile hardwareProfile;
/*
* Specifies the storage settings for the virtual machine disks.
*/
@JsonProperty(value = "properties.storageProfile")
private StorageProfile storageProfile;
/*
* Specifies additional capabilities enabled or disabled on the virtual
* machine.
*/
@JsonProperty(value = "properties.additionalCapabilities")
private AdditionalCapabilities additionalCapabilities;
/*
* Specifies the operating system settings used while creating the virtual
* machine. Some of the settings cannot be changed once VM is provisioned.
*/
@JsonProperty(value = "properties.osProfile")
private OSProfile osProfile;
/*
* Specifies the network interfaces of the virtual machine.
*/
@JsonProperty(value = "properties.networkProfile")
private NetworkProfile networkProfile;
/*
* Specifies the boot diagnostic settings state. <br><br>Minimum
* api-version: 2015-06-15.
*/
@JsonProperty(value = "properties.diagnosticsProfile")
private DiagnosticsProfile diagnosticsProfile;
/*
* 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 [Manage
* the availability of virtual
* machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
* <br><br> For more information on Azure planned maintenance, see [Planned
* maintenance for virtual machines in
* Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
* <br><br> Currently, a VM can only be added to availability set at
* creation time. The availability set to which the VM is being added
* should be under the same resource group as the availability set
* resource. An existing VM cannot be added to an availability set.
* <br><br>This property cannot exist along with a non-null
* properties.virtualMachineScaleSet reference.
*/
@JsonProperty(value = "properties.availabilitySet")
private SubResource availabilitySet;
/*
* Specifies information about the virtual machine scale set that the
* virtual machine should be assigned to. Virtual machines specified in the
* same virtual machine scale set are allocated to different nodes to
* maximize availability. Currently, a VM can only be added to virtual
* machine scale set at creation time. An existing VM cannot be added to a
* virtual machine scale set. <br><br>This property cannot exist along with
* a non-null properties.availabilitySet reference. <br><br>Minimum
* api‐version: 2019‐03‐01
*/
@JsonProperty(value = "properties.virtualMachineScaleSet")
private SubResource virtualMachineScaleSet;
/*
* Specifies information about the proximity placement group that the
* virtual machine should be assigned to. <br><br>Minimum api-version:
* 2018-04-01.
*/
@JsonProperty(value = "properties.proximityPlacementGroup")
private SubResource proximityPlacementGroup;
/*
* Specifies the priority for the virtual machine. <br><br>Minimum
* api-version: 2019-03-01
*/
@JsonProperty(value = "properties.priority")
private VirtualMachinePriorityTypes priority;
/*
* Specifies the eviction policy for the Azure Spot virtual machine and
* Azure Spot scale set. <br><br>For Azure Spot virtual machines, both
* 'Deallocate' and 'Delete' are supported and the minimum api-version is
* 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and
* 'Delete' are supported and the minimum api-version is
* 2017-10-30-preview.
*/
@JsonProperty(value = "properties.evictionPolicy")
private VirtualMachineEvictionPolicyTypes evictionPolicy;
/*
* Specifies the billing related details of a Azure Spot virtual machine.
* <br><br>Minimum api-version: 2019-03-01.
*/
@JsonProperty(value = "properties.billingProfile")
private BillingProfile billingProfile;
/*
* Specifies information about the dedicated host that the virtual machine
* resides in. <br><br>Minimum api-version: 2018-10-01.
*/
@JsonProperty(value = "properties.host")
private SubResource host;
/*
* The provisioning state, which only appears in the response.
*/
@JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY)
private String provisioningState;
/*
* The virtual machine instance view.
*/
@JsonProperty(value = "properties.instanceView", access = JsonProperty.Access.WRITE_ONLY)
private VirtualMachineInstanceViewInner instanceView;
/*
* Specifies that the image or disk that is being used was licensed
* on-premises. This element is only used for images that contain the
* Windows Server operating system. <br><br> Possible values are: <br><br>
* Windows_Client <br><br> Windows_Server <br><br> If this element is
* included in a request for an update, the value must match the initial
* value. This value cannot be updated. <br><br> For more information, see
* [Azure Hybrid Use Benefit for Windows
* Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
* <br><br> Minimum api-version: 2015-06-15
*/
@JsonProperty(value = "properties.licenseType")
private String licenseType;
/*
* Specifies the VM unique ID which is a 128-bits identifier that is
* encoded and stored in all Azure IaaS VMs SMBIOS and can be read using
* platform BIOS commands.
*/
@JsonProperty(value = "properties.vmId", access = JsonProperty.Access.WRITE_ONLY)
private String vmId;
/**
* 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 VirtualMachineInner object itself.
*/
public VirtualMachineInner withPlan(Plan plan) {
this.plan = plan;
return this;
}
/**
* Get the resources property: The virtual machine child extension resources.
*
* @return the resources value.
*/
public List<VirtualMachineExtensionInner> resources() {
return this.resources;
}
/**
* 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 VirtualMachineInner object itself.
*/
public VirtualMachineInner withIdentity(VirtualMachineIdentity identity) {
this.identity = identity;
return this;
}
/**
* Get the zones property: The virtual machine zones.
*
* @return the zones value.
*/
public List<String> zones() {
return this.zones;
}
/**
* Set the zones property: The virtual machine zones.
*
* @param zones the zones value to set.
* @return the VirtualMachineInner object itself.
*/
public VirtualMachineInner withZones(List<String> zones) {
this.zones = zones;
return this;
}
/**
* Get the hardwareProfile property: Specifies the hardware settings for the virtual machine.
*
* @return the hardwareProfile value.
*/
public HardwareProfile hardwareProfile() {
return this.hardwareProfile;
}
/**
* Set the hardwareProfile property: Specifies the hardware settings for the virtual machine.
*
* @param hardwareProfile the hardwareProfile value to set.
* @return the VirtualMachineInner object itself.
*/
public VirtualMachineInner withHardwareProfile(HardwareProfile hardwareProfile) {
this.hardwareProfile = 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.storageProfile;
}
/**
* Set the storageProfile property: Specifies the storage settings for the virtual machine disks.
*
* @param storageProfile the storageProfile value to set.
* @return the VirtualMachineInner object itself.
*/
public VirtualMachineInner withStorageProfile(StorageProfile storageProfile) {
this.storageProfile = storageProfile;
return this;
}
/**
* Get the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual
* machine.
*
* @return the additionalCapabilities value.
*/
public AdditionalCapabilities additionalCapabilities() {
return this.additionalCapabilities;
}
/**
* Set the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual
* machine.
*
* @param additionalCapabilities the additionalCapabilities value to set.
* @return the VirtualMachineInner object itself.
*/
public VirtualMachineInner withAdditionalCapabilities(AdditionalCapabilities additionalCapabilities) {
this.additionalCapabilities = additionalCapabilities;
return this;
}
/**
* Get the osProfile property: Specifies the operating system settings used while creating the virtual machine. Some
* of the settings cannot be changed once VM is provisioned.
*
* @return the osProfile value.
*/
public OSProfile osProfile() {
return this.osProfile;
}
/**
* Set the osProfile property: Specifies the operating system settings used while creating the virtual machine. Some
* of the settings cannot be changed once VM is provisioned.
*
* @param osProfile the osProfile value to set.
* @return the VirtualMachineInner object itself.
*/
public VirtualMachineInner withOsProfile(OSProfile osProfile) {
this.osProfile = osProfile;
return this;
}
/**
* Get the networkProfile property: Specifies the network interfaces of the virtual machine.
*
* @return the networkProfile value.
*/
public NetworkProfile networkProfile() {
return this.networkProfile;
}
/**
* Set the networkProfile property: Specifies the network interfaces of the virtual machine.
*
* @param networkProfile the networkProfile value to set.
* @return the VirtualMachineInner object itself.
*/
public VirtualMachineInner withNetworkProfile(NetworkProfile networkProfile) {
this.networkProfile = networkProfile;
return this;
}
/**
* Get the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum
* api-version: 2015-06-15.
*
* @return the diagnosticsProfile value.
*/
public DiagnosticsProfile diagnosticsProfile() {
return this.diagnosticsProfile;
}
/**
* Set the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum
* api-version: 2015-06-15.
*
* @param diagnosticsProfile the diagnosticsProfile value to set.
* @return the VirtualMachineInner object itself.
*/
public VirtualMachineInner withDiagnosticsProfile(DiagnosticsProfile diagnosticsProfile) {
this.diagnosticsProfile = 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 [Manage the availability of virtual
* machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
* <br><br> For more information on Azure planned maintenance, see [Planned maintenance for virtual
* machines in
* Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
* <br><br> Currently, a VM can only be added to availability set at creation time. The availability set
* to which the VM is being added should be under the same resource group as the availability set resource. An
* existing VM cannot be added to an availability set. <br><br>This property cannot exist along with a
* non-null properties.virtualMachineScaleSet reference.
*
* @return the availabilitySet value.
*/
public SubResource availabilitySet() {
return this.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 [Manage the availability of virtual
* machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
* <br><br> For more information on Azure planned maintenance, see [Planned maintenance for virtual
* machines in
* Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
* <br><br> Currently, a VM can only be added to availability set at creation time. The availability set
* to which the VM is being added should be under the same resource group as the availability set resource. An
* existing VM cannot be added to an availability set. <br><br>This property cannot exist along with a
* non-null properties.virtualMachineScaleSet reference.
*
* @param availabilitySet the availabilitySet value to set.
* @return the VirtualMachineInner object itself.
*/
public VirtualMachineInner withAvailabilitySet(SubResource availabilitySet) {
this.availabilitySet = availabilitySet;
return this;
}
/**
* Get the virtualMachineScaleSet property: Specifies information about the virtual machine scale set that the
* virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are
* allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale
* set at creation time. An existing VM cannot be added to a virtual machine scale set. <br><br>This
* property cannot exist along with a non-null properties.availabilitySet reference. <br><br>Minimum
* api‐version: 2019‐03‐01.
*
* @return the virtualMachineScaleSet value.
*/
public SubResource virtualMachineScaleSet() {
return this.virtualMachineScaleSet;
}
/**
* Set the virtualMachineScaleSet property: Specifies information about the virtual machine scale set that the
* virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are
* allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale
* set at creation time. An existing VM cannot be added to a virtual machine scale set. <br><br>This
* property cannot exist along with a non-null properties.availabilitySet reference. <br><br>Minimum
* api‐version: 2019‐03‐01.
*
* @param virtualMachineScaleSet the virtualMachineScaleSet value to set.
* @return the VirtualMachineInner object itself.
*/
public VirtualMachineInner withVirtualMachineScaleSet(SubResource virtualMachineScaleSet) {
this.virtualMachineScaleSet = virtualMachineScaleSet;
return this;
}
/**
* Get the proximityPlacementGroup property: Specifies information about the proximity placement group that the
* virtual machine should be assigned to. <br><br>Minimum api-version: 2018-04-01.
*
* @return the proximityPlacementGroup value.
*/
public SubResource proximityPlacementGroup() {
return this.proximityPlacementGroup;
}
/**
* Set the proximityPlacementGroup property: Specifies information about the proximity placement group that the
* virtual machine should be assigned to. <br><br>Minimum api-version: 2018-04-01.
*
* @param proximityPlacementGroup the proximityPlacementGroup value to set.
* @return the VirtualMachineInner object itself.
*/
public VirtualMachineInner withProximityPlacementGroup(SubResource proximityPlacementGroup) {
this.proximityPlacementGroup = proximityPlacementGroup;
return this;
}
/**
* Get the priority property: Specifies the priority for the virtual machine. <br><br>Minimum
* api-version: 2019-03-01.
*
* @return the priority value.
*/
public VirtualMachinePriorityTypes priority() {
return this.priority;
}
/**
* Set the priority property: Specifies the priority for the virtual machine. <br><br>Minimum
* api-version: 2019-03-01.
*
* @param priority the priority value to set.
* @return the VirtualMachineInner object itself.
*/
public VirtualMachineInner withPriority(VirtualMachinePriorityTypes priority) {
this.priority = priority;
return this;
}
/**
* Get the evictionPolicy property: Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot
* scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and
* the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and
* 'Delete' are supported and the minimum api-version is 2017-10-30-preview.
*
* @return the evictionPolicy value.
*/
public VirtualMachineEvictionPolicyTypes evictionPolicy() {
return this.evictionPolicy;
}
/**
* Set the evictionPolicy property: Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot
* scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and
* the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and
* 'Delete' are supported and the minimum api-version is 2017-10-30-preview.
*
* @param evictionPolicy the evictionPolicy value to set.
* @return the VirtualMachineInner object itself.
*/
public VirtualMachineInner withEvictionPolicy(VirtualMachineEvictionPolicyTypes evictionPolicy) {
this.evictionPolicy = evictionPolicy;
return this;
}
/**
* Get the billingProfile property: Specifies the billing related details of a Azure Spot virtual machine.
* <br><br>Minimum api-version: 2019-03-01.
*
* @return the billingProfile value.
*/
public BillingProfile billingProfile() {
return this.billingProfile;
}
/**
* Set the billingProfile property: Specifies the billing related details of a Azure Spot virtual machine.
* <br><br>Minimum api-version: 2019-03-01.
*
* @param billingProfile the billingProfile value to set.
* @return the VirtualMachineInner object itself.
*/
public VirtualMachineInner withBillingProfile(BillingProfile billingProfile) {
this.billingProfile = billingProfile;
return this;
}
/**
* Get the host property: Specifies information about the dedicated host that the virtual machine resides in.
* <br><br>Minimum api-version: 2018-10-01.
*
* @return the host value.
*/
public SubResource host() {
return this.host;
}
/**
* Set the host property: Specifies information about the dedicated host that the virtual machine resides in.
* <br><br>Minimum api-version: 2018-10-01.
*
* @param host the host value to set.
* @return the VirtualMachineInner object itself.
*/
public VirtualMachineInner withHost(SubResource host) {
this.host = host;
return this;
}
/**
* Get the provisioningState property: The provisioning state, which only appears in the response.
*
* @return the provisioningState value.
*/
public String provisioningState() {
return this.provisioningState;
}
/**
* Get the instanceView property: The virtual machine instance view.
*
* @return the instanceView value.
*/
public VirtualMachineInstanceViewInner instanceView() {
return this.instanceView;
}
/**
* Get the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. This
* element is only used for images that contain the Windows Server operating system. <br><br> Possible
* values are: <br><br> Windows_Client <br><br> Windows_Server <br><br> If this
* element is included in a request for an update, the value must match the initial value. This value cannot be
* updated. <br><br> For more information, see [Azure Hybrid Use Benefit for Windows
* Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
* <br><br> Minimum api-version: 2015-06-15.
*
* @return the licenseType value.
*/
public String licenseType() {
return this.licenseType;
}
/**
* Set the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. This
* element is only used for images that contain the Windows Server operating system. <br><br> Possible
* values are: <br><br> Windows_Client <br><br> Windows_Server <br><br> If this
* element is included in a request for an update, the value must match the initial value. This value cannot be
* updated. <br><br> For more information, see [Azure Hybrid Use Benefit for Windows
* Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
* <br><br> Minimum api-version: 2015-06-15.
*
* @param licenseType the licenseType value to set.
* @return the VirtualMachineInner object itself.
*/
public VirtualMachineInner withLicenseType(String licenseType) {
this.licenseType = licenseType;
return this;
}
/**
* Get the vmId property: Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in
* all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands.
*
* @return the vmId value.
*/
public String vmId() {
return this.vmId;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (plan() != null) {
plan().validate();
}
if (resources() != null) {
resources().forEach(e -> e.validate());
}
if (identity() != null) {
identity().validate();
}
if (hardwareProfile() != null) {
hardwareProfile().validate();
}
if (storageProfile() != null) {
storageProfile().validate();
}
if (additionalCapabilities() != null) {
additionalCapabilities().validate();
}
if (osProfile() != null) {
osProfile().validate();
}
if (networkProfile() != null) {
networkProfile().validate();
}
if (diagnosticsProfile() != null) {
diagnosticsProfile().validate();
}
if (billingProfile() != null) {
billingProfile().validate();
}
if (instanceView() != null) {
instanceView().validate();
}
}
}