/*
* 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;
import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.Request;
import com.amazonaws.services.ec2.model.transform.CreateFleetRequestMarshaller;
/**
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateFleetRequest extends AmazonWebServiceRequest implements Serializable, Cloneable, DryRunSupportedRequest
* Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more
* information, see Ensuring
* idempotency.
*
* Describes the configuration of Spot Instances in an EC2 Fleet.
*
* Describes the configuration of On-Demand Instances in an EC2 Fleet.
*
* Indicates whether running instances should be terminated if the total target capacity of the EC2 Fleet is
* decreased below the current size of the EC2 Fleet.
*
* Supported only for fleets of type
* The configuration for the EC2 Fleet.
*
* The number of units to request.
*
* Indicates whether running instances should be terminated when the EC2 Fleet expires.
*
* The fleet type. The default value is
*
*
*
* For more information, see EC2 Fleet request
* types in the Amazon EC2 User Guide.
*
* The start date and time of the request, in UTC format (for example,
* YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request
* immediately.
*
* The end date and time of the request, in UTC format (for example,
* YYYY-MM-DDTHH:MM:SSZ). At this point, no new EC2 Fleet requests are
* placed or able to fulfill the request. If no value is specified, the request remains until you cancel it.
*
* Indicates whether EC2 Fleet should replace unhealthy Spot Instances. Supported only for fleets of type
*
* The key-value pair for tagging the EC2 Fleet request on creation. For more information, see Tagging your
* resources.
*
* If the fleet type is
* If the fleet type is
* Reserved.
*
* Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more
* information, see Ensuring
* idempotency.
*
* Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more
* information, see Ensuring
* idempotency.
*
* Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more
* information, see Ensuring
* idempotency.
*
* Describes the configuration of Spot Instances in an EC2 Fleet.
*
* Describes the configuration of Spot Instances in an EC2 Fleet.
*
* Describes the configuration of Spot Instances in an EC2 Fleet.
*
* Describes the configuration of On-Demand Instances in an EC2 Fleet.
*
* Describes the configuration of On-Demand Instances in an EC2 Fleet.
*
* Describes the configuration of On-Demand Instances in an EC2 Fleet.
*
* Indicates whether running instances should be terminated if the total target capacity of the EC2 Fleet is
* decreased below the current size of the EC2 Fleet.
*
* Supported only for fleets of type maintain
.
* maintain
.
*
*
* maintain
- The EC2 Fleet places an asynchronous request for your desired capacity, and continues to
* maintain your desired Spot capacity by replenishing interrupted Spot Instances.
* request
- The EC2 Fleet places an asynchronous one-time request for your desired capacity, but does
* submit Spot requests in alternative capacity pools if Spot capacity is unavailable, and does not maintain Spot
* capacity if Spot Instances are interrupted.
* instant
- The EC2 Fleet places a synchronous one-time request for your desired capacity, and returns
* errors for any instances that could not be launched.
* maintain
. For more information, see EC2
* Fleet health checks in the Amazon EC2 User Guide.
* instant
, specify a resource type of fleet
to tag the fleet or
* instance
to tag the instances at launch.
* maintain
or request
, specify a resource type of fleet
* to tag the fleet. You cannot specify a resource type of instance
. To tag instances at launch,
* specify the tags in a launch template.
* maintain
.
*
* Supported only for fleets of type maintain
.
* @see FleetExcessCapacityTerminationPolicy
*/
public void setExcessCapacityTerminationPolicy(String excessCapacityTerminationPolicy) {
this.excessCapacityTerminationPolicy = excessCapacityTerminationPolicy;
}
/**
*
* Indicates whether running instances should be terminated if the total target capacity of the EC2 Fleet is * decreased below the current size of the EC2 Fleet. *
*
* Supported only for fleets of type maintain
.
*
* Supported only for fleets of type maintain
.
* @see FleetExcessCapacityTerminationPolicy
*/
public String getExcessCapacityTerminationPolicy() {
return this.excessCapacityTerminationPolicy;
}
/**
*
* Indicates whether running instances should be terminated if the total target capacity of the EC2 Fleet is * decreased below the current size of the EC2 Fleet. *
*
* Supported only for fleets of type maintain
.
*
* Supported only for fleets of type maintain
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see FleetExcessCapacityTerminationPolicy
*/
public CreateFleetRequest withExcessCapacityTerminationPolicy(String excessCapacityTerminationPolicy) {
setExcessCapacityTerminationPolicy(excessCapacityTerminationPolicy);
return this;
}
/**
*
* Indicates whether running instances should be terminated if the total target capacity of the EC2 Fleet is * decreased below the current size of the EC2 Fleet. *
*
* Supported only for fleets of type maintain
.
*
* Supported only for fleets of type maintain
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see FleetExcessCapacityTerminationPolicy
*/
public CreateFleetRequest withExcessCapacityTerminationPolicy(FleetExcessCapacityTerminationPolicy excessCapacityTerminationPolicy) {
this.excessCapacityTerminationPolicy = excessCapacityTerminationPolicy.toString();
return this;
}
/**
*
* The configuration for the EC2 Fleet. *
* * @return The configuration for the EC2 Fleet. */ public java.util.List* The configuration for the EC2 Fleet. *
* * @param launchTemplateConfigs * The configuration for the EC2 Fleet. */ public void setLaunchTemplateConfigs(java.util.Collection* The configuration for the EC2 Fleet. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setLaunchTemplateConfigs(java.util.Collection)} or * {@link #withLaunchTemplateConfigs(java.util.Collection)} if you want to override the existing values. *
* * @param launchTemplateConfigs * The configuration for the EC2 Fleet. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateFleetRequest withLaunchTemplateConfigs(FleetLaunchTemplateConfigRequest... launchTemplateConfigs) { if (this.launchTemplateConfigs == null) { setLaunchTemplateConfigs(new com.amazonaws.internal.SdkInternalList* The configuration for the EC2 Fleet. *
* * @param launchTemplateConfigs * The configuration for the EC2 Fleet. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateFleetRequest withLaunchTemplateConfigs(java.util.Collection* The number of units to request. *
* * @param targetCapacitySpecification * The number of units to request. */ public void setTargetCapacitySpecification(TargetCapacitySpecificationRequest targetCapacitySpecification) { this.targetCapacitySpecification = targetCapacitySpecification; } /** ** The number of units to request. *
* * @return The number of units to request. */ public TargetCapacitySpecificationRequest getTargetCapacitySpecification() { return this.targetCapacitySpecification; } /** ** The number of units to request. *
* * @param targetCapacitySpecification * The number of units to request. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateFleetRequest withTargetCapacitySpecification(TargetCapacitySpecificationRequest targetCapacitySpecification) { setTargetCapacitySpecification(targetCapacitySpecification); return this; } /** ** Indicates whether running instances should be terminated when the EC2 Fleet expires. *
* * @param terminateInstancesWithExpiration * Indicates whether running instances should be terminated when the EC2 Fleet expires. */ public void setTerminateInstancesWithExpiration(Boolean terminateInstancesWithExpiration) { this.terminateInstancesWithExpiration = terminateInstancesWithExpiration; } /** ** Indicates whether running instances should be terminated when the EC2 Fleet expires. *
* * @return Indicates whether running instances should be terminated when the EC2 Fleet expires. */ public Boolean getTerminateInstancesWithExpiration() { return this.terminateInstancesWithExpiration; } /** ** Indicates whether running instances should be terminated when the EC2 Fleet expires. *
* * @param terminateInstancesWithExpiration * Indicates whether running instances should be terminated when the EC2 Fleet expires. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateFleetRequest withTerminateInstancesWithExpiration(Boolean terminateInstancesWithExpiration) { setTerminateInstancesWithExpiration(terminateInstancesWithExpiration); return this; } /** ** Indicates whether running instances should be terminated when the EC2 Fleet expires. *
* * @return Indicates whether running instances should be terminated when the EC2 Fleet expires. */ public Boolean isTerminateInstancesWithExpiration() { return this.terminateInstancesWithExpiration; } /** *
* The fleet type. The default value is maintain
.
*
* maintain
- The EC2 Fleet places an asynchronous request for your desired capacity, and continues to
* maintain your desired Spot capacity by replenishing interrupted Spot Instances.
*
* request
- The EC2 Fleet places an asynchronous one-time request for your desired capacity, but does
* submit Spot requests in alternative capacity pools if Spot capacity is unavailable, and does not maintain Spot
* capacity if Spot Instances are interrupted.
*
* instant
- The EC2 Fleet places a synchronous one-time request for your desired capacity, and returns
* errors for any instances that could not be launched.
*
* For more information, see EC2 Fleet request * types in the Amazon EC2 User Guide. *
* * @param type * The fleet type. The default value ismaintain
.
*
* maintain
- The EC2 Fleet places an asynchronous request for your desired capacity, and
* continues to maintain your desired Spot capacity by replenishing interrupted Spot Instances.
*
* request
- The EC2 Fleet places an asynchronous one-time request for your desired capacity,
* but does submit Spot requests in alternative capacity pools if Spot capacity is unavailable, and does not
* maintain Spot capacity if Spot Instances are interrupted.
*
* instant
- The EC2 Fleet places a synchronous one-time request for your desired capacity, and
* returns errors for any instances that could not be launched.
*
* For more information, see EC2 Fleet request * types in the Amazon EC2 User Guide. * @see FleetType */ public void setType(String type) { this.type = type; } /** *
* The fleet type. The default value is maintain
.
*
* maintain
- The EC2 Fleet places an asynchronous request for your desired capacity, and continues to
* maintain your desired Spot capacity by replenishing interrupted Spot Instances.
*
* request
- The EC2 Fleet places an asynchronous one-time request for your desired capacity, but does
* submit Spot requests in alternative capacity pools if Spot capacity is unavailable, and does not maintain Spot
* capacity if Spot Instances are interrupted.
*
* instant
- The EC2 Fleet places a synchronous one-time request for your desired capacity, and returns
* errors for any instances that could not be launched.
*
* For more information, see EC2 Fleet request * types in the Amazon EC2 User Guide. *
* * @return The fleet type. The default value ismaintain
.
*
* maintain
- The EC2 Fleet places an asynchronous request for your desired capacity, and
* continues to maintain your desired Spot capacity by replenishing interrupted Spot Instances.
*
* request
- The EC2 Fleet places an asynchronous one-time request for your desired capacity,
* but does submit Spot requests in alternative capacity pools if Spot capacity is unavailable, and does not
* maintain Spot capacity if Spot Instances are interrupted.
*
* instant
- The EC2 Fleet places a synchronous one-time request for your desired capacity, and
* returns errors for any instances that could not be launched.
*
* For more information, see EC2 Fleet request * types in the Amazon EC2 User Guide. * @see FleetType */ public String getType() { return this.type; } /** *
* The fleet type. The default value is maintain
.
*
* maintain
- The EC2 Fleet places an asynchronous request for your desired capacity, and continues to
* maintain your desired Spot capacity by replenishing interrupted Spot Instances.
*
* request
- The EC2 Fleet places an asynchronous one-time request for your desired capacity, but does
* submit Spot requests in alternative capacity pools if Spot capacity is unavailable, and does not maintain Spot
* capacity if Spot Instances are interrupted.
*
* instant
- The EC2 Fleet places a synchronous one-time request for your desired capacity, and returns
* errors for any instances that could not be launched.
*
* For more information, see EC2 Fleet request * types in the Amazon EC2 User Guide. *
* * @param type * The fleet type. The default value ismaintain
.
*
* maintain
- The EC2 Fleet places an asynchronous request for your desired capacity, and
* continues to maintain your desired Spot capacity by replenishing interrupted Spot Instances.
*
* request
- The EC2 Fleet places an asynchronous one-time request for your desired capacity,
* but does submit Spot requests in alternative capacity pools if Spot capacity is unavailable, and does not
* maintain Spot capacity if Spot Instances are interrupted.
*
* instant
- The EC2 Fleet places a synchronous one-time request for your desired capacity, and
* returns errors for any instances that could not be launched.
*
* For more information, see EC2 Fleet request * types in the Amazon EC2 User Guide. * @return Returns a reference to this object so that method calls can be chained together. * @see FleetType */ public CreateFleetRequest withType(String type) { setType(type); return this; } /** *
* The fleet type. The default value is maintain
.
*
* maintain
- The EC2 Fleet places an asynchronous request for your desired capacity, and continues to
* maintain your desired Spot capacity by replenishing interrupted Spot Instances.
*
* request
- The EC2 Fleet places an asynchronous one-time request for your desired capacity, but does
* submit Spot requests in alternative capacity pools if Spot capacity is unavailable, and does not maintain Spot
* capacity if Spot Instances are interrupted.
*
* instant
- The EC2 Fleet places a synchronous one-time request for your desired capacity, and returns
* errors for any instances that could not be launched.
*
* For more information, see EC2 Fleet request * types in the Amazon EC2 User Guide. *
* * @param type * The fleet type. The default value ismaintain
.
*
* maintain
- The EC2 Fleet places an asynchronous request for your desired capacity, and
* continues to maintain your desired Spot capacity by replenishing interrupted Spot Instances.
*
* request
- The EC2 Fleet places an asynchronous one-time request for your desired capacity,
* but does submit Spot requests in alternative capacity pools if Spot capacity is unavailable, and does not
* maintain Spot capacity if Spot Instances are interrupted.
*
* instant
- The EC2 Fleet places a synchronous one-time request for your desired capacity, and
* returns errors for any instances that could not be launched.
*
* For more information, see EC2 Fleet request * types in the Amazon EC2 User Guide. * @return Returns a reference to this object so that method calls can be chained together. * @see FleetType */ public CreateFleetRequest withType(FleetType type) { this.type = type.toString(); return this; } /** *
* The start date and time of the request, in UTC format (for example, * YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request * immediately. *
* * @param validFrom * The start date and time of the request, in UTC format (for example, * YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the * request immediately. */ public void setValidFrom(java.util.Date validFrom) { this.validFrom = validFrom; } /** ** The start date and time of the request, in UTC format (for example, * YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request * immediately. *
* * @return The start date and time of the request, in UTC format (for example, * YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the * request immediately. */ public java.util.Date getValidFrom() { return this.validFrom; } /** ** The start date and time of the request, in UTC format (for example, * YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request * immediately. *
* * @param validFrom * The start date and time of the request, in UTC format (for example, * YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the * request immediately. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateFleetRequest withValidFrom(java.util.Date validFrom) { setValidFrom(validFrom); return this; } /** ** The end date and time of the request, in UTC format (for example, * YYYY-MM-DDTHH:MM:SSZ). At this point, no new EC2 Fleet requests are * placed or able to fulfill the request. If no value is specified, the request remains until you cancel it. *
* * @param validUntil * The end date and time of the request, in UTC format (for example, * YYYY-MM-DDTHH:MM:SSZ). At this point, no new EC2 Fleet requests * are placed or able to fulfill the request. If no value is specified, the request remains until you cancel * it. */ public void setValidUntil(java.util.Date validUntil) { this.validUntil = validUntil; } /** ** The end date and time of the request, in UTC format (for example, * YYYY-MM-DDTHH:MM:SSZ). At this point, no new EC2 Fleet requests are * placed or able to fulfill the request. If no value is specified, the request remains until you cancel it. *
* * @return The end date and time of the request, in UTC format (for example, * YYYY-MM-DDTHH:MM:SSZ). At this point, no new EC2 Fleet requests * are placed or able to fulfill the request. If no value is specified, the request remains until you cancel * it. */ public java.util.Date getValidUntil() { return this.validUntil; } /** ** The end date and time of the request, in UTC format (for example, * YYYY-MM-DDTHH:MM:SSZ). At this point, no new EC2 Fleet requests are * placed or able to fulfill the request. If no value is specified, the request remains until you cancel it. *
* * @param validUntil * The end date and time of the request, in UTC format (for example, * YYYY-MM-DDTHH:MM:SSZ). At this point, no new EC2 Fleet requests * are placed or able to fulfill the request. If no value is specified, the request remains until you cancel * it. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateFleetRequest withValidUntil(java.util.Date validUntil) { setValidUntil(validUntil); return this; } /** *
* Indicates whether EC2 Fleet should replace unhealthy Spot Instances. Supported only for fleets of type
* maintain
. For more information, see EC2
* Fleet health checks in the Amazon EC2 User Guide.
*
maintain
. For more information, see EC2 Fleet health checks in the Amazon EC2 User Guide.
*/
public void setReplaceUnhealthyInstances(Boolean replaceUnhealthyInstances) {
this.replaceUnhealthyInstances = replaceUnhealthyInstances;
}
/**
*
* Indicates whether EC2 Fleet should replace unhealthy Spot Instances. Supported only for fleets of type
* maintain
. For more information, see EC2
* Fleet health checks in the Amazon EC2 User Guide.
*
maintain
. For more information, see EC2 Fleet health checks in the Amazon EC2 User Guide.
*/
public Boolean getReplaceUnhealthyInstances() {
return this.replaceUnhealthyInstances;
}
/**
*
* Indicates whether EC2 Fleet should replace unhealthy Spot Instances. Supported only for fleets of type
* maintain
. For more information, see EC2
* Fleet health checks in the Amazon EC2 User Guide.
*
maintain
. For more information, see EC2 Fleet health checks in the Amazon EC2 User Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateFleetRequest withReplaceUnhealthyInstances(Boolean replaceUnhealthyInstances) {
setReplaceUnhealthyInstances(replaceUnhealthyInstances);
return this;
}
/**
*
* Indicates whether EC2 Fleet should replace unhealthy Spot Instances. Supported only for fleets of type
* maintain
. For more information, see EC2
* Fleet health checks in the Amazon EC2 User Guide.
*
maintain
. For more information, see EC2 Fleet health checks in the Amazon EC2 User Guide.
*/
public Boolean isReplaceUnhealthyInstances() {
return this.replaceUnhealthyInstances;
}
/**
* * The key-value pair for tagging the EC2 Fleet request on creation. For more information, see Tagging your * resources. *
*
* If the fleet type is instant
, specify a resource type of fleet
to tag the fleet or
* instance
to tag the instances at launch.
*
* If the fleet type is maintain
or request
, specify a resource type of fleet
* to tag the fleet. You cannot specify a resource type of instance
. To tag instances at launch,
* specify the tags in a launch template.
*
* If the fleet type is instant
, specify a resource type of fleet
to tag the fleet
* or instance
to tag the instances at launch.
*
* If the fleet type is
* The key-value pair for tagging the EC2 Fleet request on creation. For more information, see Tagging your
* resources.
*
* If the fleet type is
* If the fleet type is maintain
or request
, specify a resource type of
* fleet
to tag the fleet. You cannot specify a resource type of instance
. To tag
* instances at launch, specify the tags in a launch template.
*/
public java.util.Listinstant
, specify a resource type of fleet
to tag the fleet or
* instance
to tag the instances at launch.
* maintain
or request
, specify a resource type of fleet
* to tag the fleet. You cannot specify a resource type of instance
. To tag instances at launch,
* specify the tags in a launch template.
*
* If the fleet type is instant
, specify a resource type of fleet
to tag the fleet
* or instance
to tag the instances at launch.
*
* If the fleet type is
* The key-value pair for tagging the EC2 Fleet request on creation. For more information, see Tagging your
* resources.
*
* If the fleet type is
* If the fleet type is
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setTagSpecifications(java.util.Collection)} or {@link #withTagSpecifications(java.util.Collection)} if
* you want to override the existing values.
* maintain
or request
, specify a resource type of
* fleet
to tag the fleet. You cannot specify a resource type of instance
. To tag
* instances at launch, specify the tags in a launch template.
*/
public void setTagSpecifications(java.util.Collectioninstant
, specify a resource type of fleet
to tag the fleet or
* instance
to tag the instances at launch.
* maintain
or request
, specify a resource type of fleet
* to tag the fleet. You cannot specify a resource type of instance
. To tag instances at launch,
* specify the tags in a launch template.
*
* If the fleet type is instant
, specify a resource type of fleet
to tag the fleet
* or instance
to tag the instances at launch.
*
* If the fleet type is
* The key-value pair for tagging the EC2 Fleet request on creation. For more information, see Tagging your
* resources.
*
* If the fleet type is
* If the fleet type is maintain
or request
, specify a resource type of
* fleet
to tag the fleet. You cannot specify a resource type of instance
. To tag
* instances at launch, specify the tags in a launch template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateFleetRequest withTagSpecifications(TagSpecification... tagSpecifications) {
if (this.tagSpecifications == null) {
setTagSpecifications(new com.amazonaws.internal.SdkInternalListinstant
, specify a resource type of fleet
to tag the fleet or
* instance
to tag the instances at launch.
* maintain
or request
, specify a resource type of fleet
* to tag the fleet. You cannot specify a resource type of instance
. To tag instances at launch,
* specify the tags in a launch template.
*
* If the fleet type is instant
, specify a resource type of fleet
to tag the fleet
* or instance
to tag the instances at launch.
*
* If the fleet type is
* Reserved.
*
* Reserved.
*
* Reserved.
* maintain
or request
, specify a resource type of
* fleet
to tag the fleet. You cannot specify a resource type of instance
. To tag
* instances at launch, specify the tags in a launch template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateFleetRequest withTagSpecifications(java.util.Collection