com.amazonaws.services.redshift.model.UsageLimit Maven / Gradle / Ivy
Show all versions of aws-java-sdk-redshift 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.redshift.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* Describes a usage limit object for a cluster.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class UsageLimit implements Serializable, Cloneable {
/**
*
* The identifier of the usage limit.
*
*/
private String usageLimitId;
/**
*
* The identifier of the cluster with a usage limit.
*
*/
private String clusterIdentifier;
/**
*
* The Amazon Redshift feature to which the limit applies.
*
*/
private String featureType;
/**
*
* The type of limit. Depending on the feature type, this can be based on a time duration or data size.
*
*/
private String limitType;
/**
*
* The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes (TB).
*
*/
private Long amount;
/**
*
* The time period that the amount applies to. A weekly
period begins on Sunday. The default is
* monthly
.
*
*/
private String period;
/**
*
* The action that Amazon Redshift takes when the limit is reached. Possible values are:
*
*
* -
*
* log - To log an event in a system table. The default is log.
*
*
* -
*
* emit-metric - To emit CloudWatch metrics.
*
*
* -
*
* disable - To disable the feature until the next usage period begins.
*
*
*
*/
private String breachAction;
/**
*
* A list of tag instances.
*
*/
private com.amazonaws.internal.SdkInternalList tags;
/**
*
* The identifier of the usage limit.
*
*
* @param usageLimitId
* The identifier of the usage limit.
*/
public void setUsageLimitId(String usageLimitId) {
this.usageLimitId = usageLimitId;
}
/**
*
* The identifier of the usage limit.
*
*
* @return The identifier of the usage limit.
*/
public String getUsageLimitId() {
return this.usageLimitId;
}
/**
*
* The identifier of the usage limit.
*
*
* @param usageLimitId
* The identifier of the usage limit.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UsageLimit withUsageLimitId(String usageLimitId) {
setUsageLimitId(usageLimitId);
return this;
}
/**
*
* The identifier of the cluster with a usage limit.
*
*
* @param clusterIdentifier
* The identifier of the cluster with a usage limit.
*/
public void setClusterIdentifier(String clusterIdentifier) {
this.clusterIdentifier = clusterIdentifier;
}
/**
*
* The identifier of the cluster with a usage limit.
*
*
* @return The identifier of the cluster with a usage limit.
*/
public String getClusterIdentifier() {
return this.clusterIdentifier;
}
/**
*
* The identifier of the cluster with a usage limit.
*
*
* @param clusterIdentifier
* The identifier of the cluster with a usage limit.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UsageLimit withClusterIdentifier(String clusterIdentifier) {
setClusterIdentifier(clusterIdentifier);
return this;
}
/**
*
* The Amazon Redshift feature to which the limit applies.
*
*
* @param featureType
* The Amazon Redshift feature to which the limit applies.
* @see UsageLimitFeatureType
*/
public void setFeatureType(String featureType) {
this.featureType = featureType;
}
/**
*
* The Amazon Redshift feature to which the limit applies.
*
*
* @return The Amazon Redshift feature to which the limit applies.
* @see UsageLimitFeatureType
*/
public String getFeatureType() {
return this.featureType;
}
/**
*
* The Amazon Redshift feature to which the limit applies.
*
*
* @param featureType
* The Amazon Redshift feature to which the limit applies.
* @return Returns a reference to this object so that method calls can be chained together.
* @see UsageLimitFeatureType
*/
public UsageLimit withFeatureType(String featureType) {
setFeatureType(featureType);
return this;
}
/**
*
* The Amazon Redshift feature to which the limit applies.
*
*
* @param featureType
* The Amazon Redshift feature to which the limit applies.
* @return Returns a reference to this object so that method calls can be chained together.
* @see UsageLimitFeatureType
*/
public UsageLimit withFeatureType(UsageLimitFeatureType featureType) {
this.featureType = featureType.toString();
return this;
}
/**
*
* The type of limit. Depending on the feature type, this can be based on a time duration or data size.
*
*
* @param limitType
* The type of limit. Depending on the feature type, this can be based on a time duration or data size.
* @see UsageLimitLimitType
*/
public void setLimitType(String limitType) {
this.limitType = limitType;
}
/**
*
* The type of limit. Depending on the feature type, this can be based on a time duration or data size.
*
*
* @return The type of limit. Depending on the feature type, this can be based on a time duration or data size.
* @see UsageLimitLimitType
*/
public String getLimitType() {
return this.limitType;
}
/**
*
* The type of limit. Depending on the feature type, this can be based on a time duration or data size.
*
*
* @param limitType
* The type of limit. Depending on the feature type, this can be based on a time duration or data size.
* @return Returns a reference to this object so that method calls can be chained together.
* @see UsageLimitLimitType
*/
public UsageLimit withLimitType(String limitType) {
setLimitType(limitType);
return this;
}
/**
*
* The type of limit. Depending on the feature type, this can be based on a time duration or data size.
*
*
* @param limitType
* The type of limit. Depending on the feature type, this can be based on a time duration or data size.
* @return Returns a reference to this object so that method calls can be chained together.
* @see UsageLimitLimitType
*/
public UsageLimit withLimitType(UsageLimitLimitType limitType) {
this.limitType = limitType.toString();
return this;
}
/**
*
* The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes (TB).
*
*
* @param amount
* The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes
* (TB).
*/
public void setAmount(Long amount) {
this.amount = amount;
}
/**
*
* The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes (TB).
*
*
* @return The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes
* (TB).
*/
public Long getAmount() {
return this.amount;
}
/**
*
* The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes (TB).
*
*
* @param amount
* The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes
* (TB).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UsageLimit withAmount(Long amount) {
setAmount(amount);
return this;
}
/**
*
* The time period that the amount applies to. A weekly
period begins on Sunday. The default is
* monthly
.
*
*
* @param period
* The time period that the amount applies to. A weekly
period begins on Sunday. The default is
* monthly
.
* @see UsageLimitPeriod
*/
public void setPeriod(String period) {
this.period = period;
}
/**
*
* The time period that the amount applies to. A weekly
period begins on Sunday. The default is
* monthly
.
*
*
* @return The time period that the amount applies to. A weekly
period begins on Sunday. The default is
* monthly
.
* @see UsageLimitPeriod
*/
public String getPeriod() {
return this.period;
}
/**
*
* The time period that the amount applies to. A weekly
period begins on Sunday. The default is
* monthly
.
*
*
* @param period
* The time period that the amount applies to. A weekly
period begins on Sunday. The default is
* monthly
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see UsageLimitPeriod
*/
public UsageLimit withPeriod(String period) {
setPeriod(period);
return this;
}
/**
*
* The time period that the amount applies to. A weekly
period begins on Sunday. The default is
* monthly
.
*
*
* @param period
* The time period that the amount applies to. A weekly
period begins on Sunday. The default is
* monthly
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see UsageLimitPeriod
*/
public UsageLimit withPeriod(UsageLimitPeriod period) {
this.period = period.toString();
return this;
}
/**
*
* The action that Amazon Redshift takes when the limit is reached. Possible values are:
*
*
* -
*
* log - To log an event in a system table. The default is log.
*
*
* -
*
* emit-metric - To emit CloudWatch metrics.
*
*
* -
*
* disable - To disable the feature until the next usage period begins.
*
*
*
*
* @param breachAction
* The action that Amazon Redshift takes when the limit is reached. Possible values are:
*
* -
*
* log - To log an event in a system table. The default is log.
*
*
* -
*
* emit-metric - To emit CloudWatch metrics.
*
*
* -
*
* disable - To disable the feature until the next usage period begins.
*
*
* @see UsageLimitBreachAction
*/
public void setBreachAction(String breachAction) {
this.breachAction = breachAction;
}
/**
*
* The action that Amazon Redshift takes when the limit is reached. Possible values are:
*
*
* -
*
* log - To log an event in a system table. The default is log.
*
*
* -
*
* emit-metric - To emit CloudWatch metrics.
*
*
* -
*
* disable - To disable the feature until the next usage period begins.
*
*
*
*
* @return The action that Amazon Redshift takes when the limit is reached. Possible values are:
*
* -
*
* log - To log an event in a system table. The default is log.
*
*
* -
*
* emit-metric - To emit CloudWatch metrics.
*
*
* -
*
* disable - To disable the feature until the next usage period begins.
*
*
* @see UsageLimitBreachAction
*/
public String getBreachAction() {
return this.breachAction;
}
/**
*
* The action that Amazon Redshift takes when the limit is reached. Possible values are:
*
*
* -
*
* log - To log an event in a system table. The default is log.
*
*
* -
*
* emit-metric - To emit CloudWatch metrics.
*
*
* -
*
* disable - To disable the feature until the next usage period begins.
*
*
*
*
* @param breachAction
* The action that Amazon Redshift takes when the limit is reached. Possible values are:
*
* -
*
* log - To log an event in a system table. The default is log.
*
*
* -
*
* emit-metric - To emit CloudWatch metrics.
*
*
* -
*
* disable - To disable the feature until the next usage period begins.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see UsageLimitBreachAction
*/
public UsageLimit withBreachAction(String breachAction) {
setBreachAction(breachAction);
return this;
}
/**
*
* The action that Amazon Redshift takes when the limit is reached. Possible values are:
*
*
* -
*
* log - To log an event in a system table. The default is log.
*
*
* -
*
* emit-metric - To emit CloudWatch metrics.
*
*
* -
*
* disable - To disable the feature until the next usage period begins.
*
*
*
*
* @param breachAction
* The action that Amazon Redshift takes when the limit is reached. Possible values are:
*
* -
*
* log - To log an event in a system table. The default is log.
*
*
* -
*
* emit-metric - To emit CloudWatch metrics.
*
*
* -
*
* disable - To disable the feature until the next usage period begins.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see UsageLimitBreachAction
*/
public UsageLimit withBreachAction(UsageLimitBreachAction breachAction) {
this.breachAction = breachAction.toString();
return this;
}
/**
*
* A list of tag instances.
*
*
* @return A list of tag instances.
*/
public java.util.List getTags() {
if (tags == null) {
tags = new com.amazonaws.internal.SdkInternalList();
}
return tags;
}
/**
*
* A list of tag instances.
*
*
* @param tags
* A list of tag instances.
*/
public void setTags(java.util.Collection tags) {
if (tags == null) {
this.tags = null;
return;
}
this.tags = new com.amazonaws.internal.SdkInternalList(tags);
}
/**
*
* A list of tag instances.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param tags
* A list of tag instances.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UsageLimit withTags(Tag... tags) {
if (this.tags == null) {
setTags(new com.amazonaws.internal.SdkInternalList(tags.length));
}
for (Tag ele : tags) {
this.tags.add(ele);
}
return this;
}
/**
*
* A list of tag instances.
*
*
* @param tags
* A list of tag instances.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UsageLimit withTags(java.util.Collection tags) {
setTags(tags);
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 (getUsageLimitId() != null)
sb.append("UsageLimitId: ").append(getUsageLimitId()).append(",");
if (getClusterIdentifier() != null)
sb.append("ClusterIdentifier: ").append(getClusterIdentifier()).append(",");
if (getFeatureType() != null)
sb.append("FeatureType: ").append(getFeatureType()).append(",");
if (getLimitType() != null)
sb.append("LimitType: ").append(getLimitType()).append(",");
if (getAmount() != null)
sb.append("Amount: ").append(getAmount()).append(",");
if (getPeriod() != null)
sb.append("Period: ").append(getPeriod()).append(",");
if (getBreachAction() != null)
sb.append("BreachAction: ").append(getBreachAction()).append(",");
if (getTags() != null)
sb.append("Tags: ").append(getTags());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof UsageLimit == false)
return false;
UsageLimit other = (UsageLimit) obj;
if (other.getUsageLimitId() == null ^ this.getUsageLimitId() == null)
return false;
if (other.getUsageLimitId() != null && other.getUsageLimitId().equals(this.getUsageLimitId()) == false)
return false;
if (other.getClusterIdentifier() == null ^ this.getClusterIdentifier() == null)
return false;
if (other.getClusterIdentifier() != null && other.getClusterIdentifier().equals(this.getClusterIdentifier()) == false)
return false;
if (other.getFeatureType() == null ^ this.getFeatureType() == null)
return false;
if (other.getFeatureType() != null && other.getFeatureType().equals(this.getFeatureType()) == false)
return false;
if (other.getLimitType() == null ^ this.getLimitType() == null)
return false;
if (other.getLimitType() != null && other.getLimitType().equals(this.getLimitType()) == false)
return false;
if (other.getAmount() == null ^ this.getAmount() == null)
return false;
if (other.getAmount() != null && other.getAmount().equals(this.getAmount()) == 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.getBreachAction() == null ^ this.getBreachAction() == null)
return false;
if (other.getBreachAction() != null && other.getBreachAction().equals(this.getBreachAction()) == false)
return false;
if (other.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getUsageLimitId() == null) ? 0 : getUsageLimitId().hashCode());
hashCode = prime * hashCode + ((getClusterIdentifier() == null) ? 0 : getClusterIdentifier().hashCode());
hashCode = prime * hashCode + ((getFeatureType() == null) ? 0 : getFeatureType().hashCode());
hashCode = prime * hashCode + ((getLimitType() == null) ? 0 : getLimitType().hashCode());
hashCode = prime * hashCode + ((getAmount() == null) ? 0 : getAmount().hashCode());
hashCode = prime * hashCode + ((getPeriod() == null) ? 0 : getPeriod().hashCode());
hashCode = prime * hashCode + ((getBreachAction() == null) ? 0 : getBreachAction().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
return hashCode;
}
@Override
public UsageLimit clone() {
try {
return (UsageLimit) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}