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

com.amazonaws.services.ec2.model.SpotMarketOptions 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

There is a newer version: 1.12.772
Show newest version
/*
 * Copyright 2019-2024 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 options for Spot Instances. *

* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class SpotMarketOptions implements Serializable, Cloneable { /** *

* The maximum hourly price that you're willing to pay for a Spot Instance. We do not recommend using this parameter * because it can lead to increased interruptions. If you do not specify this parameter, you will pay the current * Spot price. *

* *

* If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do not * specify this parameter. *

*
*/ private String maxPrice; /** *

* The Spot Instance request type. For RunInstances, persistent Spot * Instance requests are only supported when the instance interruption behavior is either hibernate or * stop. *

*/ private String spotInstanceType; /** *

* Deprecated. *

*/ private Integer blockDurationMinutes; /** *

* The end date of the request, in UTC format (YYYY-MM-DDTHH:MM:SSZ). * Supported only for persistent requests. *

*
    *
  • *

    * For a persistent request, the request remains active until the ValidUntil date and time is reached. * Otherwise, the request remains active until you cancel it. *

    *
  • *
  • *

    * For a one-time request, ValidUntil is not supported. The request remains active until all instances * launch or you cancel the request. *

    *
  • *
*/ private java.util.Date validUntil; /** *

* The behavior when a Spot Instance is interrupted. *

*

* If Configured (for * HibernationOptions ) is set to true, the InstanceInterruptionBehavior * parameter is automatically set to hibernate. If you set it to stop or * terminate, you'll get an error. *

*

* If Configured (for * HibernationOptions ) is set to false or null, the * InstanceInterruptionBehavior parameter is automatically set to terminate. You can also * set it to stop or hibernate. *

*

* For more information, see Interruption behavior * in the Amazon EC2 User Guide. *

*/ private String instanceInterruptionBehavior; /** *

* The maximum hourly price that you're willing to pay for a Spot Instance. We do not recommend using this parameter * because it can lead to increased interruptions. If you do not specify this parameter, you will pay the current * Spot price. *

* *

* If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do not * specify this parameter. *

*
* * @param maxPrice * The maximum hourly price that you're willing to pay for a Spot Instance. We do not recommend using this * parameter because it can lead to increased interruptions. If you do not specify this parameter, you will * pay the current Spot price.

*

* If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do not * specify this parameter. *

*/ public void setMaxPrice(String maxPrice) { this.maxPrice = maxPrice; } /** *

* The maximum hourly price that you're willing to pay for a Spot Instance. We do not recommend using this parameter * because it can lead to increased interruptions. If you do not specify this parameter, you will pay the current * Spot price. *

* *

* If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do not * specify this parameter. *

*
* * @return The maximum hourly price that you're willing to pay for a Spot Instance. We do not recommend using this * parameter because it can lead to increased interruptions. If you do not specify this parameter, you will * pay the current Spot price.

*

* If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do * not specify this parameter. *

*/ public String getMaxPrice() { return this.maxPrice; } /** *

* The maximum hourly price that you're willing to pay for a Spot Instance. We do not recommend using this parameter * because it can lead to increased interruptions. If you do not specify this parameter, you will pay the current * Spot price. *

* *

* If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do not * specify this parameter. *

*
* * @param maxPrice * The maximum hourly price that you're willing to pay for a Spot Instance. We do not recommend using this * parameter because it can lead to increased interruptions. If you do not specify this parameter, you will * pay the current Spot price.

*

* If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do not * specify this parameter. *

* @return Returns a reference to this object so that method calls can be chained together. */ public SpotMarketOptions withMaxPrice(String maxPrice) { setMaxPrice(maxPrice); return this; } /** *

* The Spot Instance request type. For RunInstances, persistent Spot * Instance requests are only supported when the instance interruption behavior is either hibernate or * stop. *

* * @param spotInstanceType * The Spot Instance request type. For RunInstances, * persistent Spot Instance requests are only supported when the instance interruption behavior is either * hibernate or stop. * @see SpotInstanceType */ public void setSpotInstanceType(String spotInstanceType) { this.spotInstanceType = spotInstanceType; } /** *

* The Spot Instance request type. For RunInstances, persistent Spot * Instance requests are only supported when the instance interruption behavior is either hibernate or * stop. *

* * @return The Spot Instance request type. For RunInstances, * persistent Spot Instance requests are only supported when the instance interruption behavior is either * hibernate or stop. * @see SpotInstanceType */ public String getSpotInstanceType() { return this.spotInstanceType; } /** *

* The Spot Instance request type. For RunInstances, persistent Spot * Instance requests are only supported when the instance interruption behavior is either hibernate or * stop. *

* * @param spotInstanceType * The Spot Instance request type. For RunInstances, * persistent Spot Instance requests are only supported when the instance interruption behavior is either * hibernate or stop. * @return Returns a reference to this object so that method calls can be chained together. * @see SpotInstanceType */ public SpotMarketOptions withSpotInstanceType(String spotInstanceType) { setSpotInstanceType(spotInstanceType); return this; } /** *

* The Spot Instance request type. For RunInstances, persistent Spot * Instance requests are only supported when the instance interruption behavior is either hibernate or * stop. *

* * @param spotInstanceType * The Spot Instance request type. For RunInstances, * persistent Spot Instance requests are only supported when the instance interruption behavior is either * hibernate or stop. * @return Returns a reference to this object so that method calls can be chained together. * @see SpotInstanceType */ public SpotMarketOptions withSpotInstanceType(SpotInstanceType spotInstanceType) { this.spotInstanceType = spotInstanceType.toString(); return this; } /** *

* Deprecated. *

* * @param blockDurationMinutes * Deprecated. */ public void setBlockDurationMinutes(Integer blockDurationMinutes) { this.blockDurationMinutes = blockDurationMinutes; } /** *

* Deprecated. *

* * @return Deprecated. */ public Integer getBlockDurationMinutes() { return this.blockDurationMinutes; } /** *

* Deprecated. *

* * @param blockDurationMinutes * Deprecated. * @return Returns a reference to this object so that method calls can be chained together. */ public SpotMarketOptions withBlockDurationMinutes(Integer blockDurationMinutes) { setBlockDurationMinutes(blockDurationMinutes); return this; } /** *

* The end date of the request, in UTC format (YYYY-MM-DDTHH:MM:SSZ). * Supported only for persistent requests. *

*
    *
  • *

    * For a persistent request, the request remains active until the ValidUntil date and time is reached. * Otherwise, the request remains active until you cancel it. *

    *
  • *
  • *

    * For a one-time request, ValidUntil is not supported. The request remains active until all instances * launch or you cancel the request. *

    *
  • *
* * @param validUntil * The end date of the request, in UTC format * (YYYY-MM-DDTHH:MM:SSZ). Supported only for persistent * requests.

*
    *
  • *

    * For a persistent request, the request remains active until the ValidUntil date and time is * reached. Otherwise, the request remains active until you cancel it. *

    *
  • *
  • *

    * For a one-time request, ValidUntil is not supported. The request remains active until all * instances launch or you cancel the request. *

    *
  • */ public void setValidUntil(java.util.Date validUntil) { this.validUntil = validUntil; } /** *

    * The end date of the request, in UTC format (YYYY-MM-DDTHH:MM:SSZ). * Supported only for persistent requests. *

    *
      *
    • *

      * For a persistent request, the request remains active until the ValidUntil date and time is reached. * Otherwise, the request remains active until you cancel it. *

      *
    • *
    • *

      * For a one-time request, ValidUntil is not supported. The request remains active until all instances * launch or you cancel the request. *

      *
    • *
    * * @return The end date of the request, in UTC format * (YYYY-MM-DDTHH:MM:SSZ). Supported only for persistent * requests.

    *
      *
    • *

      * For a persistent request, the request remains active until the ValidUntil date and time is * reached. Otherwise, the request remains active until you cancel it. *

      *
    • *
    • *

      * For a one-time request, ValidUntil is not supported. The request remains active until all * instances launch or you cancel the request. *

      *
    • */ public java.util.Date getValidUntil() { return this.validUntil; } /** *

      * The end date of the request, in UTC format (YYYY-MM-DDTHH:MM:SSZ). * Supported only for persistent requests. *

      *
        *
      • *

        * For a persistent request, the request remains active until the ValidUntil date and time is reached. * Otherwise, the request remains active until you cancel it. *

        *
      • *
      • *

        * For a one-time request, ValidUntil is not supported. The request remains active until all instances * launch or you cancel the request. *

        *
      • *
      * * @param validUntil * The end date of the request, in UTC format * (YYYY-MM-DDTHH:MM:SSZ). Supported only for persistent * requests.

      *
        *
      • *

        * For a persistent request, the request remains active until the ValidUntil date and time is * reached. Otherwise, the request remains active until you cancel it. *

        *
      • *
      • *

        * For a one-time request, ValidUntil is not supported. The request remains active until all * instances launch or you cancel the request. *

        *
      • * @return Returns a reference to this object so that method calls can be chained together. */ public SpotMarketOptions withValidUntil(java.util.Date validUntil) { setValidUntil(validUntil); return this; } /** *

        * The behavior when a Spot Instance is interrupted. *

        *

        * If Configured (for * HibernationOptions ) is set to true, the InstanceInterruptionBehavior * parameter is automatically set to hibernate. If you set it to stop or * terminate, you'll get an error. *

        *

        * If Configured (for * HibernationOptions ) is set to false or null, the * InstanceInterruptionBehavior parameter is automatically set to terminate. You can also * set it to stop or hibernate. *

        *

        * For more information, see Interruption behavior * in the Amazon EC2 User Guide. *

        * * @param instanceInterruptionBehavior * The behavior when a Spot Instance is interrupted.

        *

        * If Configured (for * HibernationOptions ) is set to true, the * InstanceInterruptionBehavior parameter is automatically set to hibernate. If you * set it to stop or terminate, you'll get an error. *

        *

        * If Configured (for * HibernationOptions ) is set to false or null, the * InstanceInterruptionBehavior parameter is automatically set to terminate. You * can also set it to stop or hibernate. *

        *

        * For more information, see Interruption * behavior in the Amazon EC2 User Guide. * @see InstanceInterruptionBehavior */ public void setInstanceInterruptionBehavior(String instanceInterruptionBehavior) { this.instanceInterruptionBehavior = instanceInterruptionBehavior; } /** *

        * The behavior when a Spot Instance is interrupted. *

        *

        * If Configured (for * HibernationOptions ) is set to true, the InstanceInterruptionBehavior * parameter is automatically set to hibernate. If you set it to stop or * terminate, you'll get an error. *

        *

        * If Configured (for * HibernationOptions ) is set to false or null, the * InstanceInterruptionBehavior parameter is automatically set to terminate. You can also * set it to stop or hibernate. *

        *

        * For more information, see Interruption behavior * in the Amazon EC2 User Guide. *

        * * @return The behavior when a Spot Instance is interrupted.

        *

        * If Configured (for * HibernationOptions ) is set to true, the * InstanceInterruptionBehavior parameter is automatically set to hibernate. If * you set it to stop or terminate, you'll get an error. *

        *

        * If Configured (for * HibernationOptions ) is set to false or null, the * InstanceInterruptionBehavior parameter is automatically set to terminate. You * can also set it to stop or hibernate. *

        *

        * For more information, see Interruption * behavior in the Amazon EC2 User Guide. * @see InstanceInterruptionBehavior */ public String getInstanceInterruptionBehavior() { return this.instanceInterruptionBehavior; } /** *

        * The behavior when a Spot Instance is interrupted. *

        *

        * If Configured (for * HibernationOptions ) is set to true, the InstanceInterruptionBehavior * parameter is automatically set to hibernate. If you set it to stop or * terminate, you'll get an error. *

        *

        * If Configured (for * HibernationOptions ) is set to false or null, the * InstanceInterruptionBehavior parameter is automatically set to terminate. You can also * set it to stop or hibernate. *

        *

        * For more information, see Interruption behavior * in the Amazon EC2 User Guide. *

        * * @param instanceInterruptionBehavior * The behavior when a Spot Instance is interrupted.

        *

        * If Configured (for * HibernationOptions ) is set to true, the * InstanceInterruptionBehavior parameter is automatically set to hibernate. If you * set it to stop or terminate, you'll get an error. *

        *

        * If Configured (for * HibernationOptions ) is set to false or null, the * InstanceInterruptionBehavior parameter is automatically set to terminate. You * can also set it to stop or hibernate. *

        *

        * For more information, see Interruption * behavior in the Amazon EC2 User Guide. * @return Returns a reference to this object so that method calls can be chained together. * @see InstanceInterruptionBehavior */ public SpotMarketOptions withInstanceInterruptionBehavior(String instanceInterruptionBehavior) { setInstanceInterruptionBehavior(instanceInterruptionBehavior); return this; } /** *

        * The behavior when a Spot Instance is interrupted. *

        *

        * If Configured (for * HibernationOptions ) is set to true, the InstanceInterruptionBehavior * parameter is automatically set to hibernate. If you set it to stop or * terminate, you'll get an error. *

        *

        * If Configured (for * HibernationOptions ) is set to false or null, the * InstanceInterruptionBehavior parameter is automatically set to terminate. You can also * set it to stop or hibernate. *

        *

        * For more information, see Interruption behavior * in the Amazon EC2 User Guide. *

        * * @param instanceInterruptionBehavior * The behavior when a Spot Instance is interrupted.

        *

        * If Configured (for * HibernationOptions ) is set to true, the * InstanceInterruptionBehavior parameter is automatically set to hibernate. If you * set it to stop or terminate, you'll get an error. *

        *

        * If Configured (for * HibernationOptions ) is set to false or null, the * InstanceInterruptionBehavior parameter is automatically set to terminate. You * can also set it to stop or hibernate. *

        *

        * For more information, see Interruption * behavior in the Amazon EC2 User Guide. * @return Returns a reference to this object so that method calls can be chained together. * @see InstanceInterruptionBehavior */ public SpotMarketOptions withInstanceInterruptionBehavior(InstanceInterruptionBehavior instanceInterruptionBehavior) { this.instanceInterruptionBehavior = instanceInterruptionBehavior.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 (getMaxPrice() != null) sb.append("MaxPrice: ").append(getMaxPrice()).append(","); if (getSpotInstanceType() != null) sb.append("SpotInstanceType: ").append(getSpotInstanceType()).append(","); if (getBlockDurationMinutes() != null) sb.append("BlockDurationMinutes: ").append(getBlockDurationMinutes()).append(","); if (getValidUntil() != null) sb.append("ValidUntil: ").append(getValidUntil()).append(","); if (getInstanceInterruptionBehavior() != null) sb.append("InstanceInterruptionBehavior: ").append(getInstanceInterruptionBehavior()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof SpotMarketOptions == false) return false; SpotMarketOptions other = (SpotMarketOptions) obj; if (other.getMaxPrice() == null ^ this.getMaxPrice() == null) return false; if (other.getMaxPrice() != null && other.getMaxPrice().equals(this.getMaxPrice()) == false) return false; if (other.getSpotInstanceType() == null ^ this.getSpotInstanceType() == null) return false; if (other.getSpotInstanceType() != null && other.getSpotInstanceType().equals(this.getSpotInstanceType()) == 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.getValidUntil() == null ^ this.getValidUntil() == null) return false; if (other.getValidUntil() != null && other.getValidUntil().equals(this.getValidUntil()) == false) return false; if (other.getInstanceInterruptionBehavior() == null ^ this.getInstanceInterruptionBehavior() == null) return false; if (other.getInstanceInterruptionBehavior() != null && other.getInstanceInterruptionBehavior().equals(this.getInstanceInterruptionBehavior()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMaxPrice() == null) ? 0 : getMaxPrice().hashCode()); hashCode = prime * hashCode + ((getSpotInstanceType() == null) ? 0 : getSpotInstanceType().hashCode()); hashCode = prime * hashCode + ((getBlockDurationMinutes() == null) ? 0 : getBlockDurationMinutes().hashCode()); hashCode = prime * hashCode + ((getValidUntil() == null) ? 0 : getValidUntil().hashCode()); hashCode = prime * hashCode + ((getInstanceInterruptionBehavior() == null) ? 0 : getInstanceInterruptionBehavior().hashCode()); return hashCode; } @Override public SpotMarketOptions clone() { try { return (SpotMarketOptions) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy