All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.appcontainers.fluent.models.CheckNameAvailabilityResponseInner Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for ContainerAppsApi Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2024-03.

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.appcontainers.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.appcontainers.models.CheckNameAvailabilityReason;
import java.io.IOException;

/**
 * The check availability result.
 */
@Fluent
public final class CheckNameAvailabilityResponseInner implements JsonSerializable {
    /*
     * Indicates if the resource name is available.
     */
    private Boolean nameAvailable;

    /*
     * The reason why the given name is not available.
     */
    private CheckNameAvailabilityReason reason;

    /*
     * Detailed reason why the given name is available.
     */
    private String message;

    /**
     * Creates an instance of CheckNameAvailabilityResponseInner class.
     */
    public CheckNameAvailabilityResponseInner() {
    }

    /**
     * Get the nameAvailable property: Indicates if the resource name is available.
     * 
     * @return the nameAvailable value.
     */
    public Boolean nameAvailable() {
        return this.nameAvailable;
    }

    /**
     * Set the nameAvailable property: Indicates if the resource name is available.
     * 
     * @param nameAvailable the nameAvailable value to set.
     * @return the CheckNameAvailabilityResponseInner object itself.
     */
    public CheckNameAvailabilityResponseInner withNameAvailable(Boolean nameAvailable) {
        this.nameAvailable = nameAvailable;
        return this;
    }

    /**
     * Get the reason property: The reason why the given name is not available.
     * 
     * @return the reason value.
     */
    public CheckNameAvailabilityReason reason() {
        return this.reason;
    }

    /**
     * Set the reason property: The reason why the given name is not available.
     * 
     * @param reason the reason value to set.
     * @return the CheckNameAvailabilityResponseInner object itself.
     */
    public CheckNameAvailabilityResponseInner withReason(CheckNameAvailabilityReason reason) {
        this.reason = reason;
        return this;
    }

    /**
     * Get the message property: Detailed reason why the given name is available.
     * 
     * @return the message value.
     */
    public String message() {
        return this.message;
    }

    /**
     * Set the message property: Detailed reason why the given name is available.
     * 
     * @param message the message value to set.
     * @return the CheckNameAvailabilityResponseInner object itself.
     */
    public CheckNameAvailabilityResponseInner withMessage(String message) {
        this.message = message;
        return this;
    }

    /**
     * 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);
        jsonWriter.writeStringField("reason", this.reason == null ? null : this.reason.toString());
        jsonWriter.writeStringField("message", this.message);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of CheckNameAvailabilityResponseInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of CheckNameAvailabilityResponseInner 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 CheckNameAvailabilityResponseInner.
     */
    public static CheckNameAvailabilityResponseInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            CheckNameAvailabilityResponseInner deserializedCheckNameAvailabilityResponseInner
                = new CheckNameAvailabilityResponseInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("nameAvailable".equals(fieldName)) {
                    deserializedCheckNameAvailabilityResponseInner.nameAvailable
                        = reader.getNullable(JsonReader::getBoolean);
                } else if ("reason".equals(fieldName)) {
                    deserializedCheckNameAvailabilityResponseInner.reason
                        = CheckNameAvailabilityReason.fromString(reader.getString());
                } else if ("message".equals(fieldName)) {
                    deserializedCheckNameAvailabilityResponseInner.message = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedCheckNameAvailabilityResponseInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy