com.amazonaws.services.rds.model.Metric Maven / Gradle / Ivy
Show all versions of aws-java-sdk-rds Show documentation
/*
* Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.rds.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* The representation of a metric.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Metric implements Serializable, Cloneable {
/**
*
* The name of a metric.
*
*/
private String name;
/**
*
* A list of metric references (thresholds).
*
*/
private com.amazonaws.internal.SdkInternalList references;
/**
*
* The details of different statistics for a metric. The description might contain markdown.
*
*/
private String statisticsDetails;
/**
*
* The query to retrieve metric data points.
*
*/
private MetricQuery metricQuery;
/**
*
* The name of a metric.
*
*
* @param name
* The name of a metric.
*/
public void setName(String name) {
this.name = name;
}
/**
*
* The name of a metric.
*
*
* @return The name of a metric.
*/
public String getName() {
return this.name;
}
/**
*
* The name of a metric.
*
*
* @param name
* The name of a metric.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Metric withName(String name) {
setName(name);
return this;
}
/**
*
* A list of metric references (thresholds).
*
*
* @return A list of metric references (thresholds).
*/
public java.util.List getReferences() {
if (references == null) {
references = new com.amazonaws.internal.SdkInternalList();
}
return references;
}
/**
*
* A list of metric references (thresholds).
*
*
* @param references
* A list of metric references (thresholds).
*/
public void setReferences(java.util.Collection references) {
if (references == null) {
this.references = null;
return;
}
this.references = new com.amazonaws.internal.SdkInternalList(references);
}
/**
*
* A list of metric references (thresholds).
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setReferences(java.util.Collection)} or {@link #withReferences(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param references
* A list of metric references (thresholds).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Metric withReferences(MetricReference... references) {
if (this.references == null) {
setReferences(new com.amazonaws.internal.SdkInternalList(references.length));
}
for (MetricReference ele : references) {
this.references.add(ele);
}
return this;
}
/**
*
* A list of metric references (thresholds).
*
*
* @param references
* A list of metric references (thresholds).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Metric withReferences(java.util.Collection references) {
setReferences(references);
return this;
}
/**
*
* The details of different statistics for a metric. The description might contain markdown.
*
*
* @param statisticsDetails
* The details of different statistics for a metric. The description might contain markdown.
*/
public void setStatisticsDetails(String statisticsDetails) {
this.statisticsDetails = statisticsDetails;
}
/**
*
* The details of different statistics for a metric. The description might contain markdown.
*
*
* @return The details of different statistics for a metric. The description might contain markdown.
*/
public String getStatisticsDetails() {
return this.statisticsDetails;
}
/**
*
* The details of different statistics for a metric. The description might contain markdown.
*
*
* @param statisticsDetails
* The details of different statistics for a metric. The description might contain markdown.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Metric withStatisticsDetails(String statisticsDetails) {
setStatisticsDetails(statisticsDetails);
return this;
}
/**
*
* The query to retrieve metric data points.
*
*
* @param metricQuery
* The query to retrieve metric data points.
*/
public void setMetricQuery(MetricQuery metricQuery) {
this.metricQuery = metricQuery;
}
/**
*
* The query to retrieve metric data points.
*
*
* @return The query to retrieve metric data points.
*/
public MetricQuery getMetricQuery() {
return this.metricQuery;
}
/**
*
* The query to retrieve metric data points.
*
*
* @param metricQuery
* The query to retrieve metric data points.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Metric withMetricQuery(MetricQuery metricQuery) {
setMetricQuery(metricQuery);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getReferences() != null)
sb.append("References: ").append(getReferences()).append(",");
if (getStatisticsDetails() != null)
sb.append("StatisticsDetails: ").append(getStatisticsDetails()).append(",");
if (getMetricQuery() != null)
sb.append("MetricQuery: ").append(getMetricQuery());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Metric == false)
return false;
Metric other = (Metric) obj;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null && other.getName().equals(this.getName()) == false)
return false;
if (other.getReferences() == null ^ this.getReferences() == null)
return false;
if (other.getReferences() != null && other.getReferences().equals(this.getReferences()) == false)
return false;
if (other.getStatisticsDetails() == null ^ this.getStatisticsDetails() == null)
return false;
if (other.getStatisticsDetails() != null && other.getStatisticsDetails().equals(this.getStatisticsDetails()) == false)
return false;
if (other.getMetricQuery() == null ^ this.getMetricQuery() == null)
return false;
if (other.getMetricQuery() != null && other.getMetricQuery().equals(this.getMetricQuery()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getReferences() == null) ? 0 : getReferences().hashCode());
hashCode = prime * hashCode + ((getStatisticsDetails() == null) ? 0 : getStatisticsDetails().hashCode());
hashCode = prime * hashCode + ((getMetricQuery() == null) ? 0 : getMetricQuery().hashCode());
return hashCode;
}
@Override
public Metric clone() {
try {
return (Metric) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}