com.amazonaws.services.autoscaling.model.TargetTrackingConfiguration Maven / Gradle / Ivy
Show all versions of aws-java-sdk-autoscaling Show documentation
/*
* Copyright 2013-2018 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.autoscaling.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* Represents a target tracking policy configuration.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class TargetTrackingConfiguration implements Serializable, Cloneable {
/**
*
* A predefined metric. You can specify either a predefined metric or a customized metric.
*
*/
private PredefinedMetricSpecification predefinedMetricSpecification;
/**
*
* A customized metric.
*
*/
private CustomizedMetricSpecification customizedMetricSpecification;
/**
*
* The target value for the metric.
*
*/
private Double targetValue;
/**
*
* Indicates whether scale in by the target tracking policy is disabled. If scale in is disabled, the target
* tracking policy won't remove instances from the Auto Scaling group. Otherwise, the target tracking policy can
* remove instances from the Auto Scaling group. The default is disabled.
*
*/
private Boolean disableScaleIn;
/**
*
* A predefined metric. You can specify either a predefined metric or a customized metric.
*
*
* @param predefinedMetricSpecification
* A predefined metric. You can specify either a predefined metric or a customized metric.
*/
public void setPredefinedMetricSpecification(PredefinedMetricSpecification predefinedMetricSpecification) {
this.predefinedMetricSpecification = predefinedMetricSpecification;
}
/**
*
* A predefined metric. You can specify either a predefined metric or a customized metric.
*
*
* @return A predefined metric. You can specify either a predefined metric or a customized metric.
*/
public PredefinedMetricSpecification getPredefinedMetricSpecification() {
return this.predefinedMetricSpecification;
}
/**
*
* A predefined metric. You can specify either a predefined metric or a customized metric.
*
*
* @param predefinedMetricSpecification
* A predefined metric. You can specify either a predefined metric or a customized metric.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TargetTrackingConfiguration withPredefinedMetricSpecification(PredefinedMetricSpecification predefinedMetricSpecification) {
setPredefinedMetricSpecification(predefinedMetricSpecification);
return this;
}
/**
*
* A customized metric.
*
*
* @param customizedMetricSpecification
* A customized metric.
*/
public void setCustomizedMetricSpecification(CustomizedMetricSpecification customizedMetricSpecification) {
this.customizedMetricSpecification = customizedMetricSpecification;
}
/**
*
* A customized metric.
*
*
* @return A customized metric.
*/
public CustomizedMetricSpecification getCustomizedMetricSpecification() {
return this.customizedMetricSpecification;
}
/**
*
* A customized metric.
*
*
* @param customizedMetricSpecification
* A customized metric.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TargetTrackingConfiguration withCustomizedMetricSpecification(CustomizedMetricSpecification customizedMetricSpecification) {
setCustomizedMetricSpecification(customizedMetricSpecification);
return this;
}
/**
*
* The target value for the metric.
*
*
* @param targetValue
* The target value for the metric.
*/
public void setTargetValue(Double targetValue) {
this.targetValue = targetValue;
}
/**
*
* The target value for the metric.
*
*
* @return The target value for the metric.
*/
public Double getTargetValue() {
return this.targetValue;
}
/**
*
* The target value for the metric.
*
*
* @param targetValue
* The target value for the metric.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TargetTrackingConfiguration withTargetValue(Double targetValue) {
setTargetValue(targetValue);
return this;
}
/**
*
* Indicates whether scale in by the target tracking policy is disabled. If scale in is disabled, the target
* tracking policy won't remove instances from the Auto Scaling group. Otherwise, the target tracking policy can
* remove instances from the Auto Scaling group. The default is disabled.
*
*
* @param disableScaleIn
* Indicates whether scale in by the target tracking policy is disabled. If scale in is disabled, the target
* tracking policy won't remove instances from the Auto Scaling group. Otherwise, the target tracking policy
* can remove instances from the Auto Scaling group. The default is disabled.
*/
public void setDisableScaleIn(Boolean disableScaleIn) {
this.disableScaleIn = disableScaleIn;
}
/**
*
* Indicates whether scale in by the target tracking policy is disabled. If scale in is disabled, the target
* tracking policy won't remove instances from the Auto Scaling group. Otherwise, the target tracking policy can
* remove instances from the Auto Scaling group. The default is disabled.
*
*
* @return Indicates whether scale in by the target tracking policy is disabled. If scale in is disabled, the target
* tracking policy won't remove instances from the Auto Scaling group. Otherwise, the target tracking policy
* can remove instances from the Auto Scaling group. The default is disabled.
*/
public Boolean getDisableScaleIn() {
return this.disableScaleIn;
}
/**
*
* Indicates whether scale in by the target tracking policy is disabled. If scale in is disabled, the target
* tracking policy won't remove instances from the Auto Scaling group. Otherwise, the target tracking policy can
* remove instances from the Auto Scaling group. The default is disabled.
*
*
* @param disableScaleIn
* Indicates whether scale in by the target tracking policy is disabled. If scale in is disabled, the target
* tracking policy won't remove instances from the Auto Scaling group. Otherwise, the target tracking policy
* can remove instances from the Auto Scaling group. The default is disabled.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TargetTrackingConfiguration withDisableScaleIn(Boolean disableScaleIn) {
setDisableScaleIn(disableScaleIn);
return this;
}
/**
*
* Indicates whether scale in by the target tracking policy is disabled. If scale in is disabled, the target
* tracking policy won't remove instances from the Auto Scaling group. Otherwise, the target tracking policy can
* remove instances from the Auto Scaling group. The default is disabled.
*
*
* @return Indicates whether scale in by the target tracking policy is disabled. If scale in is disabled, the target
* tracking policy won't remove instances from the Auto Scaling group. Otherwise, the target tracking policy
* can remove instances from the Auto Scaling group. The default is disabled.
*/
public Boolean isDisableScaleIn() {
return this.disableScaleIn;
}
/**
* 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 (getPredefinedMetricSpecification() != null)
sb.append("PredefinedMetricSpecification: ").append(getPredefinedMetricSpecification()).append(",");
if (getCustomizedMetricSpecification() != null)
sb.append("CustomizedMetricSpecification: ").append(getCustomizedMetricSpecification()).append(",");
if (getTargetValue() != null)
sb.append("TargetValue: ").append(getTargetValue()).append(",");
if (getDisableScaleIn() != null)
sb.append("DisableScaleIn: ").append(getDisableScaleIn());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof TargetTrackingConfiguration == false)
return false;
TargetTrackingConfiguration other = (TargetTrackingConfiguration) obj;
if (other.getPredefinedMetricSpecification() == null ^ this.getPredefinedMetricSpecification() == null)
return false;
if (other.getPredefinedMetricSpecification() != null
&& other.getPredefinedMetricSpecification().equals(this.getPredefinedMetricSpecification()) == false)
return false;
if (other.getCustomizedMetricSpecification() == null ^ this.getCustomizedMetricSpecification() == null)
return false;
if (other.getCustomizedMetricSpecification() != null
&& other.getCustomizedMetricSpecification().equals(this.getCustomizedMetricSpecification()) == false)
return false;
if (other.getTargetValue() == null ^ this.getTargetValue() == null)
return false;
if (other.getTargetValue() != null && other.getTargetValue().equals(this.getTargetValue()) == false)
return false;
if (other.getDisableScaleIn() == null ^ this.getDisableScaleIn() == null)
return false;
if (other.getDisableScaleIn() != null && other.getDisableScaleIn().equals(this.getDisableScaleIn()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getPredefinedMetricSpecification() == null) ? 0 : getPredefinedMetricSpecification().hashCode());
hashCode = prime * hashCode + ((getCustomizedMetricSpecification() == null) ? 0 : getCustomizedMetricSpecification().hashCode());
hashCode = prime * hashCode + ((getTargetValue() == null) ? 0 : getTargetValue().hashCode());
hashCode = prime * hashCode + ((getDisableScaleIn() == null) ? 0 : getDisableScaleIn().hashCode());
return hashCode;
}
@Override
public TargetTrackingConfiguration clone() {
try {
return (TargetTrackingConfiguration) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}