com.azure.resourcemanager.netapp.models.MetricSpecification Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-netapp Show documentation
Show all versions of azure-resourcemanager-netapp Show documentation
This package contains Microsoft Azure SDK for NetAppFiles Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft NetApp Files Azure Resource Provider specification. Package tag package-2024-03.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.netapp.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;
/**
* Metric specification of operation.
*/
@Fluent
public final class MetricSpecification implements JsonSerializable {
/*
* Name of metric specification.
*/
private String name;
/*
* Display name of metric specification.
*/
private String displayName;
/*
* Display description of metric specification.
*/
private String displayDescription;
/*
* Unit could be Bytes or Count.
*/
private String unit;
/*
* Support metric aggregation type.
*/
private List supportedAggregationTypes;
/*
* The supported time grain types for the metrics.
*/
private List supportedTimeGrainTypes;
/*
* The internal metric name.
*/
private String internalMetricName;
/*
* Whether or not the service is using regional MDM accounts.
*/
private Boolean enableRegionalMdmAccount;
/*
* The source MDM account.
*/
private String sourceMdmAccount;
/*
* The source MDM namespace.
*/
private String sourceMdmNamespace;
/*
* Dimensions of blobs, including blob type and access tier.
*/
private List dimensions;
/*
* Aggregation type could be Average.
*/
private String aggregationType;
/*
* The property to decide fill gap with zero or not.
*/
private Boolean fillGapWithZero;
/*
* The category this metric specification belong to, could be Capacity.
*/
private String category;
/*
* Account Resource Id.
*/
private String resourceIdDimensionNameOverride;
/*
* Whether the metric is internal.
*/
private Boolean isInternal;
/**
* Creates an instance of MetricSpecification class.
*/
public MetricSpecification() {
}
/**
* Get the name property: Name of metric specification.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: Name of metric specification.
*
* @param name the name value to set.
* @return the MetricSpecification object itself.
*/
public MetricSpecification withName(String name) {
this.name = name;
return this;
}
/**
* Get the displayName property: Display name of metric specification.
*
* @return the displayName value.
*/
public String displayName() {
return this.displayName;
}
/**
* Set the displayName property: Display name of metric specification.
*
* @param displayName the displayName value to set.
* @return the MetricSpecification object itself.
*/
public MetricSpecification withDisplayName(String displayName) {
this.displayName = displayName;
return this;
}
/**
* Get the displayDescription property: Display description of metric specification.
*
* @return the displayDescription value.
*/
public String displayDescription() {
return this.displayDescription;
}
/**
* Set the displayDescription property: Display description of metric specification.
*
* @param displayDescription the displayDescription value to set.
* @return the MetricSpecification object itself.
*/
public MetricSpecification withDisplayDescription(String displayDescription) {
this.displayDescription = displayDescription;
return this;
}
/**
* Get the unit property: Unit could be Bytes or Count.
*
* @return the unit value.
*/
public String unit() {
return this.unit;
}
/**
* Set the unit property: Unit could be Bytes or Count.
*
* @param unit the unit value to set.
* @return the MetricSpecification object itself.
*/
public MetricSpecification withUnit(String unit) {
this.unit = unit;
return this;
}
/**
* Get the supportedAggregationTypes property: Support metric aggregation type.
*
* @return the supportedAggregationTypes value.
*/
public List supportedAggregationTypes() {
return this.supportedAggregationTypes;
}
/**
* Set the supportedAggregationTypes property: Support metric aggregation type.
*
* @param supportedAggregationTypes the supportedAggregationTypes value to set.
* @return the MetricSpecification object itself.
*/
public MetricSpecification withSupportedAggregationTypes(List supportedAggregationTypes) {
this.supportedAggregationTypes = supportedAggregationTypes;
return this;
}
/**
* Get the supportedTimeGrainTypes property: The supported time grain types for the metrics.
*
* @return the supportedTimeGrainTypes value.
*/
public List supportedTimeGrainTypes() {
return this.supportedTimeGrainTypes;
}
/**
* Set the supportedTimeGrainTypes property: The supported time grain types for the metrics.
*
* @param supportedTimeGrainTypes the supportedTimeGrainTypes value to set.
* @return the MetricSpecification object itself.
*/
public MetricSpecification withSupportedTimeGrainTypes(List supportedTimeGrainTypes) {
this.supportedTimeGrainTypes = supportedTimeGrainTypes;
return this;
}
/**
* Get the internalMetricName property: The internal metric name.
*
* @return the internalMetricName value.
*/
public String internalMetricName() {
return this.internalMetricName;
}
/**
* Set the internalMetricName property: The internal metric name.
*
* @param internalMetricName the internalMetricName value to set.
* @return the MetricSpecification object itself.
*/
public MetricSpecification withInternalMetricName(String internalMetricName) {
this.internalMetricName = internalMetricName;
return this;
}
/**
* Get the enableRegionalMdmAccount property: Whether or not the service is using regional MDM accounts.
*
* @return the enableRegionalMdmAccount value.
*/
public Boolean enableRegionalMdmAccount() {
return this.enableRegionalMdmAccount;
}
/**
* Set the enableRegionalMdmAccount property: Whether or not the service is using regional MDM accounts.
*
* @param enableRegionalMdmAccount the enableRegionalMdmAccount value to set.
* @return the MetricSpecification object itself.
*/
public MetricSpecification 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 MetricSpecification object itself.
*/
public MetricSpecification 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 MetricSpecification object itself.
*/
public MetricSpecification withSourceMdmNamespace(String sourceMdmNamespace) {
this.sourceMdmNamespace = sourceMdmNamespace;
return this;
}
/**
* Get the dimensions property: Dimensions of blobs, including blob type and access tier.
*
* @return the dimensions value.
*/
public List dimensions() {
return this.dimensions;
}
/**
* Set the dimensions property: Dimensions of blobs, including blob type and access tier.
*
* @param dimensions the dimensions value to set.
* @return the MetricSpecification object itself.
*/
public MetricSpecification withDimensions(List dimensions) {
this.dimensions = dimensions;
return this;
}
/**
* Get the aggregationType property: Aggregation type could be Average.
*
* @return the aggregationType value.
*/
public String aggregationType() {
return this.aggregationType;
}
/**
* Set the aggregationType property: Aggregation type could be Average.
*
* @param aggregationType the aggregationType value to set.
* @return the MetricSpecification object itself.
*/
public MetricSpecification withAggregationType(String aggregationType) {
this.aggregationType = aggregationType;
return this;
}
/**
* Get the fillGapWithZero property: The property to decide fill gap with zero or not.
*
* @return the fillGapWithZero value.
*/
public Boolean fillGapWithZero() {
return this.fillGapWithZero;
}
/**
* Set the fillGapWithZero property: The property to decide fill gap with zero or not.
*
* @param fillGapWithZero the fillGapWithZero value to set.
* @return the MetricSpecification object itself.
*/
public MetricSpecification withFillGapWithZero(Boolean fillGapWithZero) {
this.fillGapWithZero = fillGapWithZero;
return this;
}
/**
* Get the category property: The category this metric specification belong to, could be Capacity.
*
* @return the category value.
*/
public String category() {
return this.category;
}
/**
* Set the category property: The category this metric specification belong to, could be Capacity.
*
* @param category the category value to set.
* @return the MetricSpecification object itself.
*/
public MetricSpecification withCategory(String category) {
this.category = category;
return this;
}
/**
* Get the resourceIdDimensionNameOverride property: Account Resource Id.
*
* @return the resourceIdDimensionNameOverride value.
*/
public String resourceIdDimensionNameOverride() {
return this.resourceIdDimensionNameOverride;
}
/**
* Set the resourceIdDimensionNameOverride property: Account Resource Id.
*
* @param resourceIdDimensionNameOverride the resourceIdDimensionNameOverride value to set.
* @return the MetricSpecification object itself.
*/
public MetricSpecification withResourceIdDimensionNameOverride(String resourceIdDimensionNameOverride) {
this.resourceIdDimensionNameOverride = resourceIdDimensionNameOverride;
return this;
}
/**
* Get the isInternal property: Whether the metric is internal.
*
* @return the isInternal value.
*/
public Boolean isInternal() {
return this.isInternal;
}
/**
* Set the isInternal property: Whether the metric is internal.
*
* @param isInternal the isInternal value to set.
* @return the MetricSpecification object itself.
*/
public MetricSpecification withIsInternal(Boolean isInternal) {
this.isInternal = isInternal;
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.writeArrayField("supportedAggregationTypes", this.supportedAggregationTypes,
(writer, element) -> writer.writeString(element == null ? null : element.toString()));
jsonWriter.writeArrayField("supportedTimeGrainTypes", this.supportedTimeGrainTypes,
(writer, element) -> writer.writeString(element));
jsonWriter.writeStringField("internalMetricName", this.internalMetricName);
jsonWriter.writeBooleanField("enableRegionalMdmAccount", this.enableRegionalMdmAccount);
jsonWriter.writeStringField("sourceMdmAccount", this.sourceMdmAccount);
jsonWriter.writeStringField("sourceMdmNamespace", this.sourceMdmNamespace);
jsonWriter.writeArrayField("dimensions", this.dimensions, (writer, element) -> writer.writeJson(element));
jsonWriter.writeStringField("aggregationType", this.aggregationType);
jsonWriter.writeBooleanField("fillGapWithZero", this.fillGapWithZero);
jsonWriter.writeStringField("category", this.category);
jsonWriter.writeStringField("resourceIdDimensionNameOverride", this.resourceIdDimensionNameOverride);
jsonWriter.writeBooleanField("isInternal", this.isInternal);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of MetricSpecification from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of MetricSpecification 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 MetricSpecification.
*/
public static MetricSpecification fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
MetricSpecification deserializedMetricSpecification = new MetricSpecification();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("name".equals(fieldName)) {
deserializedMetricSpecification.name = reader.getString();
} else if ("displayName".equals(fieldName)) {
deserializedMetricSpecification.displayName = reader.getString();
} else if ("displayDescription".equals(fieldName)) {
deserializedMetricSpecification.displayDescription = reader.getString();
} else if ("unit".equals(fieldName)) {
deserializedMetricSpecification.unit = reader.getString();
} else if ("supportedAggregationTypes".equals(fieldName)) {
List supportedAggregationTypes
= reader.readArray(reader1 -> MetricAggregationType.fromString(reader1.getString()));
deserializedMetricSpecification.supportedAggregationTypes = supportedAggregationTypes;
} else if ("supportedTimeGrainTypes".equals(fieldName)) {
List supportedTimeGrainTypes = reader.readArray(reader1 -> reader1.getString());
deserializedMetricSpecification.supportedTimeGrainTypes = supportedTimeGrainTypes;
} else if ("internalMetricName".equals(fieldName)) {
deserializedMetricSpecification.internalMetricName = reader.getString();
} else if ("enableRegionalMdmAccount".equals(fieldName)) {
deserializedMetricSpecification.enableRegionalMdmAccount
= reader.getNullable(JsonReader::getBoolean);
} else if ("sourceMdmAccount".equals(fieldName)) {
deserializedMetricSpecification.sourceMdmAccount = reader.getString();
} else if ("sourceMdmNamespace".equals(fieldName)) {
deserializedMetricSpecification.sourceMdmNamespace = reader.getString();
} else if ("dimensions".equals(fieldName)) {
List dimensions = reader.readArray(reader1 -> Dimension.fromJson(reader1));
deserializedMetricSpecification.dimensions = dimensions;
} else if ("aggregationType".equals(fieldName)) {
deserializedMetricSpecification.aggregationType = reader.getString();
} else if ("fillGapWithZero".equals(fieldName)) {
deserializedMetricSpecification.fillGapWithZero = reader.getNullable(JsonReader::getBoolean);
} else if ("category".equals(fieldName)) {
deserializedMetricSpecification.category = reader.getString();
} else if ("resourceIdDimensionNameOverride".equals(fieldName)) {
deserializedMetricSpecification.resourceIdDimensionNameOverride = reader.getString();
} else if ("isInternal".equals(fieldName)) {
deserializedMetricSpecification.isInternal = reader.getNullable(JsonReader::getBoolean);
} else {
reader.skipChildren();
}
}
return deserializedMetricSpecification;
});
}
}