com.amazonaws.services.ec2.model.DataResponse Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ec2 Show documentation
/*
* Copyright 2018-2023 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.ec2.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* The response to a DataQuery
.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DataResponse implements Serializable, Cloneable {
/**
*
* The ID passed in the DataQuery
.
*
*/
private String id;
/**
*
* The Region or Availability Zone that's the source for the data query. For example, us-east-1
.
*
*/
private String source;
/**
*
* The Region or Availability Zone that's the destination for the data query. For example, eu-west-1
.
*
*/
private String destination;
/**
*
* The metric used for the network performance request. Only aggregate-latency
is supported, which
* shows network latency during a specified period.
*
*/
private String metric;
/**
*
* The statistic used for the network performance request.
*
*/
private String statistic;
/**
*
* The period used for the network performance request.
*
*/
private String period;
/**
*
* A list of MetricPoint
objects.
*
*/
private com.amazonaws.internal.SdkInternalList metricPoints;
/**
*
* The ID passed in the DataQuery
.
*
*
* @param id
* The ID passed in the DataQuery
.
*/
public void setId(String id) {
this.id = id;
}
/**
*
* The ID passed in the DataQuery
.
*
*
* @return The ID passed in the DataQuery
.
*/
public String getId() {
return this.id;
}
/**
*
* The ID passed in the DataQuery
.
*
*
* @param id
* The ID passed in the DataQuery
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DataResponse withId(String id) {
setId(id);
return this;
}
/**
*
* The Region or Availability Zone that's the source for the data query. For example, us-east-1
.
*
*
* @param source
* The Region or Availability Zone that's the source for the data query. For example, us-east-1
.
*/
public void setSource(String source) {
this.source = source;
}
/**
*
* The Region or Availability Zone that's the source for the data query. For example, us-east-1
.
*
*
* @return The Region or Availability Zone that's the source for the data query. For example, us-east-1
* .
*/
public String getSource() {
return this.source;
}
/**
*
* The Region or Availability Zone that's the source for the data query. For example, us-east-1
.
*
*
* @param source
* The Region or Availability Zone that's the source for the data query. For example, us-east-1
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DataResponse withSource(String source) {
setSource(source);
return this;
}
/**
*
* The Region or Availability Zone that's the destination for the data query. For example, eu-west-1
.
*
*
* @param destination
* The Region or Availability Zone that's the destination for the data query. For example,
* eu-west-1
.
*/
public void setDestination(String destination) {
this.destination = destination;
}
/**
*
* The Region or Availability Zone that's the destination for the data query. For example, eu-west-1
.
*
*
* @return The Region or Availability Zone that's the destination for the data query. For example,
* eu-west-1
.
*/
public String getDestination() {
return this.destination;
}
/**
*
* The Region or Availability Zone that's the destination for the data query. For example, eu-west-1
.
*
*
* @param destination
* The Region or Availability Zone that's the destination for the data query. For example,
* eu-west-1
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DataResponse withDestination(String destination) {
setDestination(destination);
return this;
}
/**
*
* The metric used for the network performance request. Only aggregate-latency
is supported, which
* shows network latency during a specified period.
*
*
* @param metric
* The metric used for the network performance request. Only aggregate-latency
is supported,
* which shows network latency during a specified period.
* @see MetricType
*/
public void setMetric(String metric) {
this.metric = metric;
}
/**
*
* The metric used for the network performance request. Only aggregate-latency
is supported, which
* shows network latency during a specified period.
*
*
* @return The metric used for the network performance request. Only aggregate-latency
is supported,
* which shows network latency during a specified period.
* @see MetricType
*/
public String getMetric() {
return this.metric;
}
/**
*
* The metric used for the network performance request. Only aggregate-latency
is supported, which
* shows network latency during a specified period.
*
*
* @param metric
* The metric used for the network performance request. Only aggregate-latency
is supported,
* which shows network latency during a specified period.
* @return Returns a reference to this object so that method calls can be chained together.
* @see MetricType
*/
public DataResponse withMetric(String metric) {
setMetric(metric);
return this;
}
/**
*
* The metric used for the network performance request. Only aggregate-latency
is supported, which
* shows network latency during a specified period.
*
*
* @param metric
* The metric used for the network performance request. Only aggregate-latency
is supported,
* which shows network latency during a specified period.
* @return Returns a reference to this object so that method calls can be chained together.
* @see MetricType
*/
public DataResponse withMetric(MetricType metric) {
this.metric = metric.toString();
return this;
}
/**
*
* The statistic used for the network performance request.
*
*
* @param statistic
* The statistic used for the network performance request.
* @see StatisticType
*/
public void setStatistic(String statistic) {
this.statistic = statistic;
}
/**
*
* The statistic used for the network performance request.
*
*
* @return The statistic used for the network performance request.
* @see StatisticType
*/
public String getStatistic() {
return this.statistic;
}
/**
*
* The statistic used for the network performance request.
*
*
* @param statistic
* The statistic used for the network performance request.
* @return Returns a reference to this object so that method calls can be chained together.
* @see StatisticType
*/
public DataResponse withStatistic(String statistic) {
setStatistic(statistic);
return this;
}
/**
*
* The statistic used for the network performance request.
*
*
* @param statistic
* The statistic used for the network performance request.
* @return Returns a reference to this object so that method calls can be chained together.
* @see StatisticType
*/
public DataResponse withStatistic(StatisticType statistic) {
this.statistic = statistic.toString();
return this;
}
/**
*
* The period used for the network performance request.
*
*
* @param period
* The period used for the network performance request.
* @see PeriodType
*/
public void setPeriod(String period) {
this.period = period;
}
/**
*
* The period used for the network performance request.
*
*
* @return The period used for the network performance request.
* @see PeriodType
*/
public String getPeriod() {
return this.period;
}
/**
*
* The period used for the network performance request.
*
*
* @param period
* The period used for the network performance request.
* @return Returns a reference to this object so that method calls can be chained together.
* @see PeriodType
*/
public DataResponse withPeriod(String period) {
setPeriod(period);
return this;
}
/**
*
* The period used for the network performance request.
*
*
* @param period
* The period used for the network performance request.
* @return Returns a reference to this object so that method calls can be chained together.
* @see PeriodType
*/
public DataResponse withPeriod(PeriodType period) {
this.period = period.toString();
return this;
}
/**
*
* A list of MetricPoint
objects.
*
*
* @return A list of MetricPoint
objects.
*/
public java.util.List getMetricPoints() {
if (metricPoints == null) {
metricPoints = new com.amazonaws.internal.SdkInternalList();
}
return metricPoints;
}
/**
*
* A list of MetricPoint
objects.
*
*
* @param metricPoints
* A list of MetricPoint
objects.
*/
public void setMetricPoints(java.util.Collection metricPoints) {
if (metricPoints == null) {
this.metricPoints = null;
return;
}
this.metricPoints = new com.amazonaws.internal.SdkInternalList(metricPoints);
}
/**
*
* A list of MetricPoint
objects.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setMetricPoints(java.util.Collection)} or {@link #withMetricPoints(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param metricPoints
* A list of MetricPoint
objects.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DataResponse withMetricPoints(MetricPoint... metricPoints) {
if (this.metricPoints == null) {
setMetricPoints(new com.amazonaws.internal.SdkInternalList(metricPoints.length));
}
for (MetricPoint ele : metricPoints) {
this.metricPoints.add(ele);
}
return this;
}
/**
*
* A list of MetricPoint
objects.
*
*
* @param metricPoints
* A list of MetricPoint
objects.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DataResponse withMetricPoints(java.util.Collection metricPoints) {
setMetricPoints(metricPoints);
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 (getSource() != null)
sb.append("Source: ").append(getSource()).append(",");
if (getDestination() != null)
sb.append("Destination: ").append(getDestination()).append(",");
if (getMetric() != null)
sb.append("Metric: ").append(getMetric()).append(",");
if (getStatistic() != null)
sb.append("Statistic: ").append(getStatistic()).append(",");
if (getPeriod() != null)
sb.append("Period: ").append(getPeriod()).append(",");
if (getMetricPoints() != null)
sb.append("MetricPoints: ").append(getMetricPoints());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof DataResponse == false)
return false;
DataResponse other = (DataResponse) obj;
if (other.getId() == null ^ this.getId() == null)
return false;
if (other.getId() != null && other.getId().equals(this.getId()) == false)
return false;
if (other.getSource() == null ^ this.getSource() == null)
return false;
if (other.getSource() != null && other.getSource().equals(this.getSource()) == false)
return false;
if (other.getDestination() == null ^ this.getDestination() == null)
return false;
if (other.getDestination() != null && other.getDestination().equals(this.getDestination()) == false)
return false;
if (other.getMetric() == null ^ this.getMetric() == null)
return false;
if (other.getMetric() != null && other.getMetric().equals(this.getMetric()) == false)
return false;
if (other.getStatistic() == null ^ this.getStatistic() == null)
return false;
if (other.getStatistic() != null && other.getStatistic().equals(this.getStatistic()) == false)
return false;
if (other.getPeriod() == null ^ this.getPeriod() == null)
return false;
if (other.getPeriod() != null && other.getPeriod().equals(this.getPeriod()) == false)
return false;
if (other.getMetricPoints() == null ^ this.getMetricPoints() == null)
return false;
if (other.getMetricPoints() != null && other.getMetricPoints().equals(this.getMetricPoints()) == 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 + ((getSource() == null) ? 0 : getSource().hashCode());
hashCode = prime * hashCode + ((getDestination() == null) ? 0 : getDestination().hashCode());
hashCode = prime * hashCode + ((getMetric() == null) ? 0 : getMetric().hashCode());
hashCode = prime * hashCode + ((getStatistic() == null) ? 0 : getStatistic().hashCode());
hashCode = prime * hashCode + ((getPeriod() == null) ? 0 : getPeriod().hashCode());
hashCode = prime * hashCode + ((getMetricPoints() == null) ? 0 : getMetricPoints().hashCode());
return hashCode;
}
@Override
public DataResponse clone() {
try {
return (DataResponse) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}