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

com.azure.resourcemanager.hdinsight.models.MetricSpecifications Maven / Gradle / Ivy

Go to download

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-2021-06.

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.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 details of metric specifications.
 */
@Fluent
public final class MetricSpecifications implements JsonSerializable {
    /*
     * The name of the metric specification.
     */
    private String name;

    /*
     * The display name of the metric specification.
     */
    private String displayName;

    /*
     * The display description of the metric specification.
     */
    private String displayDescription;

    /*
     * The unit of the metric specification.
     */
    private String unit;

    /*
     * The aggregation type of the metric specification.
     */
    private String aggregationType;

    /*
     * The supported aggregation types of the metric specification.
     */
    private List supportedAggregationTypes;

    /*
     * The supported time grain types of the metric specification.
     */
    private List supportedTimeGrainTypes;

    /*
     * The flag indicates whether enable regional mdm account or not.
     */
    private Boolean enableRegionalMdmAccount;

    /*
     * The source mdm account.
     */
    private String sourceMdmAccount;

    /*
     * The source mdm namespace.
     */
    private String sourceMdmNamespace;

    /*
     * The metric filter pattern.
     */
    private String metricFilterPattern;

    /*
     * The flag indicates whether filling gap with zero.
     */
    private Boolean fillGapWithZero;

    /*
     * The category of the metric.
     */
    private String category;

    /*
     * The override name of resource id dimension name.
     */
    private String resourceIdDimensionNameOverride;

    /*
     * The flag indicates whether the metric is internal or not.
     */
    private Boolean isInternal;

    /*
     * The override name of delegate metric.
     */
    private String delegateMetricNameOverride;

    /*
     * The dimensions of the metric specification.
     */
    private List dimensions;

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

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

    /**
     * Set the name property: The name of the metric specification.
     * 
     * @param name the name value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the displayName property: The display name of the metric specification.
     * 
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: The display name of the metric specification.
     * 
     * @param displayName the displayName value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get the displayDescription property: The display description of the metric specification.
     * 
     * @return the displayDescription value.
     */
    public String displayDescription() {
        return this.displayDescription;
    }

    /**
     * Set the displayDescription property: The display description of the metric specification.
     * 
     * @param displayDescription the displayDescription value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withDisplayDescription(String displayDescription) {
        this.displayDescription = displayDescription;
        return this;
    }

    /**
     * Get the unit property: The unit of the metric specification.
     * 
     * @return the unit value.
     */
    public String unit() {
        return this.unit;
    }

    /**
     * Set the unit property: The unit of the metric specification.
     * 
     * @param unit the unit value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withUnit(String unit) {
        this.unit = unit;
        return this;
    }

    /**
     * Get the aggregationType property: The aggregation type of the metric specification.
     * 
     * @return the aggregationType value.
     */
    public String aggregationType() {
        return this.aggregationType;
    }

    /**
     * Set the aggregationType property: The aggregation type of the metric specification.
     * 
     * @param aggregationType the aggregationType value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withAggregationType(String aggregationType) {
        this.aggregationType = aggregationType;
        return this;
    }

    /**
     * Get the supportedAggregationTypes property: The supported aggregation types of the metric specification.
     * 
     * @return the supportedAggregationTypes value.
     */
    public List supportedAggregationTypes() {
        return this.supportedAggregationTypes;
    }

    /**
     * Set the supportedAggregationTypes property: The supported aggregation types of the metric specification.
     * 
     * @param supportedAggregationTypes the supportedAggregationTypes value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withSupportedAggregationTypes(List supportedAggregationTypes) {
        this.supportedAggregationTypes = supportedAggregationTypes;
        return this;
    }

    /**
     * Get the supportedTimeGrainTypes property: The supported time grain types of the metric specification.
     * 
     * @return the supportedTimeGrainTypes value.
     */
    public List supportedTimeGrainTypes() {
        return this.supportedTimeGrainTypes;
    }

    /**
     * Set the supportedTimeGrainTypes property: The supported time grain types of the metric specification.
     * 
     * @param supportedTimeGrainTypes the supportedTimeGrainTypes value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withSupportedTimeGrainTypes(List supportedTimeGrainTypes) {
        this.supportedTimeGrainTypes = supportedTimeGrainTypes;
        return this;
    }

    /**
     * Get the enableRegionalMdmAccount property: The flag indicates whether enable regional mdm account or not.
     * 
     * @return the enableRegionalMdmAccount value.
     */
    public Boolean enableRegionalMdmAccount() {
        return this.enableRegionalMdmAccount;
    }

    /**
     * Set the enableRegionalMdmAccount property: The flag indicates whether enable regional mdm account or not.
     * 
     * @param enableRegionalMdmAccount the enableRegionalMdmAccount value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withEnableRegionalMdmAccount(Boolean enableRegionalMdmAccount) {
        this.enableRegionalMdmAccount = enableRegionalMdmAccount;
        return this;
    }

    /**
     * Get the sourceMdmAccount property: The source mdm account.
     * 
     * @return the sourceMdmAccount value.
     */
    public String sourceMdmAccount() {
        return this.sourceMdmAccount;
    }

    /**
     * Set the sourceMdmAccount property: The source mdm account.
     * 
     * @param sourceMdmAccount the sourceMdmAccount value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withSourceMdmAccount(String sourceMdmAccount) {
        this.sourceMdmAccount = sourceMdmAccount;
        return this;
    }

    /**
     * Get the sourceMdmNamespace property: The source mdm namespace.
     * 
     * @return the sourceMdmNamespace value.
     */
    public String sourceMdmNamespace() {
        return this.sourceMdmNamespace;
    }

    /**
     * Set the sourceMdmNamespace property: The source mdm namespace.
     * 
     * @param sourceMdmNamespace the sourceMdmNamespace value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withSourceMdmNamespace(String sourceMdmNamespace) {
        this.sourceMdmNamespace = sourceMdmNamespace;
        return this;
    }

    /**
     * Get the metricFilterPattern property: The metric filter pattern.
     * 
     * @return the metricFilterPattern value.
     */
    public String metricFilterPattern() {
        return this.metricFilterPattern;
    }

    /**
     * Set the metricFilterPattern property: The metric filter pattern.
     * 
     * @param metricFilterPattern the metricFilterPattern value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withMetricFilterPattern(String metricFilterPattern) {
        this.metricFilterPattern = metricFilterPattern;
        return this;
    }

    /**
     * Get the fillGapWithZero property: The flag indicates whether filling gap with zero.
     * 
     * @return the fillGapWithZero value.
     */
    public Boolean fillGapWithZero() {
        return this.fillGapWithZero;
    }

    /**
     * Set the fillGapWithZero property: The flag indicates whether filling gap with zero.
     * 
     * @param fillGapWithZero the fillGapWithZero value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withFillGapWithZero(Boolean fillGapWithZero) {
        this.fillGapWithZero = fillGapWithZero;
        return this;
    }

    /**
     * Get the category property: The category of the metric.
     * 
     * @return the category value.
     */
    public String category() {
        return this.category;
    }

    /**
     * Set the category property: The category of the metric.
     * 
     * @param category the category value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withCategory(String category) {
        this.category = category;
        return this;
    }

    /**
     * Get the resourceIdDimensionNameOverride property: The override name of resource id dimension name.
     * 
     * @return the resourceIdDimensionNameOverride value.
     */
    public String resourceIdDimensionNameOverride() {
        return this.resourceIdDimensionNameOverride;
    }

    /**
     * Set the resourceIdDimensionNameOverride property: The override name of resource id dimension name.
     * 
     * @param resourceIdDimensionNameOverride the resourceIdDimensionNameOverride value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withResourceIdDimensionNameOverride(String resourceIdDimensionNameOverride) {
        this.resourceIdDimensionNameOverride = resourceIdDimensionNameOverride;
        return this;
    }

    /**
     * Get the isInternal property: The flag indicates whether the metric is internal or not.
     * 
     * @return the isInternal value.
     */
    public Boolean isInternal() {
        return this.isInternal;
    }

    /**
     * Set the isInternal property: The flag indicates whether the metric is internal or not.
     * 
     * @param isInternal the isInternal value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withIsInternal(Boolean isInternal) {
        this.isInternal = isInternal;
        return this;
    }

    /**
     * Get the delegateMetricNameOverride property: The override name of delegate metric.
     * 
     * @return the delegateMetricNameOverride value.
     */
    public String delegateMetricNameOverride() {
        return this.delegateMetricNameOverride;
    }

    /**
     * Set the delegateMetricNameOverride property: The override name of delegate metric.
     * 
     * @param delegateMetricNameOverride the delegateMetricNameOverride value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withDelegateMetricNameOverride(String delegateMetricNameOverride) {
        this.delegateMetricNameOverride = delegateMetricNameOverride;
        return this;
    }

    /**
     * Get the dimensions property: The dimensions of the metric specification.
     * 
     * @return the dimensions value.
     */
    public List dimensions() {
        return this.dimensions;
    }

    /**
     * Set the dimensions property: The dimensions of the metric specification.
     * 
     * @param dimensions the dimensions value to set.
     * @return the MetricSpecifications object itself.
     */
    public MetricSpecifications withDimensions(List dimensions) {
        this.dimensions = dimensions;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("name", this.name);
        jsonWriter.writeStringField("displayName", this.displayName);
        jsonWriter.writeStringField("displayDescription", this.displayDescription);
        jsonWriter.writeStringField("unit", this.unit);
        jsonWriter.writeStringField("aggregationType", this.aggregationType);
        jsonWriter.writeArrayField("supportedAggregationTypes", this.supportedAggregationTypes,
            (writer, element) -> writer.writeString(element));
        jsonWriter.writeArrayField("supportedTimeGrainTypes", this.supportedTimeGrainTypes,
            (writer, element) -> writer.writeString(element));
        jsonWriter.writeBooleanField("enableRegionalMdmAccount", this.enableRegionalMdmAccount);
        jsonWriter.writeStringField("sourceMdmAccount", this.sourceMdmAccount);
        jsonWriter.writeStringField("sourceMdmNamespace", this.sourceMdmNamespace);
        jsonWriter.writeStringField("metricFilterPattern", this.metricFilterPattern);
        jsonWriter.writeBooleanField("fillGapWithZero", this.fillGapWithZero);
        jsonWriter.writeStringField("category", this.category);
        jsonWriter.writeStringField("resourceIdDimensionNameOverride", this.resourceIdDimensionNameOverride);
        jsonWriter.writeBooleanField("isInternal", this.isInternal);
        jsonWriter.writeStringField("delegateMetricNameOverride", this.delegateMetricNameOverride);
        jsonWriter.writeArrayField("dimensions", this.dimensions, (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("name".equals(fieldName)) {
                    deserializedMetricSpecifications.name = reader.getString();
                } else if ("displayName".equals(fieldName)) {
                    deserializedMetricSpecifications.displayName = reader.getString();
                } else if ("displayDescription".equals(fieldName)) {
                    deserializedMetricSpecifications.displayDescription = reader.getString();
                } else if ("unit".equals(fieldName)) {
                    deserializedMetricSpecifications.unit = reader.getString();
                } else if ("aggregationType".equals(fieldName)) {
                    deserializedMetricSpecifications.aggregationType = reader.getString();
                } else if ("supportedAggregationTypes".equals(fieldName)) {
                    List supportedAggregationTypes = reader.readArray(reader1 -> reader1.getString());
                    deserializedMetricSpecifications.supportedAggregationTypes = supportedAggregationTypes;
                } else if ("supportedTimeGrainTypes".equals(fieldName)) {
                    List supportedTimeGrainTypes = reader.readArray(reader1 -> reader1.getString());
                    deserializedMetricSpecifications.supportedTimeGrainTypes = supportedTimeGrainTypes;
                } else if ("enableRegionalMdmAccount".equals(fieldName)) {
                    deserializedMetricSpecifications.enableRegionalMdmAccount
                        = reader.getNullable(JsonReader::getBoolean);
                } else if ("sourceMdmAccount".equals(fieldName)) {
                    deserializedMetricSpecifications.sourceMdmAccount = reader.getString();
                } else if ("sourceMdmNamespace".equals(fieldName)) {
                    deserializedMetricSpecifications.sourceMdmNamespace = reader.getString();
                } else if ("metricFilterPattern".equals(fieldName)) {
                    deserializedMetricSpecifications.metricFilterPattern = reader.getString();
                } else if ("fillGapWithZero".equals(fieldName)) {
                    deserializedMetricSpecifications.fillGapWithZero = reader.getNullable(JsonReader::getBoolean);
                } else if ("category".equals(fieldName)) {
                    deserializedMetricSpecifications.category = reader.getString();
                } else if ("resourceIdDimensionNameOverride".equals(fieldName)) {
                    deserializedMetricSpecifications.resourceIdDimensionNameOverride = reader.getString();
                } else if ("isInternal".equals(fieldName)) {
                    deserializedMetricSpecifications.isInternal = reader.getNullable(JsonReader::getBoolean);
                } else if ("delegateMetricNameOverride".equals(fieldName)) {
                    deserializedMetricSpecifications.delegateMetricNameOverride = reader.getString();
                } else if ("dimensions".equals(fieldName)) {
                    List dimensions = reader.readArray(reader1 -> Dimension.fromJson(reader1));
                    deserializedMetricSpecifications.dimensions = dimensions;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedMetricSpecifications;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy