
com.azure.resourcemanager.hdinsight.models.Role Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-hdinsight Show documentation
Show all versions of azure-resourcemanager-hdinsight Show documentation
This package contains Microsoft Azure SDK for HDInsight Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. HDInsight Management Client. Package tag package-2021-06.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.hdinsight.models;
import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;
/**
* Describes a role on the cluster.
*/
@Fluent
public final class Role implements JsonSerializable {
/*
* The name of the role.
*/
private String name;
/*
* The minimum instance count of the cluster.
*/
private Integer minInstanceCount;
/*
* The instance count of the cluster.
*/
private Integer targetInstanceCount;
/*
* The name of the virtual machine group.
*/
private String vMGroupName;
/*
* The autoscale configurations.
*/
private Autoscale autoscaleConfiguration;
/*
* The hardware profile.
*/
private HardwareProfile hardwareProfile;
/*
* The operating system profile.
*/
private OsProfile osProfile;
/*
* The virtual network profile.
*/
private VirtualNetworkProfile virtualNetworkProfile;
/*
* The data disks groups for the role.
*/
private List dataDisksGroups;
/*
* The list of script actions on the role.
*/
private List scriptActions;
/*
* Indicates whether encrypt the data disks.
*/
private Boolean encryptDataDisks;
/**
* Creates an instance of Role class.
*/
public Role() {
}
/**
* Get the name property: The name of the role.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: The name of the role.
*
* @param name the name value to set.
* @return the Role object itself.
*/
public Role withName(String name) {
this.name = name;
return this;
}
/**
* Get the minInstanceCount property: The minimum instance count of the cluster.
*
* @return the minInstanceCount value.
*/
public Integer minInstanceCount() {
return this.minInstanceCount;
}
/**
* Set the minInstanceCount property: The minimum instance count of the cluster.
*
* @param minInstanceCount the minInstanceCount value to set.
* @return the Role object itself.
*/
public Role withMinInstanceCount(Integer minInstanceCount) {
this.minInstanceCount = minInstanceCount;
return this;
}
/**
* Get the targetInstanceCount property: The instance count of the cluster.
*
* @return the targetInstanceCount value.
*/
public Integer targetInstanceCount() {
return this.targetInstanceCount;
}
/**
* Set the targetInstanceCount property: The instance count of the cluster.
*
* @param targetInstanceCount the targetInstanceCount value to set.
* @return the Role object itself.
*/
public Role withTargetInstanceCount(Integer targetInstanceCount) {
this.targetInstanceCount = targetInstanceCount;
return this;
}
/**
* Get the vMGroupName property: The name of the virtual machine group.
*
* @return the vMGroupName value.
*/
public String vMGroupName() {
return this.vMGroupName;
}
/**
* Set the vMGroupName property: The name of the virtual machine group.
*
* @param vMGroupName the vMGroupName value to set.
* @return the Role object itself.
*/
public Role withVMGroupName(String vMGroupName) {
this.vMGroupName = vMGroupName;
return this;
}
/**
* Get the autoscaleConfiguration property: The autoscale configurations.
*
* @return the autoscaleConfiguration value.
*/
public Autoscale autoscaleConfiguration() {
return this.autoscaleConfiguration;
}
/**
* Set the autoscaleConfiguration property: The autoscale configurations.
*
* @param autoscaleConfiguration the autoscaleConfiguration value to set.
* @return the Role object itself.
*/
public Role withAutoscaleConfiguration(Autoscale autoscaleConfiguration) {
this.autoscaleConfiguration = autoscaleConfiguration;
return this;
}
/**
* Get the hardwareProfile property: The hardware profile.
*
* @return the hardwareProfile value.
*/
public HardwareProfile hardwareProfile() {
return this.hardwareProfile;
}
/**
* Set the hardwareProfile property: The hardware profile.
*
* @param hardwareProfile the hardwareProfile value to set.
* @return the Role object itself.
*/
public Role withHardwareProfile(HardwareProfile hardwareProfile) {
this.hardwareProfile = hardwareProfile;
return this;
}
/**
* Get the osProfile property: The operating system profile.
*
* @return the osProfile value.
*/
public OsProfile osProfile() {
return this.osProfile;
}
/**
* Set the osProfile property: The operating system profile.
*
* @param osProfile the osProfile value to set.
* @return the Role object itself.
*/
public Role withOsProfile(OsProfile osProfile) {
this.osProfile = osProfile;
return this;
}
/**
* Get the virtualNetworkProfile property: The virtual network profile.
*
* @return the virtualNetworkProfile value.
*/
public VirtualNetworkProfile virtualNetworkProfile() {
return this.virtualNetworkProfile;
}
/**
* Set the virtualNetworkProfile property: The virtual network profile.
*
* @param virtualNetworkProfile the virtualNetworkProfile value to set.
* @return the Role object itself.
*/
public Role withVirtualNetworkProfile(VirtualNetworkProfile virtualNetworkProfile) {
this.virtualNetworkProfile = virtualNetworkProfile;
return this;
}
/**
* Get the dataDisksGroups property: The data disks groups for the role.
*
* @return the dataDisksGroups value.
*/
public List dataDisksGroups() {
return this.dataDisksGroups;
}
/**
* Set the dataDisksGroups property: The data disks groups for the role.
*
* @param dataDisksGroups the dataDisksGroups value to set.
* @return the Role object itself.
*/
public Role withDataDisksGroups(List dataDisksGroups) {
this.dataDisksGroups = dataDisksGroups;
return this;
}
/**
* Get the scriptActions property: The list of script actions on the role.
*
* @return the scriptActions value.
*/
public List scriptActions() {
return this.scriptActions;
}
/**
* Set the scriptActions property: The list of script actions on the role.
*
* @param scriptActions the scriptActions value to set.
* @return the Role object itself.
*/
public Role withScriptActions(List scriptActions) {
this.scriptActions = scriptActions;
return this;
}
/**
* Get the encryptDataDisks property: Indicates whether encrypt the data disks.
*
* @return the encryptDataDisks value.
*/
public Boolean encryptDataDisks() {
return this.encryptDataDisks;
}
/**
* Set the encryptDataDisks property: Indicates whether encrypt the data disks.
*
* @param encryptDataDisks the encryptDataDisks value to set.
* @return the Role object itself.
*/
public Role withEncryptDataDisks(Boolean encryptDataDisks) {
this.encryptDataDisks = encryptDataDisks;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (autoscaleConfiguration() != null) {
autoscaleConfiguration().validate();
}
if (hardwareProfile() != null) {
hardwareProfile().validate();
}
if (osProfile() != null) {
osProfile().validate();
}
if (virtualNetworkProfile() != null) {
virtualNetworkProfile().validate();
}
if (dataDisksGroups() != null) {
dataDisksGroups().forEach(e -> e.validate());
}
if (scriptActions() != null) {
scriptActions().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("name", this.name);
jsonWriter.writeNumberField("minInstanceCount", this.minInstanceCount);
jsonWriter.writeNumberField("targetInstanceCount", this.targetInstanceCount);
jsonWriter.writeStringField("VMGroupName", this.vMGroupName);
jsonWriter.writeJsonField("autoscale", this.autoscaleConfiguration);
jsonWriter.writeJsonField("hardwareProfile", this.hardwareProfile);
jsonWriter.writeJsonField("osProfile", this.osProfile);
jsonWriter.writeJsonField("virtualNetworkProfile", this.virtualNetworkProfile);
jsonWriter.writeArrayField("dataDisksGroups", this.dataDisksGroups,
(writer, element) -> writer.writeJson(element));
jsonWriter.writeArrayField("scriptActions", this.scriptActions, (writer, element) -> writer.writeJson(element));
jsonWriter.writeBooleanField("encryptDataDisks", this.encryptDataDisks);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of Role from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of Role 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 Role.
*/
public static Role fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
Role deserializedRole = new Role();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("name".equals(fieldName)) {
deserializedRole.name = reader.getString();
} else if ("minInstanceCount".equals(fieldName)) {
deserializedRole.minInstanceCount = reader.getNullable(JsonReader::getInt);
} else if ("targetInstanceCount".equals(fieldName)) {
deserializedRole.targetInstanceCount = reader.getNullable(JsonReader::getInt);
} else if ("VMGroupName".equals(fieldName)) {
deserializedRole.vMGroupName = reader.getString();
} else if ("autoscale".equals(fieldName)) {
deserializedRole.autoscaleConfiguration = Autoscale.fromJson(reader);
} else if ("hardwareProfile".equals(fieldName)) {
deserializedRole.hardwareProfile = HardwareProfile.fromJson(reader);
} else if ("osProfile".equals(fieldName)) {
deserializedRole.osProfile = OsProfile.fromJson(reader);
} else if ("virtualNetworkProfile".equals(fieldName)) {
deserializedRole.virtualNetworkProfile = VirtualNetworkProfile.fromJson(reader);
} else if ("dataDisksGroups".equals(fieldName)) {
List dataDisksGroups
= reader.readArray(reader1 -> DataDisksGroups.fromJson(reader1));
deserializedRole.dataDisksGroups = dataDisksGroups;
} else if ("scriptActions".equals(fieldName)) {
List scriptActions = reader.readArray(reader1 -> ScriptAction.fromJson(reader1));
deserializedRole.scriptActions = scriptActions;
} else if ("encryptDataDisks".equals(fieldName)) {
deserializedRole.encryptDataDisks = reader.getNullable(JsonReader::getBoolean);
} else {
reader.skipChildren();
}
}
return deserializedRole;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy