com.amazonaws.services.ec2.model.FleetSpotCapacityRebalanceRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ec2 Show documentation
/*
* 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.ec2.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* The Spot Instance replacement strategy to use when Amazon EC2 emits a rebalance notification signal that your Spot
* Instance is at an elevated risk of being interrupted. For more information, see Capacity rebalancing
* in the Amazon EC2 User Guide.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class FleetSpotCapacityRebalanceRequest implements Serializable, Cloneable {
/**
*
* The replacement strategy to use. Only available for fleets of type maintain
.
*
*
* launch
- EC2 Fleet launches a replacement Spot Instance when a rebalance notification is emitted for
* an existing Spot Instance in the fleet. EC2 Fleet does not terminate the instances that receive a rebalance
* notification. You can terminate the old instances, or you can leave them running. You are charged for all
* instances while they are running.
*
*
* launch-before-terminate
- EC2 Fleet launches a replacement Spot Instance when a rebalance
* notification is emitted for an existing Spot Instance in the fleet, and then, after a delay that you specify (in
* TerminationDelay
), terminates the instances that received a rebalance notification.
*
*/
private String replacementStrategy;
/**
*
* The amount of time (in seconds) that Amazon EC2 waits before terminating the old Spot Instance after launching a
* new replacement Spot Instance.
*
*
* Required when ReplacementStrategy
is set to launch-before-terminate
.
*
*
* Not valid when ReplacementStrategy
is set to launch
.
*
*
* Valid values: Minimum value of 120
seconds. Maximum value of 7200
seconds.
*
*/
private Integer terminationDelay;
/**
*
* The replacement strategy to use. Only available for fleets of type maintain
.
*
*
* launch
- EC2 Fleet launches a replacement Spot Instance when a rebalance notification is emitted for
* an existing Spot Instance in the fleet. EC2 Fleet does not terminate the instances that receive a rebalance
* notification. You can terminate the old instances, or you can leave them running. You are charged for all
* instances while they are running.
*
*
* launch-before-terminate
- EC2 Fleet launches a replacement Spot Instance when a rebalance
* notification is emitted for an existing Spot Instance in the fleet, and then, after a delay that you specify (in
* TerminationDelay
), terminates the instances that received a rebalance notification.
*
*
* @param replacementStrategy
* The replacement strategy to use. Only available for fleets of type maintain
.
*
* launch
- EC2 Fleet launches a replacement Spot Instance when a rebalance notification is
* emitted for an existing Spot Instance in the fleet. EC2 Fleet does not terminate the instances that
* receive a rebalance notification. You can terminate the old instances, or you can leave them running. You
* are charged for all instances while they are running.
*
*
* launch-before-terminate
- EC2 Fleet launches a replacement Spot Instance when a rebalance
* notification is emitted for an existing Spot Instance in the fleet, and then, after a delay that you
* specify (in TerminationDelay
), terminates the instances that received a rebalance
* notification.
* @see FleetReplacementStrategy
*/
public void setReplacementStrategy(String replacementStrategy) {
this.replacementStrategy = replacementStrategy;
}
/**
*
* The replacement strategy to use. Only available for fleets of type maintain
.
*
*
* launch
- EC2 Fleet launches a replacement Spot Instance when a rebalance notification is emitted for
* an existing Spot Instance in the fleet. EC2 Fleet does not terminate the instances that receive a rebalance
* notification. You can terminate the old instances, or you can leave them running. You are charged for all
* instances while they are running.
*
*
* launch-before-terminate
- EC2 Fleet launches a replacement Spot Instance when a rebalance
* notification is emitted for an existing Spot Instance in the fleet, and then, after a delay that you specify (in
* TerminationDelay
), terminates the instances that received a rebalance notification.
*
*
* @return The replacement strategy to use. Only available for fleets of type maintain
.
*
* launch
- EC2 Fleet launches a replacement Spot Instance when a rebalance notification is
* emitted for an existing Spot Instance in the fleet. EC2 Fleet does not terminate the instances that
* receive a rebalance notification. You can terminate the old instances, or you can leave them running. You
* are charged for all instances while they are running.
*
*
* launch-before-terminate
- EC2 Fleet launches a replacement Spot Instance when a rebalance
* notification is emitted for an existing Spot Instance in the fleet, and then, after a delay that you
* specify (in TerminationDelay
), terminates the instances that received a rebalance
* notification.
* @see FleetReplacementStrategy
*/
public String getReplacementStrategy() {
return this.replacementStrategy;
}
/**
*
* The replacement strategy to use. Only available for fleets of type maintain
.
*
*
* launch
- EC2 Fleet launches a replacement Spot Instance when a rebalance notification is emitted for
* an existing Spot Instance in the fleet. EC2 Fleet does not terminate the instances that receive a rebalance
* notification. You can terminate the old instances, or you can leave them running. You are charged for all
* instances while they are running.
*
*
* launch-before-terminate
- EC2 Fleet launches a replacement Spot Instance when a rebalance
* notification is emitted for an existing Spot Instance in the fleet, and then, after a delay that you specify (in
* TerminationDelay
), terminates the instances that received a rebalance notification.
*
*
* @param replacementStrategy
* The replacement strategy to use. Only available for fleets of type maintain
.
*
* launch
- EC2 Fleet launches a replacement Spot Instance when a rebalance notification is
* emitted for an existing Spot Instance in the fleet. EC2 Fleet does not terminate the instances that
* receive a rebalance notification. You can terminate the old instances, or you can leave them running. You
* are charged for all instances while they are running.
*
*
* launch-before-terminate
- EC2 Fleet launches a replacement Spot Instance when a rebalance
* notification is emitted for an existing Spot Instance in the fleet, and then, after a delay that you
* specify (in TerminationDelay
), terminates the instances that received a rebalance
* notification.
* @return Returns a reference to this object so that method calls can be chained together.
* @see FleetReplacementStrategy
*/
public FleetSpotCapacityRebalanceRequest withReplacementStrategy(String replacementStrategy) {
setReplacementStrategy(replacementStrategy);
return this;
}
/**
*
* The replacement strategy to use. Only available for fleets of type maintain
.
*
*
* launch
- EC2 Fleet launches a replacement Spot Instance when a rebalance notification is emitted for
* an existing Spot Instance in the fleet. EC2 Fleet does not terminate the instances that receive a rebalance
* notification. You can terminate the old instances, or you can leave them running. You are charged for all
* instances while they are running.
*
*
* launch-before-terminate
- EC2 Fleet launches a replacement Spot Instance when a rebalance
* notification is emitted for an existing Spot Instance in the fleet, and then, after a delay that you specify (in
* TerminationDelay
), terminates the instances that received a rebalance notification.
*
*
* @param replacementStrategy
* The replacement strategy to use. Only available for fleets of type maintain
.
*
* launch
- EC2 Fleet launches a replacement Spot Instance when a rebalance notification is
* emitted for an existing Spot Instance in the fleet. EC2 Fleet does not terminate the instances that
* receive a rebalance notification. You can terminate the old instances, or you can leave them running. You
* are charged for all instances while they are running.
*
*
* launch-before-terminate
- EC2 Fleet launches a replacement Spot Instance when a rebalance
* notification is emitted for an existing Spot Instance in the fleet, and then, after a delay that you
* specify (in TerminationDelay
), terminates the instances that received a rebalance
* notification.
* @return Returns a reference to this object so that method calls can be chained together.
* @see FleetReplacementStrategy
*/
public FleetSpotCapacityRebalanceRequest withReplacementStrategy(FleetReplacementStrategy replacementStrategy) {
this.replacementStrategy = replacementStrategy.toString();
return this;
}
/**
*
* The amount of time (in seconds) that Amazon EC2 waits before terminating the old Spot Instance after launching a
* new replacement Spot Instance.
*
*
* Required when ReplacementStrategy
is set to launch-before-terminate
.
*
*
* Not valid when ReplacementStrategy
is set to launch
.
*
*
* Valid values: Minimum value of 120
seconds. Maximum value of 7200
seconds.
*
*
* @param terminationDelay
* The amount of time (in seconds) that Amazon EC2 waits before terminating the old Spot Instance after
* launching a new replacement Spot Instance.
*
* Required when ReplacementStrategy
is set to launch-before-terminate
.
*
*
* Not valid when ReplacementStrategy
is set to launch
.
*
*
* Valid values: Minimum value of 120
seconds. Maximum value of 7200
seconds.
*/
public void setTerminationDelay(Integer terminationDelay) {
this.terminationDelay = terminationDelay;
}
/**
*
* The amount of time (in seconds) that Amazon EC2 waits before terminating the old Spot Instance after launching a
* new replacement Spot Instance.
*
*
* Required when ReplacementStrategy
is set to launch-before-terminate
.
*
*
* Not valid when ReplacementStrategy
is set to launch
.
*
*
* Valid values: Minimum value of 120
seconds. Maximum value of 7200
seconds.
*
*
* @return The amount of time (in seconds) that Amazon EC2 waits before terminating the old Spot Instance after
* launching a new replacement Spot Instance.
*
* Required when ReplacementStrategy
is set to launch-before-terminate
.
*
*
* Not valid when ReplacementStrategy
is set to launch
.
*
*
* Valid values: Minimum value of 120
seconds. Maximum value of 7200
seconds.
*/
public Integer getTerminationDelay() {
return this.terminationDelay;
}
/**
*
* The amount of time (in seconds) that Amazon EC2 waits before terminating the old Spot Instance after launching a
* new replacement Spot Instance.
*
*
* Required when ReplacementStrategy
is set to launch-before-terminate
.
*
*
* Not valid when ReplacementStrategy
is set to launch
.
*
*
* Valid values: Minimum value of 120
seconds. Maximum value of 7200
seconds.
*
*
* @param terminationDelay
* The amount of time (in seconds) that Amazon EC2 waits before terminating the old Spot Instance after
* launching a new replacement Spot Instance.
*
* Required when ReplacementStrategy
is set to launch-before-terminate
.
*
*
* Not valid when ReplacementStrategy
is set to launch
.
*
*
* Valid values: Minimum value of 120
seconds. Maximum value of 7200
seconds.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FleetSpotCapacityRebalanceRequest withTerminationDelay(Integer terminationDelay) {
setTerminationDelay(terminationDelay);
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 (getReplacementStrategy() != null)
sb.append("ReplacementStrategy: ").append(getReplacementStrategy()).append(",");
if (getTerminationDelay() != null)
sb.append("TerminationDelay: ").append(getTerminationDelay());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof FleetSpotCapacityRebalanceRequest == false)
return false;
FleetSpotCapacityRebalanceRequest other = (FleetSpotCapacityRebalanceRequest) obj;
if (other.getReplacementStrategy() == null ^ this.getReplacementStrategy() == null)
return false;
if (other.getReplacementStrategy() != null && other.getReplacementStrategy().equals(this.getReplacementStrategy()) == false)
return false;
if (other.getTerminationDelay() == null ^ this.getTerminationDelay() == null)
return false;
if (other.getTerminationDelay() != null && other.getTerminationDelay().equals(this.getTerminationDelay()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getReplacementStrategy() == null) ? 0 : getReplacementStrategy().hashCode());
hashCode = prime * hashCode + ((getTerminationDelay() == null) ? 0 : getTerminationDelay().hashCode());
return hashCode;
}
@Override
public FleetSpotCapacityRebalanceRequest clone() {
try {
return (FleetSpotCapacityRebalanceRequest) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}