/* * 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.elasticmapreduce.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *
* The launch specification for Spot Instances in the instance fleet, which determines the defined duration, * provisioning timeout behavior, and allocation strategy. *
** The instance fleet configuration is available only in Amazon EMR releases 4.8.0 and later, excluding 5.0.x versions. * Spot Instance allocation strategy is available in Amazon EMR releases 5.12.1 and later. *
** Spot Instances with a defined duration (also known as Spot blocks) are no longer available to new customers from July * 1, 2021. For customers who have previously used the feature, we will continue to support Spot Instances with a * defined duration until December 31, 2022. *
*
* The Spot provisioning timeout period in minutes. If Spot Instances are not provisioned within this time period,
* the TimeOutAction
is taken. Minimum value is 5 and maximum value is 1440. The timeout applies only
* during initial provisioning, when the cluster is first created.
*
* The action to take when TargetSpotCapacity
has not been fulfilled when the
* TimeoutDurationMinutes
has expired; that is, when all Spot Instances could not be provisioned within
* the Spot provisioning timeout. Valid values are TERMINATE_CLUSTER
and
* SWITCH_TO_ON_DEMAND
. SWITCH_TO_ON_DEMAND specifies that if no Spot Instances are available,
* On-Demand Instances should be provisioned to fulfill any remaining Spot capacity.
*
* The defined duration for Spot Instances (also known as Spot blocks) in minutes. When specified, the Spot Instance * does not terminate before the defined duration expires, and defined duration pricing for Spot Instances applies. * Valid values are 60, 120, 180, 240, 300, or 360. The duration period starts as soon as a Spot Instance receives * its instance ID. At the end of the duration, Amazon EC2 marks the Spot Instance for termination and provides a * Spot Instance termination notice, which gives the instance a two-minute warning before it terminates. *
** Spot Instances with a defined duration (also known as Spot blocks) are no longer available to new customers from * July 1, 2021. For customers who have previously used the feature, we will continue to support Spot Instances with * a defined duration until December 31, 2022. *
** Specifies the strategy to use in launching Spot Instance fleets. Currently, the only option is capacity-optimized * (the default), which launches instances from Spot Instance pools with optimal capacity for the number of * instances that are launching. *
*/ private String allocationStrategy; /** *
* The Spot provisioning timeout period in minutes. If Spot Instances are not provisioned within this time period,
* the TimeOutAction
is taken. Minimum value is 5 and maximum value is 1440. The timeout applies only
* during initial provisioning, when the cluster is first created.
*
TimeOutAction
is taken. Minimum value is 5 and maximum value is 1440. The timeout
* applies only during initial provisioning, when the cluster is first created.
*/
public void setTimeoutDurationMinutes(Integer timeoutDurationMinutes) {
this.timeoutDurationMinutes = timeoutDurationMinutes;
}
/**
*
* The Spot provisioning timeout period in minutes. If Spot Instances are not provisioned within this time period,
* the TimeOutAction
is taken. Minimum value is 5 and maximum value is 1440. The timeout applies only
* during initial provisioning, when the cluster is first created.
*
TimeOutAction
is taken. Minimum value is 5 and maximum value is 1440. The
* timeout applies only during initial provisioning, when the cluster is first created.
*/
public Integer getTimeoutDurationMinutes() {
return this.timeoutDurationMinutes;
}
/**
*
* The Spot provisioning timeout period in minutes. If Spot Instances are not provisioned within this time period,
* the TimeOutAction
is taken. Minimum value is 5 and maximum value is 1440. The timeout applies only
* during initial provisioning, when the cluster is first created.
*
TimeOutAction
is taken. Minimum value is 5 and maximum value is 1440. The timeout
* applies only during initial provisioning, when the cluster is first created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SpotProvisioningSpecification withTimeoutDurationMinutes(Integer timeoutDurationMinutes) {
setTimeoutDurationMinutes(timeoutDurationMinutes);
return this;
}
/**
*
* The action to take when TargetSpotCapacity
has not been fulfilled when the
* TimeoutDurationMinutes
has expired; that is, when all Spot Instances could not be provisioned within
* the Spot provisioning timeout. Valid values are TERMINATE_CLUSTER
and
* SWITCH_TO_ON_DEMAND
. SWITCH_TO_ON_DEMAND specifies that if no Spot Instances are available,
* On-Demand Instances should be provisioned to fulfill any remaining Spot capacity.
*
TargetSpotCapacity
has not been fulfilled when the
* TimeoutDurationMinutes
has expired; that is, when all Spot Instances could not be provisioned
* within the Spot provisioning timeout. Valid values are TERMINATE_CLUSTER
and
* SWITCH_TO_ON_DEMAND
. SWITCH_TO_ON_DEMAND specifies that if no Spot Instances are available,
* On-Demand Instances should be provisioned to fulfill any remaining Spot capacity.
* @see SpotProvisioningTimeoutAction
*/
public void setTimeoutAction(String timeoutAction) {
this.timeoutAction = timeoutAction;
}
/**
*
* The action to take when TargetSpotCapacity
has not been fulfilled when the
* TimeoutDurationMinutes
has expired; that is, when all Spot Instances could not be provisioned within
* the Spot provisioning timeout. Valid values are TERMINATE_CLUSTER
and
* SWITCH_TO_ON_DEMAND
. SWITCH_TO_ON_DEMAND specifies that if no Spot Instances are available,
* On-Demand Instances should be provisioned to fulfill any remaining Spot capacity.
*
TargetSpotCapacity
has not been fulfilled when the
* TimeoutDurationMinutes
has expired; that is, when all Spot Instances could not be
* provisioned within the Spot provisioning timeout. Valid values are TERMINATE_CLUSTER
and
* SWITCH_TO_ON_DEMAND
. SWITCH_TO_ON_DEMAND specifies that if no Spot Instances are available,
* On-Demand Instances should be provisioned to fulfill any remaining Spot capacity.
* @see SpotProvisioningTimeoutAction
*/
public String getTimeoutAction() {
return this.timeoutAction;
}
/**
*
* The action to take when TargetSpotCapacity
has not been fulfilled when the
* TimeoutDurationMinutes
has expired; that is, when all Spot Instances could not be provisioned within
* the Spot provisioning timeout. Valid values are TERMINATE_CLUSTER
and
* SWITCH_TO_ON_DEMAND
. SWITCH_TO_ON_DEMAND specifies that if no Spot Instances are available,
* On-Demand Instances should be provisioned to fulfill any remaining Spot capacity.
*
TargetSpotCapacity
has not been fulfilled when the
* TimeoutDurationMinutes
has expired; that is, when all Spot Instances could not be provisioned
* within the Spot provisioning timeout. Valid values are TERMINATE_CLUSTER
and
* SWITCH_TO_ON_DEMAND
. SWITCH_TO_ON_DEMAND specifies that if no Spot Instances are available,
* On-Demand Instances should be provisioned to fulfill any remaining Spot capacity.
* @return Returns a reference to this object so that method calls can be chained together.
* @see SpotProvisioningTimeoutAction
*/
public SpotProvisioningSpecification withTimeoutAction(String timeoutAction) {
setTimeoutAction(timeoutAction);
return this;
}
/**
*
* The action to take when TargetSpotCapacity
has not been fulfilled when the
* TimeoutDurationMinutes
has expired; that is, when all Spot Instances could not be provisioned within
* the Spot provisioning timeout. Valid values are TERMINATE_CLUSTER
and
* SWITCH_TO_ON_DEMAND
. SWITCH_TO_ON_DEMAND specifies that if no Spot Instances are available,
* On-Demand Instances should be provisioned to fulfill any remaining Spot capacity.
*
TargetSpotCapacity
has not been fulfilled when the
* TimeoutDurationMinutes
has expired; that is, when all Spot Instances could not be provisioned
* within the Spot provisioning timeout. Valid values are TERMINATE_CLUSTER
and
* SWITCH_TO_ON_DEMAND
. SWITCH_TO_ON_DEMAND specifies that if no Spot Instances are available,
* On-Demand Instances should be provisioned to fulfill any remaining Spot capacity.
* @see SpotProvisioningTimeoutAction
*/
public void setTimeoutAction(SpotProvisioningTimeoutAction timeoutAction) {
withTimeoutAction(timeoutAction);
}
/**
*
* The action to take when TargetSpotCapacity
has not been fulfilled when the
* TimeoutDurationMinutes
has expired; that is, when all Spot Instances could not be provisioned within
* the Spot provisioning timeout. Valid values are TERMINATE_CLUSTER
and
* SWITCH_TO_ON_DEMAND
. SWITCH_TO_ON_DEMAND specifies that if no Spot Instances are available,
* On-Demand Instances should be provisioned to fulfill any remaining Spot capacity.
*
TargetSpotCapacity
has not been fulfilled when the
* TimeoutDurationMinutes
has expired; that is, when all Spot Instances could not be provisioned
* within the Spot provisioning timeout. Valid values are TERMINATE_CLUSTER
and
* SWITCH_TO_ON_DEMAND
. SWITCH_TO_ON_DEMAND specifies that if no Spot Instances are available,
* On-Demand Instances should be provisioned to fulfill any remaining Spot capacity.
* @return Returns a reference to this object so that method calls can be chained together.
* @see SpotProvisioningTimeoutAction
*/
public SpotProvisioningSpecification withTimeoutAction(SpotProvisioningTimeoutAction timeoutAction) {
this.timeoutAction = timeoutAction.toString();
return this;
}
/**
* * The defined duration for Spot Instances (also known as Spot blocks) in minutes. When specified, the Spot Instance * does not terminate before the defined duration expires, and defined duration pricing for Spot Instances applies. * Valid values are 60, 120, 180, 240, 300, or 360. The duration period starts as soon as a Spot Instance receives * its instance ID. At the end of the duration, Amazon EC2 marks the Spot Instance for termination and provides a * Spot Instance termination notice, which gives the instance a two-minute warning before it terminates. *
** Spot Instances with a defined duration (also known as Spot blocks) are no longer available to new customers from * July 1, 2021. For customers who have previously used the feature, we will continue to support Spot Instances with * a defined duration until December 31, 2022. *
** Spot Instances with a defined duration (also known as Spot blocks) are no longer available to new * customers from July 1, 2021. For customers who have previously used the feature, we will continue to * support Spot Instances with a defined duration until December 31, 2022. *
*/ public void setBlockDurationMinutes(Integer blockDurationMinutes) { this.blockDurationMinutes = blockDurationMinutes; } /** ** The defined duration for Spot Instances (also known as Spot blocks) in minutes. When specified, the Spot Instance * does not terminate before the defined duration expires, and defined duration pricing for Spot Instances applies. * Valid values are 60, 120, 180, 240, 300, or 360. The duration period starts as soon as a Spot Instance receives * its instance ID. At the end of the duration, Amazon EC2 marks the Spot Instance for termination and provides a * Spot Instance termination notice, which gives the instance a two-minute warning before it terminates. *
** Spot Instances with a defined duration (also known as Spot blocks) are no longer available to new customers from * July 1, 2021. For customers who have previously used the feature, we will continue to support Spot Instances with * a defined duration until December 31, 2022. *
** Spot Instances with a defined duration (also known as Spot blocks) are no longer available to new * customers from July 1, 2021. For customers who have previously used the feature, we will continue to * support Spot Instances with a defined duration until December 31, 2022. *
*/ public Integer getBlockDurationMinutes() { return this.blockDurationMinutes; } /** ** The defined duration for Spot Instances (also known as Spot blocks) in minutes. When specified, the Spot Instance * does not terminate before the defined duration expires, and defined duration pricing for Spot Instances applies. * Valid values are 60, 120, 180, 240, 300, or 360. The duration period starts as soon as a Spot Instance receives * its instance ID. At the end of the duration, Amazon EC2 marks the Spot Instance for termination and provides a * Spot Instance termination notice, which gives the instance a two-minute warning before it terminates. *
** Spot Instances with a defined duration (also known as Spot blocks) are no longer available to new customers from * July 1, 2021. For customers who have previously used the feature, we will continue to support Spot Instances with * a defined duration until December 31, 2022. *
** Spot Instances with a defined duration (also known as Spot blocks) are no longer available to new * customers from July 1, 2021. For customers who have previously used the feature, we will continue to * support Spot Instances with a defined duration until December 31, 2022. *
* @return Returns a reference to this object so that method calls can be chained together. */ public SpotProvisioningSpecification withBlockDurationMinutes(Integer blockDurationMinutes) { setBlockDurationMinutes(blockDurationMinutes); return this; } /** ** Specifies the strategy to use in launching Spot Instance fleets. Currently, the only option is capacity-optimized * (the default), which launches instances from Spot Instance pools with optimal capacity for the number of * instances that are launching. *
* * @param allocationStrategy * Specifies the strategy to use in launching Spot Instance fleets. Currently, the only option is * capacity-optimized (the default), which launches instances from Spot Instance pools with optimal capacity * for the number of instances that are launching. * @see SpotProvisioningAllocationStrategy */ public void setAllocationStrategy(String allocationStrategy) { this.allocationStrategy = allocationStrategy; } /** ** Specifies the strategy to use in launching Spot Instance fleets. Currently, the only option is capacity-optimized * (the default), which launches instances from Spot Instance pools with optimal capacity for the number of * instances that are launching. *
* * @return Specifies the strategy to use in launching Spot Instance fleets. Currently, the only option is * capacity-optimized (the default), which launches instances from Spot Instance pools with optimal capacity * for the number of instances that are launching. * @see SpotProvisioningAllocationStrategy */ public String getAllocationStrategy() { return this.allocationStrategy; } /** ** Specifies the strategy to use in launching Spot Instance fleets. Currently, the only option is capacity-optimized * (the default), which launches instances from Spot Instance pools with optimal capacity for the number of * instances that are launching. *
* * @param allocationStrategy * Specifies the strategy to use in launching Spot Instance fleets. Currently, the only option is * capacity-optimized (the default), which launches instances from Spot Instance pools with optimal capacity * for the number of instances that are launching. * @return Returns a reference to this object so that method calls can be chained together. * @see SpotProvisioningAllocationStrategy */ public SpotProvisioningSpecification withAllocationStrategy(String allocationStrategy) { setAllocationStrategy(allocationStrategy); return this; } /** ** Specifies the strategy to use in launching Spot Instance fleets. Currently, the only option is capacity-optimized * (the default), which launches instances from Spot Instance pools with optimal capacity for the number of * instances that are launching. *
* * @param allocationStrategy * Specifies the strategy to use in launching Spot Instance fleets. Currently, the only option is * capacity-optimized (the default), which launches instances from Spot Instance pools with optimal capacity * for the number of instances that are launching. * @see SpotProvisioningAllocationStrategy */ public void setAllocationStrategy(SpotProvisioningAllocationStrategy allocationStrategy) { withAllocationStrategy(allocationStrategy); } /** ** Specifies the strategy to use in launching Spot Instance fleets. Currently, the only option is capacity-optimized * (the default), which launches instances from Spot Instance pools with optimal capacity for the number of * instances that are launching. *
* * @param allocationStrategy * Specifies the strategy to use in launching Spot Instance fleets. Currently, the only option is * capacity-optimized (the default), which launches instances from Spot Instance pools with optimal capacity * for the number of instances that are launching. * @return Returns a reference to this object so that method calls can be chained together. * @see SpotProvisioningAllocationStrategy */ public SpotProvisioningSpecification withAllocationStrategy(SpotProvisioningAllocationStrategy allocationStrategy) { this.allocationStrategy = allocationStrategy.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 (getTimeoutDurationMinutes() != null) sb.append("TimeoutDurationMinutes: ").append(getTimeoutDurationMinutes()).append(","); if (getTimeoutAction() != null) sb.append("TimeoutAction: ").append(getTimeoutAction()).append(","); if (getBlockDurationMinutes() != null) sb.append("BlockDurationMinutes: ").append(getBlockDurationMinutes()).append(","); if (getAllocationStrategy() != null) sb.append("AllocationStrategy: ").append(getAllocationStrategy()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof SpotProvisioningSpecification == false) return false; SpotProvisioningSpecification other = (SpotProvisioningSpecification) obj; if (other.getTimeoutDurationMinutes() == null ^ this.getTimeoutDurationMinutes() == null) return false; if (other.getTimeoutDurationMinutes() != null && other.getTimeoutDurationMinutes().equals(this.getTimeoutDurationMinutes()) == false) return false; if (other.getTimeoutAction() == null ^ this.getTimeoutAction() == null) return false; if (other.getTimeoutAction() != null && other.getTimeoutAction().equals(this.getTimeoutAction()) == false) return false; if (other.getBlockDurationMinutes() == null ^ this.getBlockDurationMinutes() == null) return false; if (other.getBlockDurationMinutes() != null && other.getBlockDurationMinutes().equals(this.getBlockDurationMinutes()) == false) return false; if (other.getAllocationStrategy() == null ^ this.getAllocationStrategy() == null) return false; if (other.getAllocationStrategy() != null && other.getAllocationStrategy().equals(this.getAllocationStrategy()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getTimeoutDurationMinutes() == null) ? 0 : getTimeoutDurationMinutes().hashCode()); hashCode = prime * hashCode + ((getTimeoutAction() == null) ? 0 : getTimeoutAction().hashCode()); hashCode = prime * hashCode + ((getBlockDurationMinutes() == null) ? 0 : getBlockDurationMinutes().hashCode()); hashCode = prime * hashCode + ((getAllocationStrategy() == null) ? 0 : getAllocationStrategy().hashCode()); return hashCode; } @Override public SpotProvisioningSpecification clone() { try { return (SpotProvisioningSpecification) 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.elasticmapreduce.model.transform.SpotProvisioningSpecificationMarshaller.getInstance().marshall(this, protocolMarshaller); } }