All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.ec2.model.FleetSpotCapacityRebalance Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon EC2 module holds the client classes that are used for communicating with Amazon EC2 Service

The newest version!
/*
 * Copyright 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 software.amazon.awssdk.services.ec2.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* The strategy to use when Amazon EC2 emits a signal that your Spot Instance is at an elevated risk of being * interrupted. *

*/ @Generated("software.amazon.awssdk:codegen") public final class FleetSpotCapacityRebalance implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField REPLACEMENT_STRATEGY_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("ReplacementStrategy") .getter(getter(FleetSpotCapacityRebalance::replacementStrategyAsString)) .setter(setter(Builder::replacementStrategy)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReplacementStrategy") .unmarshallLocationName("replacementStrategy").build()).build(); private static final SdkField TERMINATION_DELAY_FIELD = SdkField . builder(MarshallingType.INTEGER) .memberName("TerminationDelay") .getter(getter(FleetSpotCapacityRebalance::terminationDelay)) .setter(setter(Builder::terminationDelay)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TerminationDelay") .unmarshallLocationName("terminationDelay").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(REPLACEMENT_STRATEGY_FIELD, TERMINATION_DELAY_FIELD)); private static final Map> SDK_NAME_TO_FIELD = Collections .unmodifiableMap(new HashMap>() { { put("ReplacementStrategy", REPLACEMENT_STRATEGY_FIELD); put("TerminationDelay", TERMINATION_DELAY_FIELD); } }); private static final long serialVersionUID = 1L; private final String replacementStrategy; private final Integer terminationDelay; private FleetSpotCapacityRebalance(BuilderImpl builder) { this.replacementStrategy = builder.replacementStrategy; this.terminationDelay = builder.terminationDelay; } /** *

* The replacement strategy to use. Only available for fleets of type maintain. *

*

* launch - EC2 Fleet launches a new 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 new 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. *

*

* If the service returns an enum value that is not available in the current SDK version, * {@link #replacementStrategy} will return {@link FleetReplacementStrategy#UNKNOWN_TO_SDK_VERSION}. The raw value * returned by the service is available from {@link #replacementStrategyAsString}. *

* * @return The replacement strategy to use. Only available for fleets of type maintain.

*

* launch - EC2 Fleet launches a new 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 new 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 final FleetReplacementStrategy replacementStrategy() { return FleetReplacementStrategy.fromValue(replacementStrategy); } /** *

* The replacement strategy to use. Only available for fleets of type maintain. *

*

* launch - EC2 Fleet launches a new 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 new 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. *

*

* If the service returns an enum value that is not available in the current SDK version, * {@link #replacementStrategy} will return {@link FleetReplacementStrategy#UNKNOWN_TO_SDK_VERSION}. The raw value * returned by the service is available from {@link #replacementStrategyAsString}. *

* * @return The replacement strategy to use. Only available for fleets of type maintain.

*

* launch - EC2 Fleet launches a new 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 new 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 final String replacementStrategyAsString() { return 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. *

* * @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 final Integer terminationDelay() { return terminationDelay; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(replacementStrategyAsString()); hashCode = 31 * hashCode + Objects.hashCode(terminationDelay()); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof FleetSpotCapacityRebalance)) { return false; } FleetSpotCapacityRebalance other = (FleetSpotCapacityRebalance) obj; return Objects.equals(replacementStrategyAsString(), other.replacementStrategyAsString()) && Objects.equals(terminationDelay(), other.terminationDelay()); } /** * 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. */ @Override public final String toString() { return ToString.builder("FleetSpotCapacityRebalance").add("ReplacementStrategy", replacementStrategyAsString()) .add("TerminationDelay", terminationDelay()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ReplacementStrategy": return Optional.ofNullable(clazz.cast(replacementStrategyAsString())); case "TerminationDelay": return Optional.ofNullable(clazz.cast(terminationDelay())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Function getter(Function g) { return obj -> g.apply((FleetSpotCapacityRebalance) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The replacement strategy to use. Only available for fleets of type maintain. *

*

* launch - EC2 Fleet launches a new 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 new 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 new 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 new 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 * @return Returns a reference to this object so that method calls can be chained together. * @see FleetReplacementStrategy */ Builder replacementStrategy(String replacementStrategy); /** *

* The replacement strategy to use. Only available for fleets of type maintain. *

*

* launch - EC2 Fleet launches a new 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 new 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 new 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 new 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 * @return Returns a reference to this object so that method calls can be chained together. * @see FleetReplacementStrategy */ Builder replacementStrategy(FleetReplacementStrategy 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. *

* * @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. */ Builder terminationDelay(Integer terminationDelay); } static final class BuilderImpl implements Builder { private String replacementStrategy; private Integer terminationDelay; private BuilderImpl() { } private BuilderImpl(FleetSpotCapacityRebalance model) { replacementStrategy(model.replacementStrategy); terminationDelay(model.terminationDelay); } public final String getReplacementStrategy() { return replacementStrategy; } public final void setReplacementStrategy(String replacementStrategy) { this.replacementStrategy = replacementStrategy; } @Override public final Builder replacementStrategy(String replacementStrategy) { this.replacementStrategy = replacementStrategy; return this; } @Override public final Builder replacementStrategy(FleetReplacementStrategy replacementStrategy) { this.replacementStrategy(replacementStrategy == null ? null : replacementStrategy.toString()); return this; } public final Integer getTerminationDelay() { return terminationDelay; } public final void setTerminationDelay(Integer terminationDelay) { this.terminationDelay = terminationDelay; } @Override public final Builder terminationDelay(Integer terminationDelay) { this.terminationDelay = terminationDelay; return this; } @Override public FleetSpotCapacityRebalance build() { return new FleetSpotCapacityRebalance(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy