com.amazonaws.services.ec2.model.PurchaseReservedInstancesOfferingRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ec2 Show documentation
/*
* 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.PurchaseReservedInstancesOfferingRequestMarshaller;
/**
*
* Contains the parameters for PurchaseReservedInstancesOffering.
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class PurchaseReservedInstancesOfferingRequest extends AmazonWebServiceRequest implements Serializable, Cloneable,
DryRunSupportedRequest {
/**
*
* The number of Reserved Instances to purchase.
*
*/
private Integer instanceCount;
/**
*
* The ID of the Reserved Instance offering to purchase.
*
*/
private String reservedInstancesOfferingId;
/**
*
* Specified for Reserved Instance Marketplace offerings to limit the total order and ensure that the Reserved
* Instances are not purchased at unexpected prices.
*
*/
private ReservedInstanceLimitPrice limitPrice;
/**
*
* The time at which to purchase the Reserved Instance, in UTC format (for example,
* YYYY-MM-DDTHH:MM:SSZ).
*
*/
private java.util.Date purchaseTime;
/**
* Default constructor for PurchaseReservedInstancesOfferingRequest object. Callers should use the setter or fluent
* setter (with...) methods to initialize the object after creating it.
*/
public PurchaseReservedInstancesOfferingRequest() {
}
/**
* Constructs a new PurchaseReservedInstancesOfferingRequest object. Callers should use the setter or fluent setter
* (with...) methods to initialize any additional object members.
*
* @param reservedInstancesOfferingId
* The ID of the Reserved Instance offering to purchase.
* @param instanceCount
* The number of Reserved Instances to purchase.
*/
public PurchaseReservedInstancesOfferingRequest(String reservedInstancesOfferingId, Integer instanceCount) {
setReservedInstancesOfferingId(reservedInstancesOfferingId);
setInstanceCount(instanceCount);
}
/**
*
* The number of Reserved Instances to purchase.
*
*
* @param instanceCount
* The number of Reserved Instances to purchase.
*/
public void setInstanceCount(Integer instanceCount) {
this.instanceCount = instanceCount;
}
/**
*
* The number of Reserved Instances to purchase.
*
*
* @return The number of Reserved Instances to purchase.
*/
public Integer getInstanceCount() {
return this.instanceCount;
}
/**
*
* The number of Reserved Instances to purchase.
*
*
* @param instanceCount
* The number of Reserved Instances to purchase.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PurchaseReservedInstancesOfferingRequest withInstanceCount(Integer instanceCount) {
setInstanceCount(instanceCount);
return this;
}
/**
*
* The ID of the Reserved Instance offering to purchase.
*
*
* @param reservedInstancesOfferingId
* The ID of the Reserved Instance offering to purchase.
*/
public void setReservedInstancesOfferingId(String reservedInstancesOfferingId) {
this.reservedInstancesOfferingId = reservedInstancesOfferingId;
}
/**
*
* The ID of the Reserved Instance offering to purchase.
*
*
* @return The ID of the Reserved Instance offering to purchase.
*/
public String getReservedInstancesOfferingId() {
return this.reservedInstancesOfferingId;
}
/**
*
* The ID of the Reserved Instance offering to purchase.
*
*
* @param reservedInstancesOfferingId
* The ID of the Reserved Instance offering to purchase.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PurchaseReservedInstancesOfferingRequest withReservedInstancesOfferingId(String reservedInstancesOfferingId) {
setReservedInstancesOfferingId(reservedInstancesOfferingId);
return this;
}
/**
*
* Specified for Reserved Instance Marketplace offerings to limit the total order and ensure that the Reserved
* Instances are not purchased at unexpected prices.
*
*
* @param limitPrice
* Specified for Reserved Instance Marketplace offerings to limit the total order and ensure that the
* Reserved Instances are not purchased at unexpected prices.
*/
public void setLimitPrice(ReservedInstanceLimitPrice limitPrice) {
this.limitPrice = limitPrice;
}
/**
*
* Specified for Reserved Instance Marketplace offerings to limit the total order and ensure that the Reserved
* Instances are not purchased at unexpected prices.
*
*
* @return Specified for Reserved Instance Marketplace offerings to limit the total order and ensure that the
* Reserved Instances are not purchased at unexpected prices.
*/
public ReservedInstanceLimitPrice getLimitPrice() {
return this.limitPrice;
}
/**
*
* Specified for Reserved Instance Marketplace offerings to limit the total order and ensure that the Reserved
* Instances are not purchased at unexpected prices.
*
*
* @param limitPrice
* Specified for Reserved Instance Marketplace offerings to limit the total order and ensure that the
* Reserved Instances are not purchased at unexpected prices.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PurchaseReservedInstancesOfferingRequest withLimitPrice(ReservedInstanceLimitPrice limitPrice) {
setLimitPrice(limitPrice);
return this;
}
/**
*
* The time at which to purchase the Reserved Instance, in UTC format (for example,
* YYYY-MM-DDTHH:MM:SSZ).
*
*
* @param purchaseTime
* The time at which to purchase the Reserved Instance, in UTC format (for example,
* YYYY-MM-DDTHH:MM:SSZ).
*/
public void setPurchaseTime(java.util.Date purchaseTime) {
this.purchaseTime = purchaseTime;
}
/**
*
* The time at which to purchase the Reserved Instance, in UTC format (for example,
* YYYY-MM-DDTHH:MM:SSZ).
*
*
* @return The time at which to purchase the Reserved Instance, in UTC format (for example,
* YYYY-MM-DDTHH:MM:SSZ).
*/
public java.util.Date getPurchaseTime() {
return this.purchaseTime;
}
/**
*
* The time at which to purchase the Reserved Instance, in UTC format (for example,
* YYYY-MM-DDTHH:MM:SSZ).
*
*
* @param purchaseTime
* The time at which to purchase the Reserved Instance, in UTC format (for example,
* YYYY-MM-DDTHH:MM:SSZ).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PurchaseReservedInstancesOfferingRequest withPurchaseTime(java.util.Date purchaseTime) {
setPurchaseTime(purchaseTime);
return this;
}
/**
* This method is intended for internal use only. Returns the marshaled request configured with additional
* parameters to enable operation dry-run.
*/
@Override
public Request getDryRunRequest() {
Request request = new PurchaseReservedInstancesOfferingRequestMarshaller().marshall(this);
request.addParameter("DryRun", Boolean.toString(true));
return request;
}
/**
* 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 (getInstanceCount() != null)
sb.append("InstanceCount: ").append(getInstanceCount()).append(",");
if (getReservedInstancesOfferingId() != null)
sb.append("ReservedInstancesOfferingId: ").append(getReservedInstancesOfferingId()).append(",");
if (getLimitPrice() != null)
sb.append("LimitPrice: ").append(getLimitPrice()).append(",");
if (getPurchaseTime() != null)
sb.append("PurchaseTime: ").append(getPurchaseTime());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof PurchaseReservedInstancesOfferingRequest == false)
return false;
PurchaseReservedInstancesOfferingRequest other = (PurchaseReservedInstancesOfferingRequest) obj;
if (other.getInstanceCount() == null ^ this.getInstanceCount() == null)
return false;
if (other.getInstanceCount() != null && other.getInstanceCount().equals(this.getInstanceCount()) == false)
return false;
if (other.getReservedInstancesOfferingId() == null ^ this.getReservedInstancesOfferingId() == null)
return false;
if (other.getReservedInstancesOfferingId() != null && other.getReservedInstancesOfferingId().equals(this.getReservedInstancesOfferingId()) == false)
return false;
if (other.getLimitPrice() == null ^ this.getLimitPrice() == null)
return false;
if (other.getLimitPrice() != null && other.getLimitPrice().equals(this.getLimitPrice()) == false)
return false;
if (other.getPurchaseTime() == null ^ this.getPurchaseTime() == null)
return false;
if (other.getPurchaseTime() != null && other.getPurchaseTime().equals(this.getPurchaseTime()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getInstanceCount() == null) ? 0 : getInstanceCount().hashCode());
hashCode = prime * hashCode + ((getReservedInstancesOfferingId() == null) ? 0 : getReservedInstancesOfferingId().hashCode());
hashCode = prime * hashCode + ((getLimitPrice() == null) ? 0 : getLimitPrice().hashCode());
hashCode = prime * hashCode + ((getPurchaseTime() == null) ? 0 : getPurchaseTime().hashCode());
return hashCode;
}
@Override
public PurchaseReservedInstancesOfferingRequest clone() {
return (PurchaseReservedInstancesOfferingRequest) super.clone();
}
}