com.nutanix.dp1.pri.prism.v4.common.MetricDetail Maven / Gradle / Ivy
/*
* Generated file ..
*
* Product version: 4.0.3-alpha-2
*
* Part of the Nutanix Prism Versioned APIs
*
* (c) 2023 Nutanix Inc. All rights reserved
*
*/
package com.nutanix.dp1.pri.prism.v4.common;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.AccessLevel;
import com.nutanix.devplatform.models.PrettyModeViews.*;
import com.fasterxml.jackson.annotation.JsonView;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.nutanix.dp1.pri.deserializers.PriObjectTypeTypedObject;
import javax.validation.constraints.*;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.nutanix.dp1.pri.deserializers.PriDeserializerUtils.*;
@Data
@lombok.extern.slf4j.Slf4j
public class MetricDetail implements java.io.Serializable, PriObjectTypeTypedObject {
public MetricDetail() {
this.$objectType = this.initialize$objectType();
this.$reserved = new java.util.LinkedHashMap<>();
this.$reserved.put("$fqObjectType", this.initialize$fqObjectType());
this.$unknownFields = new java.util.LinkedHashMap<>();
}
@lombok.Builder(builderMethodName = "MetricDetailBuilder")
public MetricDetail(String metricName, String metricDisplayName, String unit, Long triggerWaitTime, java.time.OffsetDateTime triggerTime, com.nutanix.dp1.pri.prism.v4.common.ComparisonOperator comparisonOperator, com.nutanix.dp1.pri.prism.v4.common.ConditionType conditionType, String metricCategory, com.nutanix.dp1.pri.prism.v4.common.DataType dataType, Object thresholdValue, Object metricValue) {
this.$objectType = this.initialize$objectType();
this.$reserved = new java.util.LinkedHashMap<>();
this.$reserved.put("$fqObjectType", this.initialize$fqObjectType());
this.$unknownFields = new java.util.LinkedHashMap<>();
this.setMetricName(metricName);
this.setMetricDisplayName(metricDisplayName);
this.setUnit(unit);
this.setTriggerWaitTime(triggerWaitTime);
this.setTriggerTime(triggerTime);
this.setComparisonOperator(comparisonOperator);
this.setConditionType(conditionType);
this.setMetricCategory(metricCategory);
this.setDataType(dataType);
this.setThresholdValueInWrapper(thresholdValue);
this.setMetricValueInWrapper(metricValue);
}
protected String initialize$objectType() {
return "prism.v4.common.MetricDetail";
}
protected String initialize$fqObjectType() {
return "prism.v4.r0.a2.common.MetricDetail";
}
@JsonAnySetter
private void setUndeserializedFields(String name, String value) {
$unknownFields.put(name, value);
}
/**
* The metric key. Allowed values of metrics list can be found at https://portal.nutanix.com/page/documents/details?targetId=Prism-Central-Guide-vpc_2022_9:mul-alerts-user-created-metrics-r.html
*/
@JsonProperty("metricName")
public String metricName = null;
/**
* English readable name of the metric.
*/
@JsonProperty("metricDisplayName")
public String metricDisplayName = null;
/**
* Unit of the metric. For example, percentage, ms, usecs and so on.
*/
@JsonProperty("unit")
public String unit = null;
/**
* How long the metric breached the given condition before raising an event.
*/
@JsonProperty("triggerWaitTime")
public Long triggerWaitTime = null;
/**
* The time in ISO 8601 format when the event was triggered.
*/
@JsonProperty("triggerTime")
public OffsetDateTime triggerTime = null;
/**
*
*/
@JsonProperty("comparisonOperator")
public com.nutanix.dp1.pri.prism.v4.common.ComparisonOperator comparisonOperator = null;
/**
*
*/
@JsonProperty("conditionType")
public com.nutanix.dp1.pri.prism.v4.common.ConditionType conditionType = null;
/**
* Broad category under which this metric falls. For example, Disk, CPU, Memory and so on.
*/
@JsonProperty("metricCategory")
public String metricCategory = null;
/**
*
*/
@JsonProperty("dataType")
public com.nutanix.dp1.pri.prism.v4.common.DataType dataType = null;
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
@Getter
private String $thresholdValueItemDiscriminator = null;
@Data
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(using = OneOfThresholdValueWrapper.OneOfThresholdValueWrapperJsonDeserializer.class)
public static class OneOfThresholdValueWrapper {
public OneOfThresholdValueWrapper() {
}
public OneOfThresholdValueWrapper(com.nutanix.dp1.pri.prism.v4.common.StringValue data) {
this.oneOfType0 = data;
this.discriminator = data.get$objectType();
this.$objectType = data.get$objectType();
}
public OneOfThresholdValueWrapper(com.nutanix.dp1.pri.prism.v4.common.BoolValue data) {
this.oneOfType1 = data;
this.discriminator = data.get$objectType();
this.$objectType = data.get$objectType();
}
public OneOfThresholdValueWrapper(com.nutanix.dp1.pri.prism.v4.common.DoubleValue data) {
this.oneOfType2 = data;
this.discriminator = data.get$objectType();
this.$objectType = data.get$objectType();
}
public OneOfThresholdValueWrapper(com.nutanix.dp1.pri.prism.v4.common.IntValue data) {
this.oneOfType3 = data;
this.discriminator = data.get$objectType();
this.$objectType = data.get$objectType();
}
@com.nutanix.dp1.pri.annotations.PriJsonDeserializer
@org.springframework.stereotype.Component("com.nutanix.dp1.pri.prism.v4.common.MetricDetailJsonDeserializer")
private static class OneOfThresholdValueWrapperJsonDeserializer extends com.nutanix.dp1.pri.deserializers.PriOneOfDeserializer {
private static final com.fasterxml.jackson.databind.type.TypeFactory TYPE_FACTORY = com.fasterxml.jackson.databind.type.TypeFactory.defaultInstance();
private static final com.fasterxml.jackson.databind.JavaType ONE_OF_TYPE0 = TYPE_FACTORY.constructType(com.nutanix.dp1.pri.prism.v4.common.StringValue.class);
private static final com.fasterxml.jackson.databind.JavaType ONE_OF_TYPE1 = TYPE_FACTORY.constructType(com.nutanix.dp1.pri.prism.v4.common.BoolValue.class);
private static final com.fasterxml.jackson.databind.JavaType ONE_OF_TYPE2 = TYPE_FACTORY.constructType(com.nutanix.dp1.pri.prism.v4.common.DoubleValue.class);
private static final com.fasterxml.jackson.databind.JavaType ONE_OF_TYPE3 = TYPE_FACTORY.constructType(com.nutanix.dp1.pri.prism.v4.common.IntValue.class);
public OneOfThresholdValueWrapperJsonDeserializer() {
super(TYPE_FACTORY.constructType(OneOfThresholdValueWrapper.class));
}
@Override
protected void setDataObject(OneOfThresholdValueWrapper oneOfObject, Object nestedObject) {
if (oneOfObject == null) {
throw new IllegalArgumentException("Instance of OneOfThresholdValueWrapper provided is null");
}
if(ONE_OF_TYPE0.getRawClass().isAssignableFrom(nestedObject.getClass())) {
oneOfObject.setValue(nestedObject);
}
else if(ONE_OF_TYPE1.getRawClass().isAssignableFrom(nestedObject.getClass())) {
oneOfObject.setValue(nestedObject);
}
else if(ONE_OF_TYPE2.getRawClass().isAssignableFrom(nestedObject.getClass())) {
oneOfObject.setValue(nestedObject);
}
else if(ONE_OF_TYPE3.getRawClass().isAssignableFrom(nestedObject.getClass())) {
oneOfObject.setValue(nestedObject);
}
else {
throw new IllegalArgumentException("Attempting to set unsupported object type in OneOfThresholdValueWrapper:" + nestedObject.getClass().getName());
}
}
public String getPackagePrefix() {
return "com.nutanix.dp1.pri";
}
}
@com.fasterxml.jackson.annotation.JsonIgnore
@lombok.Getter(lombok.AccessLevel.NONE)
@lombok.Setter(lombok.AccessLevel.NONE)
private com.nutanix.dp1.pri.prism.v4.common.StringValue oneOfType0;
@com.fasterxml.jackson.annotation.JsonIgnore
@lombok.Getter(lombok.AccessLevel.NONE)
@lombok.Setter(lombok.AccessLevel.NONE)
private com.nutanix.dp1.pri.prism.v4.common.BoolValue oneOfType1;
@com.fasterxml.jackson.annotation.JsonIgnore
@lombok.Getter(lombok.AccessLevel.NONE)
@lombok.Setter(lombok.AccessLevel.NONE)
private com.nutanix.dp1.pri.prism.v4.common.DoubleValue oneOfType2;
@com.fasterxml.jackson.annotation.JsonIgnore
@lombok.Getter(lombok.AccessLevel.NONE)
@lombok.Setter(lombok.AccessLevel.NONE)
private com.nutanix.dp1.pri.prism.v4.common.IntValue oneOfType3;
@lombok.Setter(lombok.AccessLevel.NONE)
private String discriminator;
@com.fasterxml.jackson.annotation.JsonIgnore
@lombok.Setter(lombok.AccessLevel.NONE)
private String $objectType;
@com.fasterxml.jackson.annotation.JsonGetter
public Object getValue() {
if(oneOfType0 != null && oneOfType0.get$objectType().equals(this.discriminator)) {
return this.oneOfType0;
}
if(oneOfType1 != null && oneOfType1.get$objectType().equals(this.discriminator)) {
return this.oneOfType1;
}
if(oneOfType2 != null && oneOfType2.get$objectType().equals(this.discriminator)) {
return this.oneOfType2;
}
if(oneOfType3 != null && oneOfType3.get$objectType().equals(this.discriminator)) {
return this.oneOfType3;
}
throw new IllegalArgumentException("Unrecognized discriminator:" + this.discriminator);
}
public void setValue(Object value) {
if(value == null) {
log.warn("null passed to setValue function. OneOf's value will not be set.");
return;
}
if(com.nutanix.dp1.pri.prism.v4.common.StringValue.class.getName().equals(value.getClass().getName())) {
this.oneOfType0 = (com.nutanix.dp1.pri.prism.v4.common.StringValue) value;
this.discriminator = this.oneOfType0.get$objectType();
this.$objectType = this.oneOfType0.get$objectType();
return;
}
if(com.nutanix.dp1.pri.prism.v4.common.BoolValue.class.getName().equals(value.getClass().getName())) {
this.oneOfType1 = (com.nutanix.dp1.pri.prism.v4.common.BoolValue) value;
this.discriminator = this.oneOfType1.get$objectType();
this.$objectType = this.oneOfType1.get$objectType();
return;
}
if(com.nutanix.dp1.pri.prism.v4.common.DoubleValue.class.getName().equals(value.getClass().getName())) {
this.oneOfType2 = (com.nutanix.dp1.pri.prism.v4.common.DoubleValue) value;
this.discriminator = this.oneOfType2.get$objectType();
this.$objectType = this.oneOfType2.get$objectType();
return;
}
if(com.nutanix.dp1.pri.prism.v4.common.IntValue.class.getName().equals(value.getClass().getName())) {
this.oneOfType3 = (com.nutanix.dp1.pri.prism.v4.common.IntValue) value;
this.discriminator = this.oneOfType3.get$objectType();
this.$objectType = this.oneOfType3.get$objectType();
return;
}
throw new IllegalArgumentException("Attempting to set unsupported object type in OneOfThresholdValueWrapper:" + value.getClass().getName());
}
}
private OneOfThresholdValueWrapper thresholdValue = null;
/**
* @deprecated
* @param value one of wrapper instance
*/
public void setThresholdValue(OneOfThresholdValueWrapper value) {
log.warn("Deprecating this method, please use setDataInWrapper instead");
if (value == null) {
return;
}
this.thresholdValue = value;
this.$thresholdValueItemDiscriminator = this.thresholdValue.getDiscriminator();
}
/**
* @param value value of one of field thresholdValue
*/
@com.fasterxml.jackson.annotation.JsonIgnore
public void setThresholdValueInWrapper(Object value) {
if (value == null) {
return;
}
if (this.thresholdValue == null) {
this.thresholdValue = new OneOfThresholdValueWrapper();
}
this.thresholdValue.setValue(value);
this.$thresholdValueItemDiscriminator = this.thresholdValue.getDiscriminator();
}
/**
* Get thresholdValue in one of possible types :
*
* - com.nutanix.dp1.pri.prism.v4.common.StringValue
* - com.nutanix.dp1.pri.prism.v4.common.BoolValue
* - com.nutanix.dp1.pri.prism.v4.common.DoubleValue
* - com.nutanix.dp1.pri.prism.v4.common.IntValue
*
* @return Object
*/
@com.fasterxml.jackson.databind.annotation.JsonSerialize(using = com.nutanix.dp1.pri.serializers.PriOneOfSerializer.class)
public Object getThresholdValue() {
if (this.thresholdValue == null) {
log.debug("OneOf property thresholdValue was never set. Returning null...");
return null;
}
return this.thresholdValue.getValue();
}
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
@Getter
private String $metricValueItemDiscriminator = null;
@Data
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(using = OneOfMetricValueWrapper.OneOfMetricValueWrapperJsonDeserializer.class)
public static class OneOfMetricValueWrapper {
public OneOfMetricValueWrapper() {
}
public OneOfMetricValueWrapper(com.nutanix.dp1.pri.prism.v4.common.StringValue data) {
this.oneOfType0 = data;
this.discriminator = data.get$objectType();
this.$objectType = data.get$objectType();
}
public OneOfMetricValueWrapper(com.nutanix.dp1.pri.prism.v4.common.BoolValue data) {
this.oneOfType1 = data;
this.discriminator = data.get$objectType();
this.$objectType = data.get$objectType();
}
public OneOfMetricValueWrapper(com.nutanix.dp1.pri.prism.v4.common.DoubleValue data) {
this.oneOfType2 = data;
this.discriminator = data.get$objectType();
this.$objectType = data.get$objectType();
}
public OneOfMetricValueWrapper(com.nutanix.dp1.pri.prism.v4.common.IntValue data) {
this.oneOfType3 = data;
this.discriminator = data.get$objectType();
this.$objectType = data.get$objectType();
}
@com.nutanix.dp1.pri.annotations.PriJsonDeserializer
@org.springframework.stereotype.Component("com.nutanix.dp1.pri.prism.v4.common.MetricDetailJsonDeserializer")
private static class OneOfMetricValueWrapperJsonDeserializer extends com.nutanix.dp1.pri.deserializers.PriOneOfDeserializer {
private static final com.fasterxml.jackson.databind.type.TypeFactory TYPE_FACTORY = com.fasterxml.jackson.databind.type.TypeFactory.defaultInstance();
private static final com.fasterxml.jackson.databind.JavaType ONE_OF_TYPE0 = TYPE_FACTORY.constructType(com.nutanix.dp1.pri.prism.v4.common.StringValue.class);
private static final com.fasterxml.jackson.databind.JavaType ONE_OF_TYPE1 = TYPE_FACTORY.constructType(com.nutanix.dp1.pri.prism.v4.common.BoolValue.class);
private static final com.fasterxml.jackson.databind.JavaType ONE_OF_TYPE2 = TYPE_FACTORY.constructType(com.nutanix.dp1.pri.prism.v4.common.DoubleValue.class);
private static final com.fasterxml.jackson.databind.JavaType ONE_OF_TYPE3 = TYPE_FACTORY.constructType(com.nutanix.dp1.pri.prism.v4.common.IntValue.class);
public OneOfMetricValueWrapperJsonDeserializer() {
super(TYPE_FACTORY.constructType(OneOfMetricValueWrapper.class));
}
@Override
protected void setDataObject(OneOfMetricValueWrapper oneOfObject, Object nestedObject) {
if (oneOfObject == null) {
throw new IllegalArgumentException("Instance of OneOfMetricValueWrapper provided is null");
}
if(ONE_OF_TYPE0.getRawClass().isAssignableFrom(nestedObject.getClass())) {
oneOfObject.setValue(nestedObject);
}
else if(ONE_OF_TYPE1.getRawClass().isAssignableFrom(nestedObject.getClass())) {
oneOfObject.setValue(nestedObject);
}
else if(ONE_OF_TYPE2.getRawClass().isAssignableFrom(nestedObject.getClass())) {
oneOfObject.setValue(nestedObject);
}
else if(ONE_OF_TYPE3.getRawClass().isAssignableFrom(nestedObject.getClass())) {
oneOfObject.setValue(nestedObject);
}
else {
throw new IllegalArgumentException("Attempting to set unsupported object type in OneOfMetricValueWrapper:" + nestedObject.getClass().getName());
}
}
public String getPackagePrefix() {
return "com.nutanix.dp1.pri";
}
}
@com.fasterxml.jackson.annotation.JsonIgnore
@lombok.Getter(lombok.AccessLevel.NONE)
@lombok.Setter(lombok.AccessLevel.NONE)
private com.nutanix.dp1.pri.prism.v4.common.StringValue oneOfType0;
@com.fasterxml.jackson.annotation.JsonIgnore
@lombok.Getter(lombok.AccessLevel.NONE)
@lombok.Setter(lombok.AccessLevel.NONE)
private com.nutanix.dp1.pri.prism.v4.common.BoolValue oneOfType1;
@com.fasterxml.jackson.annotation.JsonIgnore
@lombok.Getter(lombok.AccessLevel.NONE)
@lombok.Setter(lombok.AccessLevel.NONE)
private com.nutanix.dp1.pri.prism.v4.common.DoubleValue oneOfType2;
@com.fasterxml.jackson.annotation.JsonIgnore
@lombok.Getter(lombok.AccessLevel.NONE)
@lombok.Setter(lombok.AccessLevel.NONE)
private com.nutanix.dp1.pri.prism.v4.common.IntValue oneOfType3;
@lombok.Setter(lombok.AccessLevel.NONE)
private String discriminator;
@com.fasterxml.jackson.annotation.JsonIgnore
@lombok.Setter(lombok.AccessLevel.NONE)
private String $objectType;
@com.fasterxml.jackson.annotation.JsonGetter
public Object getValue() {
if(oneOfType0 != null && oneOfType0.get$objectType().equals(this.discriminator)) {
return this.oneOfType0;
}
if(oneOfType1 != null && oneOfType1.get$objectType().equals(this.discriminator)) {
return this.oneOfType1;
}
if(oneOfType2 != null && oneOfType2.get$objectType().equals(this.discriminator)) {
return this.oneOfType2;
}
if(oneOfType3 != null && oneOfType3.get$objectType().equals(this.discriminator)) {
return this.oneOfType3;
}
throw new IllegalArgumentException("Unrecognized discriminator:" + this.discriminator);
}
public void setValue(Object value) {
if(value == null) {
log.warn("null passed to setValue function. OneOf's value will not be set.");
return;
}
if(com.nutanix.dp1.pri.prism.v4.common.StringValue.class.getName().equals(value.getClass().getName())) {
this.oneOfType0 = (com.nutanix.dp1.pri.prism.v4.common.StringValue) value;
this.discriminator = this.oneOfType0.get$objectType();
this.$objectType = this.oneOfType0.get$objectType();
return;
}
if(com.nutanix.dp1.pri.prism.v4.common.BoolValue.class.getName().equals(value.getClass().getName())) {
this.oneOfType1 = (com.nutanix.dp1.pri.prism.v4.common.BoolValue) value;
this.discriminator = this.oneOfType1.get$objectType();
this.$objectType = this.oneOfType1.get$objectType();
return;
}
if(com.nutanix.dp1.pri.prism.v4.common.DoubleValue.class.getName().equals(value.getClass().getName())) {
this.oneOfType2 = (com.nutanix.dp1.pri.prism.v4.common.DoubleValue) value;
this.discriminator = this.oneOfType2.get$objectType();
this.$objectType = this.oneOfType2.get$objectType();
return;
}
if(com.nutanix.dp1.pri.prism.v4.common.IntValue.class.getName().equals(value.getClass().getName())) {
this.oneOfType3 = (com.nutanix.dp1.pri.prism.v4.common.IntValue) value;
this.discriminator = this.oneOfType3.get$objectType();
this.$objectType = this.oneOfType3.get$objectType();
return;
}
throw new IllegalArgumentException("Attempting to set unsupported object type in OneOfMetricValueWrapper:" + value.getClass().getName());
}
}
private OneOfMetricValueWrapper metricValue = null;
/**
* @deprecated
* @param value one of wrapper instance
*/
public void setMetricValue(OneOfMetricValueWrapper value) {
log.warn("Deprecating this method, please use setDataInWrapper instead");
if (value == null) {
return;
}
this.metricValue = value;
this.$metricValueItemDiscriminator = this.metricValue.getDiscriminator();
}
/**
* @param value value of one of field metricValue
*/
@com.fasterxml.jackson.annotation.JsonIgnore
public void setMetricValueInWrapper(Object value) {
if (value == null) {
return;
}
if (this.metricValue == null) {
this.metricValue = new OneOfMetricValueWrapper();
}
this.metricValue.setValue(value);
this.$metricValueItemDiscriminator = this.metricValue.getDiscriminator();
}
/**
* Get metricValue in one of possible types :
*
* - com.nutanix.dp1.pri.prism.v4.common.StringValue
* - com.nutanix.dp1.pri.prism.v4.common.BoolValue
* - com.nutanix.dp1.pri.prism.v4.common.DoubleValue
* - com.nutanix.dp1.pri.prism.v4.common.IntValue
*
* @return Object
*/
@com.fasterxml.jackson.databind.annotation.JsonSerialize(using = com.nutanix.dp1.pri.serializers.PriOneOfSerializer.class)
public Object getMetricValue() {
if (this.metricValue == null) {
log.debug("OneOf property metricValue was never set. Returning null...");
return null;
}
return this.metricValue.getValue();
}
@Getter
@JsonView({StandardView.class})
protected final Map $reserved;
@Getter
@JsonView({StandardView.class})
protected final String $objectType;
@Getter
@JsonView({StandardView.class})
protected final Map $unknownFields;
}