com.azure.resourcemanager.hdinsight.fluent.models.CapabilitiesResultInner 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-2024-08-preview.
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.fluent.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 com.azure.resourcemanager.hdinsight.models.QuotaCapability;
import com.azure.resourcemanager.hdinsight.models.RegionsCapability;
import com.azure.resourcemanager.hdinsight.models.VersionsCapability;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* The Get Capabilities operation response.
*/
@Fluent
public final class CapabilitiesResultInner implements JsonSerializable {
/*
* The version capability.
*/
private Map versions;
/*
* The virtual machine size compatibility features.
*/
private Map regions;
/*
* The capability features.
*/
private List features;
/*
* The quota capability.
*/
private QuotaCapability quota;
/**
* Creates an instance of CapabilitiesResultInner class.
*/
public CapabilitiesResultInner() {
}
/**
* Get the versions property: The version capability.
*
* @return the versions value.
*/
public Map versions() {
return this.versions;
}
/**
* Set the versions property: The version capability.
*
* @param versions the versions value to set.
* @return the CapabilitiesResultInner object itself.
*/
public CapabilitiesResultInner withVersions(Map versions) {
this.versions = versions;
return this;
}
/**
* Get the regions property: The virtual machine size compatibility features.
*
* @return the regions value.
*/
public Map regions() {
return this.regions;
}
/**
* Set the regions property: The virtual machine size compatibility features.
*
* @param regions the regions value to set.
* @return the CapabilitiesResultInner object itself.
*/
public CapabilitiesResultInner withRegions(Map regions) {
this.regions = regions;
return this;
}
/**
* Get the features property: The capability features.
*
* @return the features value.
*/
public List features() {
return this.features;
}
/**
* Set the features property: The capability features.
*
* @param features the features value to set.
* @return the CapabilitiesResultInner object itself.
*/
public CapabilitiesResultInner withFeatures(List features) {
this.features = features;
return this;
}
/**
* Get the quota property: The quota capability.
*
* @return the quota value.
*/
public QuotaCapability quota() {
return this.quota;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (versions() != null) {
versions().values().forEach(e -> {
if (e != null) {
e.validate();
}
});
}
if (regions() != null) {
regions().values().forEach(e -> {
if (e != null) {
e.validate();
}
});
}
if (quota() != null) {
quota().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeMapField("versions", this.versions, (writer, element) -> writer.writeJson(element));
jsonWriter.writeMapField("regions", this.regions, (writer, element) -> writer.writeJson(element));
jsonWriter.writeArrayField("features", this.features, (writer, element) -> writer.writeString(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of CapabilitiesResultInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of CapabilitiesResultInner 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 CapabilitiesResultInner.
*/
public static CapabilitiesResultInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
CapabilitiesResultInner deserializedCapabilitiesResultInner = new CapabilitiesResultInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("versions".equals(fieldName)) {
Map versions
= reader.readMap(reader1 -> VersionsCapability.fromJson(reader1));
deserializedCapabilitiesResultInner.versions = versions;
} else if ("regions".equals(fieldName)) {
Map regions
= reader.readMap(reader1 -> RegionsCapability.fromJson(reader1));
deserializedCapabilitiesResultInner.regions = regions;
} else if ("features".equals(fieldName)) {
List features = reader.readArray(reader1 -> reader1.getString());
deserializedCapabilitiesResultInner.features = features;
} else if ("quota".equals(fieldName)) {
deserializedCapabilitiesResultInner.quota = QuotaCapability.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedCapabilitiesResultInner;
});
}
}