![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.compute.fluent.models.DedicatedHostProperties 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.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.compute.models.DedicatedHostInstanceView;
import com.azure.resourcemanager.compute.models.DedicatedHostLicenseTypes;
import com.azure.resourcemanager.compute.models.SubResourceReadOnly;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.List;
/**
* Properties of the dedicated host.
*/
@Fluent
public final class DedicatedHostProperties implements JsonSerializable {
/*
* Fault domain of the dedicated host within a dedicated host group.
*/
private Integer platformFaultDomain;
/*
* Specifies whether the dedicated host should be replaced automatically in case of a failure. The value is
* defaulted to 'true' when not provided.
*/
private Boolean autoReplaceOnFailure;
/*
* A unique id generated and assigned to the dedicated host by the platform. Does not change throughout the lifetime
* of the host.
*/
private String hostId;
/*
* A list of references to all virtual machines in the Dedicated Host.
*/
private List virtualMachines;
/*
* Specifies the software license type that will be applied to the VMs deployed on the dedicated host. Possible
* values are: **None,** **Windows_Server_Hybrid,** **Windows_Server_Perpetual.** The default value is: **None.**
*/
private DedicatedHostLicenseTypes licenseType;
/*
* The date when the host was first provisioned.
*/
private OffsetDateTime provisioningTime;
/*
* The provisioning state, which only appears in the response.
*/
private String provisioningState;
/*
* The dedicated host instance view.
*/
private DedicatedHostInstanceView instanceView;
/*
* Specifies the time at which the Dedicated Host resource was created. Minimum api-version: 2021-11-01.
*/
private OffsetDateTime timeCreated;
/**
* Creates an instance of DedicatedHostProperties class.
*/
public DedicatedHostProperties() {
}
/**
* Get the platformFaultDomain property: Fault domain of the dedicated host within a dedicated host group.
*
* @return the platformFaultDomain value.
*/
public Integer platformFaultDomain() {
return this.platformFaultDomain;
}
/**
* Set the platformFaultDomain property: Fault domain of the dedicated host within a dedicated host group.
*
* @param platformFaultDomain the platformFaultDomain value to set.
* @return the DedicatedHostProperties object itself.
*/
public DedicatedHostProperties withPlatformFaultDomain(Integer platformFaultDomain) {
this.platformFaultDomain = platformFaultDomain;
return this;
}
/**
* Get the autoReplaceOnFailure property: Specifies whether the dedicated host should be replaced automatically in
* case of a failure. The value is defaulted to 'true' when not provided.
*
* @return the autoReplaceOnFailure value.
*/
public Boolean autoReplaceOnFailure() {
return this.autoReplaceOnFailure;
}
/**
* Set the autoReplaceOnFailure property: Specifies whether the dedicated host should be replaced automatically in
* case of a failure. The value is defaulted to 'true' when not provided.
*
* @param autoReplaceOnFailure the autoReplaceOnFailure value to set.
* @return the DedicatedHostProperties object itself.
*/
public DedicatedHostProperties withAutoReplaceOnFailure(Boolean autoReplaceOnFailure) {
this.autoReplaceOnFailure = autoReplaceOnFailure;
return this;
}
/**
* Get the hostId property: A unique id generated and assigned to the dedicated host by the platform. Does not
* change throughout the lifetime of the host.
*
* @return the hostId value.
*/
public String hostId() {
return this.hostId;
}
/**
* Get the virtualMachines property: A list of references to all virtual machines in the Dedicated Host.
*
* @return the virtualMachines value.
*/
public List virtualMachines() {
return this.virtualMachines;
}
/**
* Get the licenseType property: Specifies the software license type that will be applied to the VMs deployed on the
* dedicated host. Possible values are: **None,** **Windows_Server_Hybrid,** **Windows_Server_Perpetual.** The
* default value is: **None.**.
*
* @return the licenseType value.
*/
public DedicatedHostLicenseTypes licenseType() {
return this.licenseType;
}
/**
* Set the licenseType property: Specifies the software license type that will be applied to the VMs deployed on the
* dedicated host. Possible values are: **None,** **Windows_Server_Hybrid,** **Windows_Server_Perpetual.** The
* default value is: **None.**.
*
* @param licenseType the licenseType value to set.
* @return the DedicatedHostProperties object itself.
*/
public DedicatedHostProperties withLicenseType(DedicatedHostLicenseTypes licenseType) {
this.licenseType = licenseType;
return this;
}
/**
* Get the provisioningTime property: The date when the host was first provisioned.
*
* @return the provisioningTime value.
*/
public OffsetDateTime provisioningTime() {
return this.provisioningTime;
}
/**
* 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 dedicated host instance view.
*
* @return the instanceView value.
*/
public DedicatedHostInstanceView instanceView() {
return this.instanceView;
}
/**
* Get the timeCreated property: Specifies the time at which the Dedicated Host resource was created. Minimum
* api-version: 2021-11-01.
*
* @return the timeCreated value.
*/
public OffsetDateTime timeCreated() {
return this.timeCreated;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (virtualMachines() != null) {
virtualMachines().forEach(e -> e.validate());
}
if (instanceView() != null) {
instanceView().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeNumberField("platformFaultDomain", this.platformFaultDomain);
jsonWriter.writeBooleanField("autoReplaceOnFailure", this.autoReplaceOnFailure);
jsonWriter.writeStringField("licenseType", this.licenseType == null ? null : this.licenseType.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of DedicatedHostProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DedicatedHostProperties 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 DedicatedHostProperties.
*/
public static DedicatedHostProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
DedicatedHostProperties deserializedDedicatedHostProperties = new DedicatedHostProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("platformFaultDomain".equals(fieldName)) {
deserializedDedicatedHostProperties.platformFaultDomain = reader.getNullable(JsonReader::getInt);
} else if ("autoReplaceOnFailure".equals(fieldName)) {
deserializedDedicatedHostProperties.autoReplaceOnFailure
= reader.getNullable(JsonReader::getBoolean);
} else if ("hostId".equals(fieldName)) {
deserializedDedicatedHostProperties.hostId = reader.getString();
} else if ("virtualMachines".equals(fieldName)) {
List virtualMachines
= reader.readArray(reader1 -> SubResourceReadOnly.fromJson(reader1));
deserializedDedicatedHostProperties.virtualMachines = virtualMachines;
} else if ("licenseType".equals(fieldName)) {
deserializedDedicatedHostProperties.licenseType
= DedicatedHostLicenseTypes.fromString(reader.getString());
} else if ("provisioningTime".equals(fieldName)) {
deserializedDedicatedHostProperties.provisioningTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("provisioningState".equals(fieldName)) {
deserializedDedicatedHostProperties.provisioningState = reader.getString();
} else if ("instanceView".equals(fieldName)) {
deserializedDedicatedHostProperties.instanceView = DedicatedHostInstanceView.fromJson(reader);
} else if ("timeCreated".equals(fieldName)) {
deserializedDedicatedHostProperties.timeCreated = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else {
reader.skipChildren();
}
}
return deserializedDedicatedHostProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy