com.amazonaws.services.apigateway.model.ThrottleSettings Maven / Gradle / Ivy
Show all versions of aws-java-sdk-api-gateway 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.apigateway.model;
import java.io.Serializable;
/**
*
* The API request rate limits.
*
*/
public class ThrottleSettings implements Serializable, Cloneable {
/**
*
* The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon
* whether the underlying token bucket is at its full capacity.
*
*/
private Integer burstLimit;
/**
*
* The API request steady-state rate limit.
*
*/
private Double rateLimit;
/**
*
* The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon
* whether the underlying token bucket is at its full capacity.
*
*
* @param burstLimit
* The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds,
* depending upon whether the underlying token bucket is at its full capacity.
*/
public void setBurstLimit(Integer burstLimit) {
this.burstLimit = burstLimit;
}
/**
*
* The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon
* whether the underlying token bucket is at its full capacity.
*
*
* @return The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds,
* depending upon whether the underlying token bucket is at its full capacity.
*/
public Integer getBurstLimit() {
return this.burstLimit;
}
/**
*
* The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon
* whether the underlying token bucket is at its full capacity.
*
*
* @param burstLimit
* The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds,
* depending upon whether the underlying token bucket is at its full capacity.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ThrottleSettings withBurstLimit(Integer burstLimit) {
setBurstLimit(burstLimit);
return this;
}
/**
*
* The API request steady-state rate limit.
*
*
* @param rateLimit
* The API request steady-state rate limit.
*/
public void setRateLimit(Double rateLimit) {
this.rateLimit = rateLimit;
}
/**
*
* The API request steady-state rate limit.
*
*
* @return The API request steady-state rate limit.
*/
public Double getRateLimit() {
return this.rateLimit;
}
/**
*
* The API request steady-state rate limit.
*
*
* @param rateLimit
* The API request steady-state rate limit.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ThrottleSettings withRateLimit(Double rateLimit) {
setRateLimit(rateLimit);
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 (getBurstLimit() != null)
sb.append("BurstLimit: " + getBurstLimit() + ",");
if (getRateLimit() != null)
sb.append("RateLimit: " + getRateLimit());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ThrottleSettings == false)
return false;
ThrottleSettings other = (ThrottleSettings) obj;
if (other.getBurstLimit() == null ^ this.getBurstLimit() == null)
return false;
if (other.getBurstLimit() != null && other.getBurstLimit().equals(this.getBurstLimit()) == false)
return false;
if (other.getRateLimit() == null ^ this.getRateLimit() == null)
return false;
if (other.getRateLimit() != null && other.getRateLimit().equals(this.getRateLimit()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getBurstLimit() == null) ? 0 : getBurstLimit().hashCode());
hashCode = prime * hashCode + ((getRateLimit() == null) ? 0 : getRateLimit().hashCode());
return hashCode;
}
@Override
public ThrottleSettings clone() {
try {
return (ThrottleSettings) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}