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

com.azure.resourcemanager.devcenter.models.EnvironmentDefinitionParameter Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.devcenter.models;

import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Properties of an Environment Definition parameter.
 */
@Immutable
public final class EnvironmentDefinitionParameter implements JsonSerializable {
    /*
     * Unique ID of the parameter
     */
    private String id;

    /*
     * Display name of the parameter
     */
    private String name;

    /*
     * Description of the parameter
     */
    private String description;

    /*
     * A string of one of the basic JSON types (number, integer, array, object, boolean, string)
     */
    private ParameterType type;

    /*
     * Whether or not this parameter is read-only. If true, default should have a value.
     */
    private Boolean readOnly;

    /*
     * Whether or not this parameter is required
     */
    private Boolean required;

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

    /**
     * Get the id property: Unique ID of the parameter.
     * 
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Get the name property: Display name of the parameter.
     * 
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Get the description property: Description of the parameter.
     * 
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Get the type property: A string of one of the basic JSON types (number, integer, array, object, boolean, string).
     * 
     * @return the type value.
     */
    public ParameterType type() {
        return this.type;
    }

    /**
     * Get the readOnly property: Whether or not this parameter is read-only. If true, default should have a value.
     * 
     * @return the readOnly value.
     */
    public Boolean readOnly() {
        return this.readOnly;
    }

    /**
     * Get the required property: Whether or not this parameter is required.
     * 
     * @return the required value.
     */
    public Boolean required() {
        return this.required;
    }

    /**
     * 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();
        return jsonWriter.writeEndObject();
    }

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

                if ("id".equals(fieldName)) {
                    deserializedEnvironmentDefinitionParameter.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedEnvironmentDefinitionParameter.name = reader.getString();
                } else if ("description".equals(fieldName)) {
                    deserializedEnvironmentDefinitionParameter.description = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedEnvironmentDefinitionParameter.type = ParameterType.fromString(reader.getString());
                } else if ("readOnly".equals(fieldName)) {
                    deserializedEnvironmentDefinitionParameter.readOnly = reader.getNullable(JsonReader::getBoolean);
                } else if ("required".equals(fieldName)) {
                    deserializedEnvironmentDefinitionParameter.required = reader.getNullable(JsonReader::getBoolean);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedEnvironmentDefinitionParameter;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy