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

com.azure.resourcemanager.datafactory.models.OperationMetricDimension 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.datafactory.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;

/**
 * Defines the metric dimension.
 */
@Fluent
public final class OperationMetricDimension implements JsonSerializable {
    /*
     * The name of the dimension for the metric.
     */
    private String name;

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

    /*
     * Whether the dimension should be exported to Azure Monitor.
     */
    private Boolean toBeExportedForShoebox;

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

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

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

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

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

    /**
     * Get the toBeExportedForShoebox property: Whether the dimension should be exported to Azure Monitor.
     * 
     * @return the toBeExportedForShoebox value.
     */
    public Boolean toBeExportedForShoebox() {
        return this.toBeExportedForShoebox;
    }

    /**
     * Set the toBeExportedForShoebox property: Whether the dimension should be exported to Azure Monitor.
     * 
     * @param toBeExportedForShoebox the toBeExportedForShoebox value to set.
     * @return the OperationMetricDimension object itself.
     */
    public OperationMetricDimension withToBeExportedForShoebox(Boolean toBeExportedForShoebox) {
        this.toBeExportedForShoebox = toBeExportedForShoebox;
        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.writeStringField("name", this.name);
        jsonWriter.writeStringField("displayName", this.displayName);
        jsonWriter.writeBooleanField("toBeExportedForShoebox", this.toBeExportedForShoebox);
        return jsonWriter.writeEndObject();
    }

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

                if ("name".equals(fieldName)) {
                    deserializedOperationMetricDimension.name = reader.getString();
                } else if ("displayName".equals(fieldName)) {
                    deserializedOperationMetricDimension.displayName = reader.getString();
                } else if ("toBeExportedForShoebox".equals(fieldName)) {
                    deserializedOperationMetricDimension.toBeExportedForShoebox
                        = reader.getNullable(JsonReader::getBoolean);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedOperationMetricDimension;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy