com.amazonaws.services.cloudwatch.model.MetricDataResult Maven / Gradle / Ivy
Show all versions of aws-java-sdk-cloudwatch 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.cloudwatch.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* A GetMetricData
call returns an array of MetricDataResult
structures. Each of these
* structures includes the data points for that metric, along with the timestamps of those data points and other
* identifying information.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class MetricDataResult implements Serializable, Cloneable {
/**
*
* The short name you specified to represent this metric.
*
*/
private String id;
/**
*
* The human-readable label associated with the data.
*
*/
private String label;
/**
*
* The timestamps for the data points, formatted in Unix timestamp format. The number of timestamps always matches
* the number of values and the value for Timestamps[x] is Values[x].
*
*/
private com.amazonaws.internal.SdkInternalList timestamps;
/**
*
* The data points for the metric corresponding to Timestamps
. The number of values always matches the
* number of timestamps and the timestamp for Values[x] is Timestamps[x].
*
*/
private com.amazonaws.internal.SdkInternalList values;
/**
*
* The status of the returned data. Complete
indicates that all data points in the requested time range
* were returned. PartialData
means that an incomplete set of data points were returned. You can use
* the NextToken
value that was returned and repeat your request to get more data points.
* NextToken
is not returned if you are performing a math expression. InternalError
* indicates that an error occurred. Retry your request using NextToken
, if present.
*
*/
private String statusCode;
/**
*
* A list of messages with additional information about the data returned.
*
*/
private com.amazonaws.internal.SdkInternalList messages;
/**
*
* The short name you specified to represent this metric.
*
*
* @param id
* The short name you specified to represent this metric.
*/
public void setId(String id) {
this.id = id;
}
/**
*
* The short name you specified to represent this metric.
*
*
* @return The short name you specified to represent this metric.
*/
public String getId() {
return this.id;
}
/**
*
* The short name you specified to represent this metric.
*
*
* @param id
* The short name you specified to represent this metric.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public MetricDataResult withId(String id) {
setId(id);
return this;
}
/**
*
* The human-readable label associated with the data.
*
*
* @param label
* The human-readable label associated with the data.
*/
public void setLabel(String label) {
this.label = label;
}
/**
*
* The human-readable label associated with the data.
*
*
* @return The human-readable label associated with the data.
*/
public String getLabel() {
return this.label;
}
/**
*
* The human-readable label associated with the data.
*
*
* @param label
* The human-readable label associated with the data.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public MetricDataResult withLabel(String label) {
setLabel(label);
return this;
}
/**
*
* The timestamps for the data points, formatted in Unix timestamp format. The number of timestamps always matches
* the number of values and the value for Timestamps[x] is Values[x].
*
*
* @return The timestamps for the data points, formatted in Unix timestamp format. The number of timestamps always
* matches the number of values and the value for Timestamps[x] is Values[x].
*/
public java.util.List getTimestamps() {
if (timestamps == null) {
timestamps = new com.amazonaws.internal.SdkInternalList();
}
return timestamps;
}
/**
*
* The timestamps for the data points, formatted in Unix timestamp format. The number of timestamps always matches
* the number of values and the value for Timestamps[x] is Values[x].
*
*
* @param timestamps
* The timestamps for the data points, formatted in Unix timestamp format. The number of timestamps always
* matches the number of values and the value for Timestamps[x] is Values[x].
*/
public void setTimestamps(java.util.Collection timestamps) {
if (timestamps == null) {
this.timestamps = null;
return;
}
this.timestamps = new com.amazonaws.internal.SdkInternalList(timestamps);
}
/**
*
* The timestamps for the data points, formatted in Unix timestamp format. The number of timestamps always matches
* the number of values and the value for Timestamps[x] is Values[x].
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setTimestamps(java.util.Collection)} or {@link #withTimestamps(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param timestamps
* The timestamps for the data points, formatted in Unix timestamp format. The number of timestamps always
* matches the number of values and the value for Timestamps[x] is Values[x].
* @return Returns a reference to this object so that method calls can be chained together.
*/
public MetricDataResult withTimestamps(java.util.Date... timestamps) {
if (this.timestamps == null) {
setTimestamps(new com.amazonaws.internal.SdkInternalList(timestamps.length));
}
for (java.util.Date ele : timestamps) {
this.timestamps.add(ele);
}
return this;
}
/**
*
* The timestamps for the data points, formatted in Unix timestamp format. The number of timestamps always matches
* the number of values and the value for Timestamps[x] is Values[x].
*
*
* @param timestamps
* The timestamps for the data points, formatted in Unix timestamp format. The number of timestamps always
* matches the number of values and the value for Timestamps[x] is Values[x].
* @return Returns a reference to this object so that method calls can be chained together.
*/
public MetricDataResult withTimestamps(java.util.Collection timestamps) {
setTimestamps(timestamps);
return this;
}
/**
*
* The data points for the metric corresponding to Timestamps
. The number of values always matches the
* number of timestamps and the timestamp for Values[x] is Timestamps[x].
*
*
* @return The data points for the metric corresponding to Timestamps
. The number of values always
* matches the number of timestamps and the timestamp for Values[x] is Timestamps[x].
*/
public java.util.List getValues() {
if (values == null) {
values = new com.amazonaws.internal.SdkInternalList();
}
return values;
}
/**
*
* The data points for the metric corresponding to Timestamps
. The number of values always matches the
* number of timestamps and the timestamp for Values[x] is Timestamps[x].
*
*
* @param values
* The data points for the metric corresponding to Timestamps
. The number of values always
* matches the number of timestamps and the timestamp for Values[x] is Timestamps[x].
*/
public void setValues(java.util.Collection values) {
if (values == null) {
this.values = null;
return;
}
this.values = new com.amazonaws.internal.SdkInternalList(values);
}
/**
*
* The data points for the metric corresponding to Timestamps
. The number of values always matches the
* number of timestamps and the timestamp for Values[x] is Timestamps[x].
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setValues(java.util.Collection)} or {@link #withValues(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param values
* The data points for the metric corresponding to Timestamps
. The number of values always
* matches the number of timestamps and the timestamp for Values[x] is Timestamps[x].
* @return Returns a reference to this object so that method calls can be chained together.
*/
public MetricDataResult withValues(Double... values) {
if (this.values == null) {
setValues(new com.amazonaws.internal.SdkInternalList(values.length));
}
for (Double ele : values) {
this.values.add(ele);
}
return this;
}
/**
*
* The data points for the metric corresponding to Timestamps
. The number of values always matches the
* number of timestamps and the timestamp for Values[x] is Timestamps[x].
*
*
* @param values
* The data points for the metric corresponding to Timestamps
. The number of values always
* matches the number of timestamps and the timestamp for Values[x] is Timestamps[x].
* @return Returns a reference to this object so that method calls can be chained together.
*/
public MetricDataResult withValues(java.util.Collection values) {
setValues(values);
return this;
}
/**
*
* The status of the returned data. Complete
indicates that all data points in the requested time range
* were returned. PartialData
means that an incomplete set of data points were returned. You can use
* the NextToken
value that was returned and repeat your request to get more data points.
* NextToken
is not returned if you are performing a math expression. InternalError
* indicates that an error occurred. Retry your request using NextToken
, if present.
*
*
* @param statusCode
* The status of the returned data. Complete
indicates that all data points in the requested
* time range were returned. PartialData
means that an incomplete set of data points were
* returned. You can use the NextToken
value that was returned and repeat your request to get
* more data points. NextToken
is not returned if you are performing a math expression.
* InternalError
indicates that an error occurred. Retry your request using
* NextToken
, if present.
* @see StatusCode
*/
public void setStatusCode(String statusCode) {
this.statusCode = statusCode;
}
/**
*
* The status of the returned data. Complete
indicates that all data points in the requested time range
* were returned. PartialData
means that an incomplete set of data points were returned. You can use
* the NextToken
value that was returned and repeat your request to get more data points.
* NextToken
is not returned if you are performing a math expression. InternalError
* indicates that an error occurred. Retry your request using NextToken
, if present.
*
*
* @return The status of the returned data. Complete
indicates that all data points in the requested
* time range were returned. PartialData
means that an incomplete set of data points were
* returned. You can use the NextToken
value that was returned and repeat your request to get
* more data points. NextToken
is not returned if you are performing a math expression.
* InternalError
indicates that an error occurred. Retry your request using
* NextToken
, if present.
* @see StatusCode
*/
public String getStatusCode() {
return this.statusCode;
}
/**
*
* The status of the returned data. Complete
indicates that all data points in the requested time range
* were returned. PartialData
means that an incomplete set of data points were returned. You can use
* the NextToken
value that was returned and repeat your request to get more data points.
* NextToken
is not returned if you are performing a math expression. InternalError
* indicates that an error occurred. Retry your request using NextToken
, if present.
*
*
* @param statusCode
* The status of the returned data. Complete
indicates that all data points in the requested
* time range were returned. PartialData
means that an incomplete set of data points were
* returned. You can use the NextToken
value that was returned and repeat your request to get
* more data points. NextToken
is not returned if you are performing a math expression.
* InternalError
indicates that an error occurred. Retry your request using
* NextToken
, if present.
* @return Returns a reference to this object so that method calls can be chained together.
* @see StatusCode
*/
public MetricDataResult withStatusCode(String statusCode) {
setStatusCode(statusCode);
return this;
}
/**
*
* The status of the returned data. Complete
indicates that all data points in the requested time range
* were returned. PartialData
means that an incomplete set of data points were returned. You can use
* the NextToken
value that was returned and repeat your request to get more data points.
* NextToken
is not returned if you are performing a math expression. InternalError
* indicates that an error occurred. Retry your request using NextToken
, if present.
*
*
* @param statusCode
* The status of the returned data. Complete
indicates that all data points in the requested
* time range were returned. PartialData
means that an incomplete set of data points were
* returned. You can use the NextToken
value that was returned and repeat your request to get
* more data points. NextToken
is not returned if you are performing a math expression.
* InternalError
indicates that an error occurred. Retry your request using
* NextToken
, if present.
* @return Returns a reference to this object so that method calls can be chained together.
* @see StatusCode
*/
public MetricDataResult withStatusCode(StatusCode statusCode) {
this.statusCode = statusCode.toString();
return this;
}
/**
*
* A list of messages with additional information about the data returned.
*
*
* @return A list of messages with additional information about the data returned.
*/
public java.util.List getMessages() {
if (messages == null) {
messages = new com.amazonaws.internal.SdkInternalList();
}
return messages;
}
/**
*
* A list of messages with additional information about the data returned.
*
*
* @param messages
* A list of messages with additional information about the data returned.
*/
public void setMessages(java.util.Collection messages) {
if (messages == null) {
this.messages = null;
return;
}
this.messages = new com.amazonaws.internal.SdkInternalList(messages);
}
/**
*
* A list of messages with additional information about the data returned.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setMessages(java.util.Collection)} or {@link #withMessages(java.util.Collection)} if you want to override
* the existing values.
*
*
* @param messages
* A list of messages with additional information about the data returned.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public MetricDataResult withMessages(MessageData... messages) {
if (this.messages == null) {
setMessages(new com.amazonaws.internal.SdkInternalList(messages.length));
}
for (MessageData ele : messages) {
this.messages.add(ele);
}
return this;
}
/**
*
* A list of messages with additional information about the data returned.
*
*
* @param messages
* A list of messages with additional information about the data returned.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public MetricDataResult withMessages(java.util.Collection messages) {
setMessages(messages);
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 (getId() != null)
sb.append("Id: ").append(getId()).append(",");
if (getLabel() != null)
sb.append("Label: ").append(getLabel()).append(",");
if (getTimestamps() != null)
sb.append("Timestamps: ").append(getTimestamps()).append(",");
if (getValues() != null)
sb.append("Values: ").append(getValues()).append(",");
if (getStatusCode() != null)
sb.append("StatusCode: ").append(getStatusCode()).append(",");
if (getMessages() != null)
sb.append("Messages: ").append(getMessages());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof MetricDataResult == false)
return false;
MetricDataResult other = (MetricDataResult) obj;
if (other.getId() == null ^ this.getId() == null)
return false;
if (other.getId() != null && other.getId().equals(this.getId()) == false)
return false;
if (other.getLabel() == null ^ this.getLabel() == null)
return false;
if (other.getLabel() != null && other.getLabel().equals(this.getLabel()) == false)
return false;
if (other.getTimestamps() == null ^ this.getTimestamps() == null)
return false;
if (other.getTimestamps() != null && other.getTimestamps().equals(this.getTimestamps()) == false)
return false;
if (other.getValues() == null ^ this.getValues() == null)
return false;
if (other.getValues() != null && other.getValues().equals(this.getValues()) == false)
return false;
if (other.getStatusCode() == null ^ this.getStatusCode() == null)
return false;
if (other.getStatusCode() != null && other.getStatusCode().equals(this.getStatusCode()) == false)
return false;
if (other.getMessages() == null ^ this.getMessages() == null)
return false;
if (other.getMessages() != null && other.getMessages().equals(this.getMessages()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode());
hashCode = prime * hashCode + ((getLabel() == null) ? 0 : getLabel().hashCode());
hashCode = prime * hashCode + ((getTimestamps() == null) ? 0 : getTimestamps().hashCode());
hashCode = prime * hashCode + ((getValues() == null) ? 0 : getValues().hashCode());
hashCode = prime * hashCode + ((getStatusCode() == null) ? 0 : getStatusCode().hashCode());
hashCode = prime * hashCode + ((getMessages() == null) ? 0 : getMessages().hashCode());
return hashCode;
}
@Override
public MetricDataResult clone() {
try {
return (MetricDataResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}