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

com.azure.resourcemanager.search.fluent.models.QuotaUsageResultInner Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Cognitive Search Management SDK. For documentation on how to use this package, please see https://aka.ms/azure-sdk-java-mgmt

There is a newer version: 2.45.0
Show 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.search.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.search.models.QuotaUsageResultName;
import java.io.IOException;

/**
 * Describes the quota usage for a particular SKU.
 */
@Fluent
public final class QuotaUsageResultInner implements JsonSerializable {
    /*
     * The resource ID of the quota usage SKU endpoint for Microsoft.Search provider.
     */
    private String id;

    /*
     * The unit of measurement for the search SKU.
     */
    private String unit;

    /*
     * The currently used up value for the particular search SKU.
     */
    private Integer currentValue;

    /*
     * The quota limit for the particular search SKU.
     */
    private Integer limit;

    /*
     * The name of the SKU supported by Azure AI Search.
     */
    private QuotaUsageResultName name;

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

    /**
     * Get the id property: The resource ID of the quota usage SKU endpoint for Microsoft.Search provider.
     * 
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Set the id property: The resource ID of the quota usage SKU endpoint for Microsoft.Search provider.
     * 
     * @param id the id value to set.
     * @return the QuotaUsageResultInner object itself.
     */
    public QuotaUsageResultInner withId(String id) {
        this.id = id;
        return this;
    }

    /**
     * Get the unit property: The unit of measurement for the search SKU.
     * 
     * @return the unit value.
     */
    public String unit() {
        return this.unit;
    }

    /**
     * Set the unit property: The unit of measurement for the search SKU.
     * 
     * @param unit the unit value to set.
     * @return the QuotaUsageResultInner object itself.
     */
    public QuotaUsageResultInner withUnit(String unit) {
        this.unit = unit;
        return this;
    }

    /**
     * Get the currentValue property: The currently used up value for the particular search SKU.
     * 
     * @return the currentValue value.
     */
    public Integer currentValue() {
        return this.currentValue;
    }

    /**
     * Set the currentValue property: The currently used up value for the particular search SKU.
     * 
     * @param currentValue the currentValue value to set.
     * @return the QuotaUsageResultInner object itself.
     */
    public QuotaUsageResultInner withCurrentValue(Integer currentValue) {
        this.currentValue = currentValue;
        return this;
    }

    /**
     * Get the limit property: The quota limit for the particular search SKU.
     * 
     * @return the limit value.
     */
    public Integer limit() {
        return this.limit;
    }

    /**
     * Set the limit property: The quota limit for the particular search SKU.
     * 
     * @param limit the limit value to set.
     * @return the QuotaUsageResultInner object itself.
     */
    public QuotaUsageResultInner withLimit(Integer limit) {
        this.limit = limit;
        return this;
    }

    /**
     * Get the name property: The name of the SKU supported by Azure AI Search.
     * 
     * @return the name value.
     */
    public QuotaUsageResultName name() {
        return this.name;
    }

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

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

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

                if ("id".equals(fieldName)) {
                    deserializedQuotaUsageResultInner.id = reader.getString();
                } else if ("unit".equals(fieldName)) {
                    deserializedQuotaUsageResultInner.unit = reader.getString();
                } else if ("currentValue".equals(fieldName)) {
                    deserializedQuotaUsageResultInner.currentValue = reader.getNullable(JsonReader::getInt);
                } else if ("limit".equals(fieldName)) {
                    deserializedQuotaUsageResultInner.limit = reader.getNullable(JsonReader::getInt);
                } else if ("name".equals(fieldName)) {
                    deserializedQuotaUsageResultInner.name = QuotaUsageResultName.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedQuotaUsageResultInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy