
com.amazonaws.services.elasticbeanstalk.model.ApplicationMetrics Maven / Gradle / Ivy
Show all versions of aws-java-sdk-osgi Show documentation
/*
* Copyright 2011-2016 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.elasticbeanstalk.model;
import java.io.Serializable;
/**
*
* Represents the application metrics for a specified environment.
*
*/
public class ApplicationMetrics implements Serializable, Cloneable {
/**
*
* The amount of time that the metrics cover (usually 10 seconds). For
* example, you might have 5 requests (request_count
) within
* the most recent time slice of 10 seconds (duration
).
*
*/
private Integer duration;
/**
*
* Average number of requests handled by the web server per second over the
* last 10 seconds.
*
*/
private Integer requestCount;
/**
*
* Represents the percentage of requests over the last 10 seconds that
* resulted in each type of status code response.
*
*/
private StatusCodes statusCodes;
/**
*
* Represents the average latency for the slowest X percent of requests over
* the last 10 seconds. Latencies are in seconds with one milisecond
* resolution.
*
*/
private Latency latency;
/**
*
* The amount of time that the metrics cover (usually 10 seconds). For
* example, you might have 5 requests (request_count
) within
* the most recent time slice of 10 seconds (duration
).
*
*
* @param duration
* The amount of time that the metrics cover (usually 10 seconds).
* For example, you might have 5 requests (request_count
* ) within the most recent time slice of 10 seconds (
* duration
).
*/
public void setDuration(Integer duration) {
this.duration = duration;
}
/**
*
* The amount of time that the metrics cover (usually 10 seconds). For
* example, you might have 5 requests (request_count
) within
* the most recent time slice of 10 seconds (duration
).
*
*
* @return The amount of time that the metrics cover (usually 10 seconds).
* For example, you might have 5 requests (
* request_count
) within the most recent time slice of
* 10 seconds (duration
).
*/
public Integer getDuration() {
return this.duration;
}
/**
*
* The amount of time that the metrics cover (usually 10 seconds). For
* example, you might have 5 requests (request_count
) within
* the most recent time slice of 10 seconds (duration
).
*
*
* @param duration
* The amount of time that the metrics cover (usually 10 seconds).
* For example, you might have 5 requests (request_count
* ) within the most recent time slice of 10 seconds (
* duration
).
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ApplicationMetrics withDuration(Integer duration) {
setDuration(duration);
return this;
}
/**
*
* Average number of requests handled by the web server per second over the
* last 10 seconds.
*
*
* @param requestCount
* Average number of requests handled by the web server per second
* over the last 10 seconds.
*/
public void setRequestCount(Integer requestCount) {
this.requestCount = requestCount;
}
/**
*
* Average number of requests handled by the web server per second over the
* last 10 seconds.
*
*
* @return Average number of requests handled by the web server per second
* over the last 10 seconds.
*/
public Integer getRequestCount() {
return this.requestCount;
}
/**
*
* Average number of requests handled by the web server per second over the
* last 10 seconds.
*
*
* @param requestCount
* Average number of requests handled by the web server per second
* over the last 10 seconds.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ApplicationMetrics withRequestCount(Integer requestCount) {
setRequestCount(requestCount);
return this;
}
/**
*
* Represents the percentage of requests over the last 10 seconds that
* resulted in each type of status code response.
*
*
* @param statusCodes
* Represents the percentage of requests over the last 10 seconds
* that resulted in each type of status code response.
*/
public void setStatusCodes(StatusCodes statusCodes) {
this.statusCodes = statusCodes;
}
/**
*
* Represents the percentage of requests over the last 10 seconds that
* resulted in each type of status code response.
*
*
* @return Represents the percentage of requests over the last 10 seconds
* that resulted in each type of status code response.
*/
public StatusCodes getStatusCodes() {
return this.statusCodes;
}
/**
*
* Represents the percentage of requests over the last 10 seconds that
* resulted in each type of status code response.
*
*
* @param statusCodes
* Represents the percentage of requests over the last 10 seconds
* that resulted in each type of status code response.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ApplicationMetrics withStatusCodes(StatusCodes statusCodes) {
setStatusCodes(statusCodes);
return this;
}
/**
*
* Represents the average latency for the slowest X percent of requests over
* the last 10 seconds. Latencies are in seconds with one milisecond
* resolution.
*
*
* @param latency
* Represents the average latency for the slowest X percent of
* requests over the last 10 seconds. Latencies are in seconds with
* one milisecond resolution.
*/
public void setLatency(Latency latency) {
this.latency = latency;
}
/**
*
* Represents the average latency for the slowest X percent of requests over
* the last 10 seconds. Latencies are in seconds with one milisecond
* resolution.
*
*
* @return Represents the average latency for the slowest X percent of
* requests over the last 10 seconds. Latencies are in seconds with
* one milisecond resolution.
*/
public Latency getLatency() {
return this.latency;
}
/**
*
* Represents the average latency for the slowest X percent of requests over
* the last 10 seconds. Latencies are in seconds with one milisecond
* resolution.
*
*
* @param latency
* Represents the average latency for the slowest X percent of
* requests over the last 10 seconds. Latencies are in seconds with
* one milisecond resolution.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ApplicationMetrics withLatency(Latency latency) {
setLatency(latency);
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getDuration() != null)
sb.append("Duration: " + getDuration() + ",");
if (getRequestCount() != null)
sb.append("RequestCount: " + getRequestCount() + ",");
if (getStatusCodes() != null)
sb.append("StatusCodes: " + getStatusCodes() + ",");
if (getLatency() != null)
sb.append("Latency: " + getLatency());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ApplicationMetrics == false)
return false;
ApplicationMetrics other = (ApplicationMetrics) obj;
if (other.getDuration() == null ^ this.getDuration() == null)
return false;
if (other.getDuration() != null
&& other.getDuration().equals(this.getDuration()) == false)
return false;
if (other.getRequestCount() == null ^ this.getRequestCount() == null)
return false;
if (other.getRequestCount() != null
&& other.getRequestCount().equals(this.getRequestCount()) == false)
return false;
if (other.getStatusCodes() == null ^ this.getStatusCodes() == null)
return false;
if (other.getStatusCodes() != null
&& other.getStatusCodes().equals(this.getStatusCodes()) == false)
return false;
if (other.getLatency() == null ^ this.getLatency() == null)
return false;
if (other.getLatency() != null
&& other.getLatency().equals(this.getLatency()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode
+ ((getDuration() == null) ? 0 : getDuration().hashCode());
hashCode = prime
* hashCode
+ ((getRequestCount() == null) ? 0 : getRequestCount()
.hashCode());
hashCode = prime
* hashCode
+ ((getStatusCodes() == null) ? 0 : getStatusCodes().hashCode());
hashCode = prime * hashCode
+ ((getLatency() == null) ? 0 : getLatency().hashCode());
return hashCode;
}
@Override
public ApplicationMetrics clone() {
try {
return (ApplicationMetrics) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}