/* * 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.apigateway.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *
* Quotas configured for a usage plan. *
*/ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class QuotaSettings implements Serializable, Cloneable, StructuredPojo { /** ** The target maximum number of requests that can be made in a given time period. *
*/ private Integer limit; /** ** The number of requests subtracted from the given limit in the initial time period. *
*/ private Integer offset; /** ** The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH". *
*/ private String period; /** ** The target maximum number of requests that can be made in a given time period. *
* * @param limit * The target maximum number of requests that can be made in a given time period. */ public void setLimit(Integer limit) { this.limit = limit; } /** ** The target maximum number of requests that can be made in a given time period. *
* * @return The target maximum number of requests that can be made in a given time period. */ public Integer getLimit() { return this.limit; } /** ** The target maximum number of requests that can be made in a given time period. *
* * @param limit * The target maximum number of requests that can be made in a given time period. * @return Returns a reference to this object so that method calls can be chained together. */ public QuotaSettings withLimit(Integer limit) { setLimit(limit); return this; } /** ** The number of requests subtracted from the given limit in the initial time period. *
* * @param offset * The number of requests subtracted from the given limit in the initial time period. */ public void setOffset(Integer offset) { this.offset = offset; } /** ** The number of requests subtracted from the given limit in the initial time period. *
* * @return The number of requests subtracted from the given limit in the initial time period. */ public Integer getOffset() { return this.offset; } /** ** The number of requests subtracted from the given limit in the initial time period. *
* * @param offset * The number of requests subtracted from the given limit in the initial time period. * @return Returns a reference to this object so that method calls can be chained together. */ public QuotaSettings withOffset(Integer offset) { setOffset(offset); return this; } /** ** The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH". *
* * @param period * The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH". * @see QuotaPeriodType */ public void setPeriod(String period) { this.period = period; } /** ** The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH". *
* * @return The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH". * @see QuotaPeriodType */ public String getPeriod() { return this.period; } /** ** The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH". *
* * @param period * The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH". * @return Returns a reference to this object so that method calls can be chained together. * @see QuotaPeriodType */ public QuotaSettings withPeriod(String period) { setPeriod(period); return this; } /** ** The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH". *
* * @param period * The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH". * @see QuotaPeriodType */ public void setPeriod(QuotaPeriodType period) { withPeriod(period); } /** ** The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH". *
* * @param period * The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH". * @return Returns a reference to this object so that method calls can be chained together. * @see QuotaPeriodType */ public QuotaSettings withPeriod(QuotaPeriodType period) { this.period = period.toString(); 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 (getLimit() != null) sb.append("Limit: ").append(getLimit()).append(","); if (getOffset() != null) sb.append("Offset: ").append(getOffset()).append(","); if (getPeriod() != null) sb.append("Period: ").append(getPeriod()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof QuotaSettings == false) return false; QuotaSettings other = (QuotaSettings) obj; if (other.getLimit() == null ^ this.getLimit() == null) return false; if (other.getLimit() != null && other.getLimit().equals(this.getLimit()) == false) return false; if (other.getOffset() == null ^ this.getOffset() == null) return false; if (other.getOffset() != null && other.getOffset().equals(this.getOffset()) == false) return false; if (other.getPeriod() == null ^ this.getPeriod() == null) return false; if (other.getPeriod() != null && other.getPeriod().equals(this.getPeriod()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getLimit() == null) ? 0 : getLimit().hashCode()); hashCode = prime * hashCode + ((getOffset() == null) ? 0 : getOffset().hashCode()); hashCode = prime * hashCode + ((getPeriod() == null) ? 0 : getPeriod().hashCode()); return hashCode; } @Override public QuotaSettings clone() { try { return (QuotaSettings) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.apigateway.model.transform.QuotaSettingsMarshaller.getInstance().marshall(this, protocolMarshaller); } }