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

com.azure.resourcemanager.sql.models.ElasticPoolPerDatabaseMaxPerformanceLevelCapability Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Sql Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt

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.sql.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;

/**
 * The max per-database performance level capability.
 */
@Fluent
public final class ElasticPoolPerDatabaseMaxPerformanceLevelCapability
    implements JsonSerializable {
    /*
     * The maximum performance level per database.
     */
    private Double limit;

    /*
     * Unit type used to measure performance level.
     */
    private PerformanceLevelUnit unit;

    /*
     * The list of supported min database performance levels.
     */
    private List supportedPerDatabaseMinPerformanceLevels;

    /*
     * The status of the capability.
     */
    private CapabilityStatus status;

    /*
     * The reason for the capability not being available.
     */
    private String reason;

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

    /**
     * Get the limit property: The maximum performance level per database.
     * 
     * @return the limit value.
     */
    public Double limit() {
        return this.limit;
    }

    /**
     * Get the unit property: Unit type used to measure performance level.
     * 
     * @return the unit value.
     */
    public PerformanceLevelUnit unit() {
        return this.unit;
    }

    /**
     * Get the supportedPerDatabaseMinPerformanceLevels property: The list of supported min database performance levels.
     * 
     * @return the supportedPerDatabaseMinPerformanceLevels value.
     */
    public List supportedPerDatabaseMinPerformanceLevels() {
        return this.supportedPerDatabaseMinPerformanceLevels;
    }

    /**
     * Get the status property: The status of the capability.
     * 
     * @return the status value.
     */
    public CapabilityStatus status() {
        return this.status;
    }

    /**
     * Get the reason property: The reason for the capability not being available.
     * 
     * @return the reason value.
     */
    public String reason() {
        return this.reason;
    }

    /**
     * Set the reason property: The reason for the capability not being available.
     * 
     * @param reason the reason value to set.
     * @return the ElasticPoolPerDatabaseMaxPerformanceLevelCapability object itself.
     */
    public ElasticPoolPerDatabaseMaxPerformanceLevelCapability withReason(String reason) {
        this.reason = reason;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (supportedPerDatabaseMinPerformanceLevels() != null) {
            supportedPerDatabaseMinPerformanceLevels().forEach(e -> e.validate());
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("reason", this.reason);
        return jsonWriter.writeEndObject();
    }

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

                if ("limit".equals(fieldName)) {
                    deserializedElasticPoolPerDatabaseMaxPerformanceLevelCapability.limit
                        = reader.getNullable(JsonReader::getDouble);
                } else if ("unit".equals(fieldName)) {
                    deserializedElasticPoolPerDatabaseMaxPerformanceLevelCapability.unit
                        = PerformanceLevelUnit.fromString(reader.getString());
                } else if ("supportedPerDatabaseMinPerformanceLevels".equals(fieldName)) {
                    List supportedPerDatabaseMinPerformanceLevels
                        = reader.readArray(
                            reader1 -> ElasticPoolPerDatabaseMinPerformanceLevelCapability.fromJson(reader1));
                    deserializedElasticPoolPerDatabaseMaxPerformanceLevelCapability.supportedPerDatabaseMinPerformanceLevels
                        = supportedPerDatabaseMinPerformanceLevels;
                } else if ("status".equals(fieldName)) {
                    deserializedElasticPoolPerDatabaseMaxPerformanceLevelCapability.status
                        = CapabilityStatus.fromString(reader.getString());
                } else if ("reason".equals(fieldName)) {
                    deserializedElasticPoolPerDatabaseMaxPerformanceLevelCapability.reason = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedElasticPoolPerDatabaseMaxPerformanceLevelCapability;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy