Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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;
 
 
Container for the parameters to the RequestSpotInstances operation.

Creates a Spot Instance request. Spot Instances are instances that Amazon EC2 launches when the bid price that you specify exceeds the current Spot Price. Amazon EC2 periodically sets the Spot Price based on available Spot Instance capacity and current Spot Instance requests. For more information, see Spot Instance Requests in the Amazon Elastic Compute Cloud User Guide for Linux .

 
The maximum hourly price (bid) for any Spot Instance launched to fulfill the request.
 
     private String spotPrice;

    
The maximum number of Spot Instances to launch.

Default: 1

 
     private Integer instanceCount;

    
The Spot Instance request type.

Default: one-time

Constraints:
Allowed Values: one-time, persistent

 
     private String type;

    
The start date of the request. If this is a one-time request, the request becomes active at this date and time and remains active until all instances launch, the request expires, or the request is canceled. If the request is persistent, the request becomes active at this date and time and remains active until it expires or is canceled.

Default: The request is effective indefinitely.

 
     private java.util.Date validFrom;

    
The end date of the request. If this is a one-time request, the request remains active until all instances launch, the request is canceled, or this date is reached. If the request is persistent, it remains active until it is canceled or this date and time is reached.

Default: The request is effective indefinitely.

 
     private java.util.Date validUntil;

    
The instance launch group. Launch groups are Spot Instances that launch together and terminate together.

Default: Instances are launched and terminated individually

 
     private String launchGroup;

    
The user-specified name for a logical grouping of bids.

When you specify an Availability Zone group in a Spot Instance request, all Spot Instances in the request are launched in the same Availability Zone. Instance proximity is maintained with this parameter, but the choice of Availability Zone is not. The group applies only to bids for Spot Instances of the same instance type. Any additional Spot Instance requests that are specified with the same Availability Zone group name are launched in that same Availability Zone, as long as at least one instance from the group is still active.

If there is no active instance running in the Availability Zone group that you specify for a new Spot Instance request (all instances are terminated, the bid is expired, or the bid falls below current market), then Amazon EC2 launches the instance in any Availability Zone where the constraint can be met. Consequently, the subsequent set of Spot Instances could be placed in a different zone from the original request, even if you specified the same Availability Zone group.

Default: Instances are launched in any available Availability Zone.

    private String availabilityZoneGroup;

    
The launch specification.
    private LaunchSpecification launchSpecification;

    
Default constructor for a new RequestSpotInstancesRequest object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
    public RequestSpotInstancesRequest() {}
    
    
Constructs a new RequestSpotInstancesRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
spotPrice The maximum hourly price (bid) for any Spot Instance launched to fulfill the request.
    public RequestSpotInstancesRequest(String spotPrice) {
        setSpotPrice(spotPrice);
    }

    
The maximum hourly price (bid) for any Spot Instance launched to fulfill the request.

Returns:
The maximum hourly price (bid) for any Spot Instance launched to fulfill the request.
    public String getSpotPrice() {
        return ;
    }
    
    
The maximum hourly price (bid) for any Spot Instance launched to fulfill the request.

Parameters:
spotPrice The maximum hourly price (bid) for any Spot Instance launched to fulfill the request.
    public void setSpotPrice(String spotPrice) {
        this. = spotPrice;
    }
    
    
The maximum hourly price (bid) for any Spot Instance launched to fulfill the request.

Returns a reference to this object so that method calls can be chained together.

Parameters:
spotPrice The maximum hourly price (bid) for any Spot Instance launched to fulfill the request.
Returns:
A reference to this updated object so that method calls can be chained together.
    public RequestSpotInstancesRequest withSpotPrice(String spotPrice) {
        this. = spotPrice;
        return this;
    }

    
The maximum number of Spot Instances to launch.

Default: 1

Returns:
The maximum number of Spot Instances to launch.

Default: 1

    public Integer getInstanceCount() {
        return ;
    }
    
    
The maximum number of Spot Instances to launch.

Default: 1

Parameters:
instanceCount The maximum number of Spot Instances to launch.

Default: 1

    public void setInstanceCount(Integer instanceCount) {
        this. = instanceCount;
    }
    
    
The maximum number of Spot Instances to launch.

Default: 1

Returns a reference to this object so that method calls can be chained together.

Parameters:
instanceCount The maximum number of Spot Instances to launch.

Default: 1

Returns:
A reference to this updated object so that method calls can be chained together.
    public RequestSpotInstancesRequest withInstanceCount(Integer instanceCount) {
        this. = instanceCount;
        return this;
    }

    
The Spot Instance request type.

Default: one-time

Constraints:
Allowed Values: one-time, persistent

Returns:
The Spot Instance request type.

Default: one-time

See also:
SpotInstanceType
    public String getType() {
        return ;
    }
    
    
The Spot Instance request type.

Default: one-time

Constraints:
Allowed Values: one-time, persistent

Parameters:
type The Spot Instance request type.

Default: one-time

See also:
SpotInstanceType
    public void setType(String type) {
        this. = type;
    }
    
    
The Spot Instance request type.

Default: one-time

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: one-time, persistent

Parameters:
type The Spot Instance request type.

Default: one-time

Returns:
A reference to this updated object so that method calls can be chained together.
See also:
SpotInstanceType
        this. = type;
        return this;
    }

    
The Spot Instance request type.

Default: one-time

Constraints:
Allowed Values: one-time, persistent

Parameters:
type The Spot Instance request type.

Default: one-time

See also:
SpotInstanceType
    public void setType(SpotInstanceType type) {
        this. = type.toString();
    }
    
    
The Spot Instance request type.

Default: one-time

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: one-time, persistent

Parameters:
type The Spot Instance request type.

Default: one-time

Returns:
A reference to this updated object so that method calls can be chained together.
See also:
SpotInstanceType
        this. = type.toString();
        return this;
    }

    
The start date of the request. If this is a one-time request, the request becomes active at this date and time and remains active until all instances launch, the request expires, or the request is canceled. If the request is persistent, the request becomes active at this date and time and remains active until it expires or is canceled.

Default: The request is effective indefinitely.

Returns:
The start date of the request. If this is a one-time request, the request becomes active at this date and time and remains active until all instances launch, the request expires, or the request is canceled. If the request is persistent, the request becomes active at this date and time and remains active until it expires or is canceled.

Default: The request is effective indefinitely.

    public java.util.Date getValidFrom() {
        return ;
    }
    
    
The start date of the request. If this is a one-time request, the request becomes active at this date and time and remains active until all instances launch, the request expires, or the request is canceled. If the request is persistent, the request becomes active at this date and time and remains active until it expires or is canceled.

Default: The request is effective indefinitely.

Parameters:
validFrom The start date of the request. If this is a one-time request, the request becomes active at this date and time and remains active until all instances launch, the request expires, or the request is canceled. If the request is persistent, the request becomes active at this date and time and remains active until it expires or is canceled.

Default: The request is effective indefinitely.

    public void setValidFrom(java.util.Date validFrom) {
        this. = validFrom;
    }
    
    
The start date of the request. If this is a one-time request, the request becomes active at this date and time and remains active until all instances launch, the request expires, or the request is canceled. If the request is persistent, the request becomes active at this date and time and remains active until it expires or is canceled.

Default: The request is effective indefinitely.

Returns a reference to this object so that method calls can be chained together.

Parameters:
validFrom The start date of the request. If this is a one-time request, the request becomes active at this date and time and remains active until all instances launch, the request expires, or the request is canceled. If the request is persistent, the request becomes active at this date and time and remains active until it expires or is canceled.

Default: The request is effective indefinitely.

Returns:
A reference to this updated object so that method calls can be chained together.
        this. = validFrom;
        return this;
    }

    
The end date of the request. If this is a one-time request, the request remains active until all instances launch, the request is canceled, or this date is reached. If the request is persistent, it remains active until it is canceled or this date and time is reached.

Default: The request is effective indefinitely.

Returns:
The end date of the request. If this is a one-time request, the request remains active until all instances launch, the request is canceled, or this date is reached. If the request is persistent, it remains active until it is canceled or this date and time is reached.

Default: The request is effective indefinitely.

    public java.util.Date getValidUntil() {
        return ;
    }
    
    
The end date of the request. If this is a one-time request, the request remains active until all instances launch, the request is canceled, or this date is reached. If the request is persistent, it remains active until it is canceled or this date and time is reached.

Default: The request is effective indefinitely.

Parameters:
validUntil The end date of the request. If this is a one-time request, the request remains active until all instances launch, the request is canceled, or this date is reached. If the request is persistent, it remains active until it is canceled or this date and time is reached.

Default: The request is effective indefinitely.

    public void setValidUntil(java.util.Date validUntil) {
        this. = validUntil;
    }
    
    
The end date of the request. If this is a one-time request, the request remains active until all instances launch, the request is canceled, or this date is reached. If the request is persistent, it remains active until it is canceled or this date and time is reached.

Default: The request is effective indefinitely.

Returns a reference to this object so that method calls can be chained together.

Parameters:
validUntil The end date of the request. If this is a one-time request, the request remains active until all instances launch, the request is canceled, or this date is reached. If the request is persistent, it remains active until it is canceled or this date and time is reached.

Default: The request is effective indefinitely.

Returns:
A reference to this updated object so that method calls can be chained together.
        this. = validUntil;
        return this;
    }

    
The instance launch group. Launch groups are Spot Instances that launch together and terminate together.

Default: Instances are launched and terminated individually

Returns:
The instance launch group. Launch groups are Spot Instances that launch together and terminate together.

Default: Instances are launched and terminated individually

    public String getLaunchGroup() {
        return ;
    }
    
    
The instance launch group. Launch groups are Spot Instances that launch together and terminate together.

Default: Instances are launched and terminated individually

Parameters:
launchGroup The instance launch group. Launch groups are Spot Instances that launch together and terminate together.

Default: Instances are launched and terminated individually

    public void setLaunchGroup(String launchGroup) {
        this. = launchGroup;
    }
    
    
The instance launch group. Launch groups are Spot Instances that launch together and terminate together.

Default: Instances are launched and terminated individually

Returns a reference to this object so that method calls can be chained together.

Parameters:
launchGroup The instance launch group. Launch groups are Spot Instances that launch together and terminate together.

Default: Instances are launched and terminated individually

Returns:
A reference to this updated object so that method calls can be chained together.
    public RequestSpotInstancesRequest withLaunchGroup(String launchGroup) {
        this. = launchGroup;
        return this;
    }

    
The user-specified name for a logical grouping of bids.

When you specify an Availability Zone group in a Spot Instance request, all Spot Instances in the request are launched in the same Availability Zone. Instance proximity is maintained with this parameter, but the choice of Availability Zone is not. The group applies only to bids for Spot Instances of the same instance type. Any additional Spot Instance requests that are specified with the same Availability Zone group name are launched in that same Availability Zone, as long as at least one instance from the group is still active.

If there is no active instance running in the Availability Zone group that you specify for a new Spot Instance request (all instances are terminated, the bid is expired, or the bid falls below current market), then Amazon EC2 launches the instance in any Availability Zone where the constraint can be met. Consequently, the subsequent set of Spot Instances could be placed in a different zone from the original request, even if you specified the same Availability Zone group.

Default: Instances are launched in any available Availability Zone.

Returns:
The user-specified name for a logical grouping of bids.

When you specify an Availability Zone group in a Spot Instance request, all Spot Instances in the request are launched in the same Availability Zone. Instance proximity is maintained with this parameter, but the choice of Availability Zone is not. The group applies only to bids for Spot Instances of the same instance type. Any additional Spot Instance requests that are specified with the same Availability Zone group name are launched in that same Availability Zone, as long as at least one instance from the group is still active.

If there is no active instance running in the Availability Zone group that you specify for a new Spot Instance request (all instances are terminated, the bid is expired, or the bid falls below current market), then Amazon EC2 launches the instance in any Availability Zone where the constraint can be met. Consequently, the subsequent set of Spot Instances could be placed in a different zone from the original request, even if you specified the same Availability Zone group.

Default: Instances are launched in any available Availability Zone.

    public String getAvailabilityZoneGroup() {
        return ;
    }
    
    
The user-specified name for a logical grouping of bids.

When you specify an Availability Zone group in a Spot Instance request, all Spot Instances in the request are launched in the same Availability Zone. Instance proximity is maintained with this parameter, but the choice of Availability Zone is not. The group applies only to bids for Spot Instances of the same instance type. Any additional Spot Instance requests that are specified with the same Availability Zone group name are launched in that same Availability Zone, as long as at least one instance from the group is still active.

If there is no active instance running in the Availability Zone group that you specify for a new Spot Instance request (all instances are terminated, the bid is expired, or the bid falls below current market), then Amazon EC2 launches the instance in any Availability Zone where the constraint can be met. Consequently, the subsequent set of Spot Instances could be placed in a different zone from the original request, even if you specified the same Availability Zone group.

Default: Instances are launched in any available Availability Zone.

Parameters:
availabilityZoneGroup The user-specified name for a logical grouping of bids.

When you specify an Availability Zone group in a Spot Instance request, all Spot Instances in the request are launched in the same Availability Zone. Instance proximity is maintained with this parameter, but the choice of Availability Zone is not. The group applies only to bids for Spot Instances of the same instance type. Any additional Spot Instance requests that are specified with the same Availability Zone group name are launched in that same Availability Zone, as long as at least one instance from the group is still active.

If there is no active instance running in the Availability Zone group that you specify for a new Spot Instance request (all instances are terminated, the bid is expired, or the bid falls below current market), then Amazon EC2 launches the instance in any Availability Zone where the constraint can be met. Consequently, the subsequent set of Spot Instances could be placed in a different zone from the original request, even if you specified the same Availability Zone group.

Default: Instances are launched in any available Availability Zone.

    public void setAvailabilityZoneGroup(String availabilityZoneGroup) {
        this. = availabilityZoneGroup;
    }
    
    
The user-specified name for a logical grouping of bids.

When you specify an Availability Zone group in a Spot Instance request, all Spot Instances in the request are launched in the same Availability Zone. Instance proximity is maintained with this parameter, but the choice of Availability Zone is not. The group applies only to bids for Spot Instances of the same instance type. Any additional Spot Instance requests that are specified with the same Availability Zone group name are launched in that same Availability Zone, as long as at least one instance from the group is still active.

If there is no active instance running in the Availability Zone group that you specify for a new Spot Instance request (all instances are terminated, the bid is expired, or the bid falls below current market), then Amazon EC2 launches the instance in any Availability Zone where the constraint can be met. Consequently, the subsequent set of Spot Instances could be placed in a different zone from the original request, even if you specified the same Availability Zone group.

Default: Instances are launched in any available Availability Zone.

Returns a reference to this object so that method calls can be chained together.

Parameters:
availabilityZoneGroup The user-specified name for a logical grouping of bids.

When you specify an Availability Zone group in a Spot Instance request, all Spot Instances in the request are launched in the same Availability Zone. Instance proximity is maintained with this parameter, but the choice of Availability Zone is not. The group applies only to bids for Spot Instances of the same instance type. Any additional Spot Instance requests that are specified with the same Availability Zone group name are launched in that same Availability Zone, as long as at least one instance from the group is still active.

If there is no active instance running in the Availability Zone group that you specify for a new Spot Instance request (all instances are terminated, the bid is expired, or the bid falls below current market), then Amazon EC2 launches the instance in any Availability Zone where the constraint can be met. Consequently, the subsequent set of Spot Instances could be placed in a different zone from the original request, even if you specified the same Availability Zone group.

Default: Instances are launched in any available Availability Zone.

Returns:
A reference to this updated object so that method calls can be chained together.
    public RequestSpotInstancesRequest withAvailabilityZoneGroup(String availabilityZoneGroup) {
        this. = availabilityZoneGroup;
        return this;
    }

    
The launch specification.

Returns:
The launch specification.
        return ;
    }
    
    
The launch specification.

Parameters:
launchSpecification The launch specification.
    public void setLaunchSpecification(LaunchSpecification launchSpecification) {
        this. = launchSpecification;
    }
    
    
The launch specification.

Returns a reference to this object so that method calls can be chained together.

Parameters:
launchSpecification The launch specification.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = launchSpecification;
        return this;
    }

    
This method is intended for internal use only. Returns the marshaled request configured with additional parameters to enable operation dry-run.
    @Override
        request.addParameter("DryRun", Boolean.toString(true));
        return request;
    }
    
    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getSpotPrice() != nullsb.append("SpotPrice: " + getSpotPrice() + ",");
        if (getInstanceCount() != nullsb.append("InstanceCount: " + getInstanceCount() + ",");
        if (getType() != nullsb.append("Type: " + getType() + ",");
        if (getValidFrom() != nullsb.append("ValidFrom: " + getValidFrom() + ",");
        if (getValidUntil() != nullsb.append("ValidUntil: " + getValidUntil() + ",");
        if (getLaunchGroup() != nullsb.append("LaunchGroup: " + getLaunchGroup() + ",");
        if (getAvailabilityZoneGroup() != nullsb.append("AvailabilityZoneGroup: " + getAvailabilityZoneGroup() + ",");
        if (getLaunchSpecification() != nullsb.append("LaunchSpecification: " + getLaunchSpecification() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getSpotPrice() == null) ? 0 : getSpotPrice().hashCode()); 
        hashCode = prime * hashCode + ((getInstanceCount() == null) ? 0 : getInstanceCount().hashCode()); 
        hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); 
        hashCode = prime * hashCode + ((getValidFrom() == null) ? 0 : getValidFrom().hashCode()); 
        hashCode = prime * hashCode + ((getValidUntil() == null) ? 0 : getValidUntil().hashCode()); 
        hashCode = prime * hashCode + ((getLaunchGroup() == null) ? 0 : getLaunchGroup().hashCode()); 
        hashCode = prime * hashCode + ((getAvailabilityZoneGroup() == null) ? 0 : getAvailabilityZoneGroup().hashCode()); 
        hashCode = prime * hashCode + ((getLaunchSpecification() == null) ? 0 : getLaunchSpecification().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof RequestSpotInstancesRequest == falsereturn false;
        
        if (other.getSpotPrice() == null ^ this.getSpotPrice() == nullreturn false;
        if (other.getSpotPrice() != null && other.getSpotPrice().equals(this.getSpotPrice()) == falsereturn false
        if (other.getInstanceCount() == null ^ this.getInstanceCount() == nullreturn false;
        if (other.getInstanceCount() != null && other.getInstanceCount().equals(this.getInstanceCount()) == falsereturn false
        if (other.getType() == null ^ this.getType() == nullreturn false;
        if (other.getType() != null && other.getType().equals(this.getType()) == falsereturn false
        if (other.getValidFrom() == null ^ this.getValidFrom() == nullreturn false;
        if (other.getValidFrom() != null && other.getValidFrom().equals(this.getValidFrom()) == falsereturn false
        if (other.getValidUntil() == null ^ this.getValidUntil() == nullreturn false;
        if (other.getValidUntil() != null && other.getValidUntil().equals(this.getValidUntil()) == falsereturn false
        if (other.getLaunchGroup() == null ^ this.getLaunchGroup() == nullreturn false;
        if (other.getLaunchGroup() != null && other.getLaunchGroup().equals(this.getLaunchGroup()) == falsereturn false
        if (other.getAvailabilityZoneGroup() == null ^ this.getAvailabilityZoneGroup() == nullreturn false;
        if (other.getAvailabilityZoneGroup() != null && other.getAvailabilityZoneGroup().equals(this.getAvailabilityZoneGroup()) == falsereturn false
        if (other.getLaunchSpecification() == null ^ this.getLaunchSpecification() == nullreturn false;
        if (other.getLaunchSpecification() != null && other.getLaunchSpecification().equals(this.getLaunchSpecification()) == falsereturn false
        return true;
    }
    
    @Override
        
            return (RequestSpotInstancesRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X