com.azure.resourcemanager.hdinsight.fluent.models.NameAvailabilityCheckResultInner 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 java.io.IOException;
/**
* The response spec of checking name availability.
*/
@Fluent
public final class NameAvailabilityCheckResultInner implements JsonSerializable {
/*
* This indicates whether the name is available.
*/
private Boolean nameAvailable;
/*
* The reason of the result.
*/
private String reason;
/*
* The related message.
*/
private String message;
/**
* Creates an instance of NameAvailabilityCheckResultInner class.
*/
public NameAvailabilityCheckResultInner() {
}
/**
* Get the nameAvailable property: This indicates whether the name is available.
*
* @return the nameAvailable value.
*/
public Boolean nameAvailable() {
return this.nameAvailable;
}
/**
* Set the nameAvailable property: This indicates whether the name is available.
*
* @param nameAvailable the nameAvailable value to set.
* @return the NameAvailabilityCheckResultInner object itself.
*/
public NameAvailabilityCheckResultInner withNameAvailable(Boolean nameAvailable) {
this.nameAvailable = nameAvailable;
return this;
}
/**
* Get the reason property: The reason of the result.
*
* @return the reason value.
*/
public String reason() {
return this.reason;
}
/**
* Get the message property: The related message.
*
* @return the message value.
*/
public String message() {
return this.message;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeBooleanField("nameAvailable", this.nameAvailable);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of NameAvailabilityCheckResultInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of NameAvailabilityCheckResultInner 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 NameAvailabilityCheckResultInner.
*/
public static NameAvailabilityCheckResultInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
NameAvailabilityCheckResultInner deserializedNameAvailabilityCheckResultInner
= new NameAvailabilityCheckResultInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("nameAvailable".equals(fieldName)) {
deserializedNameAvailabilityCheckResultInner.nameAvailable
= reader.getNullable(JsonReader::getBoolean);
} else if ("reason".equals(fieldName)) {
deserializedNameAvailabilityCheckResultInner.reason = reader.getString();
} else if ("message".equals(fieldName)) {
deserializedNameAvailabilityCheckResultInner.message = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedNameAvailabilityCheckResultInner;
});
}
}