com.amazonaws.services.ec2.model.AllocateHostsRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ec2 Show documentation
/*
* Copyright 2016-2021 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.AllocateHostsRequestMarshaller;
/**
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AllocateHostsRequest extends AmazonWebServiceRequest implements Serializable, Cloneable, DryRunSupportedRequest {
/**
*
* Indicates whether the host accepts any untargeted instance launches that match its instance type configuration,
* or if it only accepts Host tenancy instance launches that specify its unique host ID. For more information, see
* Understanding auto-placement and affinity in the Amazon EC2 User Guide.
*
*
* Default: on
*
*/
private String autoPlacement;
/**
*
* The Availability Zone in which to allocate the Dedicated Host.
*
*/
private String availabilityZone;
/**
*
* Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more
* information, see Ensuring
* Idempotency.
*
*/
private String clientToken;
/**
*
* Specifies the instance type to be supported by the Dedicated Hosts. If you specify an instance type, the
* Dedicated Hosts support instances of the specified instance type only.
*
*
* If you want the Dedicated Hosts to support multiple instance types in a specific instance family, omit this
* parameter and specify InstanceFamily instead. You cannot specify InstanceType and
* InstanceFamily in the same request.
*
*/
private String instanceType;
/**
*
* Specifies the instance family to be supported by the Dedicated Hosts. If you specify an instance family, the
* Dedicated Hosts support multiple instance types within that instance family.
*
*
* If you want the Dedicated Hosts to support a specific instance type only, omit this parameter and specify
* InstanceType instead. You cannot specify InstanceFamily and InstanceType in the same
* request.
*
*/
private String instanceFamily;
/**
*
* The number of Dedicated Hosts to allocate to your account with these parameters.
*
*/
private Integer quantity;
/**
*
* The tags to apply to the Dedicated Host during creation.
*
*/
private com.amazonaws.internal.SdkInternalList tagSpecifications;
/**
*
* Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by
* default. For more information, see Host recovery in
* the Amazon EC2 User Guide.
*
*
* Default: off
*
*/
private String hostRecovery;
/**
*
* Indicates whether the host accepts any untargeted instance launches that match its instance type configuration,
* or if it only accepts Host tenancy instance launches that specify its unique host ID. For more information, see
* Understanding auto-placement and affinity in the Amazon EC2 User Guide.
*
*
* Default: on
*
*
* @param autoPlacement
* Indicates whether the host accepts any untargeted instance launches that match its instance type
* configuration, or if it only accepts Host tenancy instance launches that specify its unique host ID. For
* more information, see Understanding auto-placement and affinity in the Amazon EC2 User Guide.
*
* Default: on
* @see AutoPlacement
*/
public void setAutoPlacement(String autoPlacement) {
this.autoPlacement = autoPlacement;
}
/**
*
* Indicates whether the host accepts any untargeted instance launches that match its instance type configuration,
* or if it only accepts Host tenancy instance launches that specify its unique host ID. For more information, see
* Understanding auto-placement and affinity in the Amazon EC2 User Guide.
*
*
* Default: on
*
*
* @return Indicates whether the host accepts any untargeted instance launches that match its instance type
* configuration, or if it only accepts Host tenancy instance launches that specify its unique host ID. For
* more information, see Understanding auto-placement and affinity in the Amazon EC2 User Guide.
*
* Default: on
* @see AutoPlacement
*/
public String getAutoPlacement() {
return this.autoPlacement;
}
/**
*
* Indicates whether the host accepts any untargeted instance launches that match its instance type configuration,
* or if it only accepts Host tenancy instance launches that specify its unique host ID. For more information, see
* Understanding auto-placement and affinity in the Amazon EC2 User Guide.
*
*
* Default: on
*
*
* @param autoPlacement
* Indicates whether the host accepts any untargeted instance launches that match its instance type
* configuration, or if it only accepts Host tenancy instance launches that specify its unique host ID. For
* more information, see Understanding auto-placement and affinity in the Amazon EC2 User Guide.
*
* Default: on
* @return Returns a reference to this object so that method calls can be chained together.
* @see AutoPlacement
*/
public AllocateHostsRequest withAutoPlacement(String autoPlacement) {
setAutoPlacement(autoPlacement);
return this;
}
/**
*
* Indicates whether the host accepts any untargeted instance launches that match its instance type configuration,
* or if it only accepts Host tenancy instance launches that specify its unique host ID. For more information, see
* Understanding auto-placement and affinity in the Amazon EC2 User Guide.
*
*
* Default: on
*
*
* @param autoPlacement
* Indicates whether the host accepts any untargeted instance launches that match its instance type
* configuration, or if it only accepts Host tenancy instance launches that specify its unique host ID. For
* more information, see Understanding auto-placement and affinity in the Amazon EC2 User Guide.
*
* Default: on
* @see AutoPlacement
*/
public void setAutoPlacement(AutoPlacement autoPlacement) {
withAutoPlacement(autoPlacement);
}
/**
*
* Indicates whether the host accepts any untargeted instance launches that match its instance type configuration,
* or if it only accepts Host tenancy instance launches that specify its unique host ID. For more information, see
* Understanding auto-placement and affinity in the Amazon EC2 User Guide.
*
*
* Default: on
*
*
* @param autoPlacement
* Indicates whether the host accepts any untargeted instance launches that match its instance type
* configuration, or if it only accepts Host tenancy instance launches that specify its unique host ID. For
* more information, see Understanding auto-placement and affinity in the Amazon EC2 User Guide.
*
* Default: on
* @return Returns a reference to this object so that method calls can be chained together.
* @see AutoPlacement
*/
public AllocateHostsRequest withAutoPlacement(AutoPlacement autoPlacement) {
this.autoPlacement = autoPlacement.toString();
return this;
}
/**
*
* The Availability Zone in which to allocate the Dedicated Host.
*
*
* @param availabilityZone
* The Availability Zone in which to allocate the Dedicated Host.
*/
public void setAvailabilityZone(String availabilityZone) {
this.availabilityZone = availabilityZone;
}
/**
*
* The Availability Zone in which to allocate the Dedicated Host.
*
*
* @return The Availability Zone in which to allocate the Dedicated Host.
*/
public String getAvailabilityZone() {
return this.availabilityZone;
}
/**
*
* The Availability Zone in which to allocate the Dedicated Host.
*
*
* @param availabilityZone
* The Availability Zone in which to allocate the Dedicated Host.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AllocateHostsRequest withAvailabilityZone(String availabilityZone) {
setAvailabilityZone(availabilityZone);
return this;
}
/**
*
* Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more
* information, see Ensuring
* Idempotency.
*
*
* @param clientToken
* Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more
* information, see Ensuring
* Idempotency.
*/
public void setClientToken(String clientToken) {
this.clientToken = clientToken;
}
/**
*
* Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more
* information, see Ensuring
* Idempotency.
*
*
* @return Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more
* information, see Ensuring
* Idempotency.
*/
public String getClientToken() {
return this.clientToken;
}
/**
*
* Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more
* information, see Ensuring
* Idempotency.
*
*
* @param clientToken
* Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more
* information, see Ensuring
* Idempotency.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AllocateHostsRequest withClientToken(String clientToken) {
setClientToken(clientToken);
return this;
}
/**
*
* Specifies the instance type to be supported by the Dedicated Hosts. If you specify an instance type, the
* Dedicated Hosts support instances of the specified instance type only.
*
*
* If you want the Dedicated Hosts to support multiple instance types in a specific instance family, omit this
* parameter and specify InstanceFamily instead. You cannot specify InstanceType and
* InstanceFamily in the same request.
*
*
* @param instanceType
* Specifies the instance type to be supported by the Dedicated Hosts. If you specify an instance type, the
* Dedicated Hosts support instances of the specified instance type only.
*
* If you want the Dedicated Hosts to support multiple instance types in a specific instance family, omit
* this parameter and specify InstanceFamily instead. You cannot specify InstanceType and
* InstanceFamily in the same request.
*/
public void setInstanceType(String instanceType) {
this.instanceType = instanceType;
}
/**
*
* Specifies the instance type to be supported by the Dedicated Hosts. If you specify an instance type, the
* Dedicated Hosts support instances of the specified instance type only.
*
*
* If you want the Dedicated Hosts to support multiple instance types in a specific instance family, omit this
* parameter and specify InstanceFamily instead. You cannot specify InstanceType and
* InstanceFamily in the same request.
*
*
* @return Specifies the instance type to be supported by the Dedicated Hosts. If you specify an instance type, the
* Dedicated Hosts support instances of the specified instance type only.
*
* If you want the Dedicated Hosts to support multiple instance types in a specific instance family, omit
* this parameter and specify InstanceFamily instead. You cannot specify InstanceType and
* InstanceFamily in the same request.
*/
public String getInstanceType() {
return this.instanceType;
}
/**
*
* Specifies the instance type to be supported by the Dedicated Hosts. If you specify an instance type, the
* Dedicated Hosts support instances of the specified instance type only.
*
*
* If you want the Dedicated Hosts to support multiple instance types in a specific instance family, omit this
* parameter and specify InstanceFamily instead. You cannot specify InstanceType and
* InstanceFamily in the same request.
*
*
* @param instanceType
* Specifies the instance type to be supported by the Dedicated Hosts. If you specify an instance type, the
* Dedicated Hosts support instances of the specified instance type only.
*
* If you want the Dedicated Hosts to support multiple instance types in a specific instance family, omit
* this parameter and specify InstanceFamily instead. You cannot specify InstanceType and
* InstanceFamily in the same request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AllocateHostsRequest withInstanceType(String instanceType) {
setInstanceType(instanceType);
return this;
}
/**
*
* Specifies the instance family to be supported by the Dedicated Hosts. If you specify an instance family, the
* Dedicated Hosts support multiple instance types within that instance family.
*
*
* If you want the Dedicated Hosts to support a specific instance type only, omit this parameter and specify
* InstanceType instead. You cannot specify InstanceFamily and InstanceType in the same
* request.
*
*
* @param instanceFamily
* Specifies the instance family to be supported by the Dedicated Hosts. If you specify an instance family,
* the Dedicated Hosts support multiple instance types within that instance family.
*
* If you want the Dedicated Hosts to support a specific instance type only, omit this parameter and specify
* InstanceType instead. You cannot specify InstanceFamily and InstanceType in the same
* request.
*/
public void setInstanceFamily(String instanceFamily) {
this.instanceFamily = instanceFamily;
}
/**
*
* Specifies the instance family to be supported by the Dedicated Hosts. If you specify an instance family, the
* Dedicated Hosts support multiple instance types within that instance family.
*
*
* If you want the Dedicated Hosts to support a specific instance type only, omit this parameter and specify
* InstanceType instead. You cannot specify InstanceFamily and InstanceType in the same
* request.
*
*
* @return Specifies the instance family to be supported by the Dedicated Hosts. If you specify an instance family,
* the Dedicated Hosts support multiple instance types within that instance family.
*
* If you want the Dedicated Hosts to support a specific instance type only, omit this parameter and specify
* InstanceType instead. You cannot specify InstanceFamily and InstanceType in the same
* request.
*/
public String getInstanceFamily() {
return this.instanceFamily;
}
/**
*
* Specifies the instance family to be supported by the Dedicated Hosts. If you specify an instance family, the
* Dedicated Hosts support multiple instance types within that instance family.
*
*
* If you want the Dedicated Hosts to support a specific instance type only, omit this parameter and specify
* InstanceType instead. You cannot specify InstanceFamily and InstanceType in the same
* request.
*
*
* @param instanceFamily
* Specifies the instance family to be supported by the Dedicated Hosts. If you specify an instance family,
* the Dedicated Hosts support multiple instance types within that instance family.
*
* If you want the Dedicated Hosts to support a specific instance type only, omit this parameter and specify
* InstanceType instead. You cannot specify InstanceFamily and InstanceType in the same
* request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AllocateHostsRequest withInstanceFamily(String instanceFamily) {
setInstanceFamily(instanceFamily);
return this;
}
/**
*
* The number of Dedicated Hosts to allocate to your account with these parameters.
*
*
* @param quantity
* The number of Dedicated Hosts to allocate to your account with these parameters.
*/
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
/**
*
* The number of Dedicated Hosts to allocate to your account with these parameters.
*
*
* @return The number of Dedicated Hosts to allocate to your account with these parameters.
*/
public Integer getQuantity() {
return this.quantity;
}
/**
*
* The number of Dedicated Hosts to allocate to your account with these parameters.
*
*
* @param quantity
* The number of Dedicated Hosts to allocate to your account with these parameters.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AllocateHostsRequest withQuantity(Integer quantity) {
setQuantity(quantity);
return this;
}
/**
*
* The tags to apply to the Dedicated Host during creation.
*
*
* @return The tags to apply to the Dedicated Host during creation.
*/
public java.util.List getTagSpecifications() {
if (tagSpecifications == null) {
tagSpecifications = new com.amazonaws.internal.SdkInternalList();
}
return tagSpecifications;
}
/**
*
* The tags to apply to the Dedicated Host during creation.
*
*
* @param tagSpecifications
* The tags to apply to the Dedicated Host during creation.
*/
public void setTagSpecifications(java.util.Collection tagSpecifications) {
if (tagSpecifications == null) {
this.tagSpecifications = null;
return;
}
this.tagSpecifications = new com.amazonaws.internal.SdkInternalList(tagSpecifications);
}
/**
*
* The tags to apply to the Dedicated Host during creation.
*
*
* 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.
*
*
* @param tagSpecifications
* The tags to apply to the Dedicated Host during creation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AllocateHostsRequest withTagSpecifications(TagSpecification... tagSpecifications) {
if (this.tagSpecifications == null) {
setTagSpecifications(new com.amazonaws.internal.SdkInternalList(tagSpecifications.length));
}
for (TagSpecification ele : tagSpecifications) {
this.tagSpecifications.add(ele);
}
return this;
}
/**
*
* The tags to apply to the Dedicated Host during creation.
*
*
* @param tagSpecifications
* The tags to apply to the Dedicated Host during creation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AllocateHostsRequest withTagSpecifications(java.util.Collection tagSpecifications) {
setTagSpecifications(tagSpecifications);
return this;
}
/**
*
* Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by
* default. For more information, see Host recovery in
* the Amazon EC2 User Guide.
*
*
* Default: off
*
*
* @param hostRecovery
* Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by
* default. For more information, see Host
* recovery in the Amazon EC2 User Guide.
*
* Default: off
* @see HostRecovery
*/
public void setHostRecovery(String hostRecovery) {
this.hostRecovery = hostRecovery;
}
/**
*
* Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by
* default. For more information, see Host recovery in
* the Amazon EC2 User Guide.
*
*
* Default: off
*
*
* @return Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by
* default. For more information, see Host
* recovery in the Amazon EC2 User Guide.
*
* Default: off
* @see HostRecovery
*/
public String getHostRecovery() {
return this.hostRecovery;
}
/**
*
* Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by
* default. For more information, see Host recovery in
* the Amazon EC2 User Guide.
*
*
* Default: off
*
*
* @param hostRecovery
* Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by
* default. For more information, see Host
* recovery in the Amazon EC2 User Guide.
*
* Default: off
* @return Returns a reference to this object so that method calls can be chained together.
* @see HostRecovery
*/
public AllocateHostsRequest withHostRecovery(String hostRecovery) {
setHostRecovery(hostRecovery);
return this;
}
/**
*
* Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by
* default. For more information, see Host recovery in
* the Amazon EC2 User Guide.
*
*
* Default: off
*
*
* @param hostRecovery
* Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by
* default. For more information, see Host
* recovery in the Amazon EC2 User Guide.
*
* Default: off
* @see HostRecovery
*/
public void setHostRecovery(HostRecovery hostRecovery) {
withHostRecovery(hostRecovery);
}
/**
*
* Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by
* default. For more information, see Host recovery in
* the Amazon EC2 User Guide.
*
*
* Default: off
*
*
* @param hostRecovery
* Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by
* default. For more information, see Host
* recovery in the Amazon EC2 User Guide.
*
* Default: off
* @return Returns a reference to this object so that method calls can be chained together.
* @see HostRecovery
*/
public AllocateHostsRequest withHostRecovery(HostRecovery hostRecovery) {
this.hostRecovery = hostRecovery.toString();
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 AllocateHostsRequestMarshaller().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 (getAutoPlacement() != null)
sb.append("AutoPlacement: ").append(getAutoPlacement()).append(",");
if (getAvailabilityZone() != null)
sb.append("AvailabilityZone: ").append(getAvailabilityZone()).append(",");
if (getClientToken() != null)
sb.append("ClientToken: ").append(getClientToken()).append(",");
if (getInstanceType() != null)
sb.append("InstanceType: ").append(getInstanceType()).append(",");
if (getInstanceFamily() != null)
sb.append("InstanceFamily: ").append(getInstanceFamily()).append(",");
if (getQuantity() != null)
sb.append("Quantity: ").append(getQuantity()).append(",");
if (getTagSpecifications() != null)
sb.append("TagSpecifications: ").append(getTagSpecifications()).append(",");
if (getHostRecovery() != null)
sb.append("HostRecovery: ").append(getHostRecovery());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof AllocateHostsRequest == false)
return false;
AllocateHostsRequest other = (AllocateHostsRequest) obj;
if (other.getAutoPlacement() == null ^ this.getAutoPlacement() == null)
return false;
if (other.getAutoPlacement() != null && other.getAutoPlacement().equals(this.getAutoPlacement()) == false)
return false;
if (other.getAvailabilityZone() == null ^ this.getAvailabilityZone() == null)
return false;
if (other.getAvailabilityZone() != null && other.getAvailabilityZone().equals(this.getAvailabilityZone()) == false)
return false;
if (other.getClientToken() == null ^ this.getClientToken() == null)
return false;
if (other.getClientToken() != null && other.getClientToken().equals(this.getClientToken()) == false)
return false;
if (other.getInstanceType() == null ^ this.getInstanceType() == null)
return false;
if (other.getInstanceType() != null && other.getInstanceType().equals(this.getInstanceType()) == false)
return false;
if (other.getInstanceFamily() == null ^ this.getInstanceFamily() == null)
return false;
if (other.getInstanceFamily() != null && other.getInstanceFamily().equals(this.getInstanceFamily()) == false)
return false;
if (other.getQuantity() == null ^ this.getQuantity() == null)
return false;
if (other.getQuantity() != null && other.getQuantity().equals(this.getQuantity()) == false)
return false;
if (other.getTagSpecifications() == null ^ this.getTagSpecifications() == null)
return false;
if (other.getTagSpecifications() != null && other.getTagSpecifications().equals(this.getTagSpecifications()) == false)
return false;
if (other.getHostRecovery() == null ^ this.getHostRecovery() == null)
return false;
if (other.getHostRecovery() != null && other.getHostRecovery().equals(this.getHostRecovery()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAutoPlacement() == null) ? 0 : getAutoPlacement().hashCode());
hashCode = prime * hashCode + ((getAvailabilityZone() == null) ? 0 : getAvailabilityZone().hashCode());
hashCode = prime * hashCode + ((getClientToken() == null) ? 0 : getClientToken().hashCode());
hashCode = prime * hashCode + ((getInstanceType() == null) ? 0 : getInstanceType().hashCode());
hashCode = prime * hashCode + ((getInstanceFamily() == null) ? 0 : getInstanceFamily().hashCode());
hashCode = prime * hashCode + ((getQuantity() == null) ? 0 : getQuantity().hashCode());
hashCode = prime * hashCode + ((getTagSpecifications() == null) ? 0 : getTagSpecifications().hashCode());
hashCode = prime * hashCode + ((getHostRecovery() == null) ? 0 : getHostRecovery().hashCode());
return hashCode;
}
@Override
public AllocateHostsRequest clone() {
return (AllocateHostsRequest) super.clone();
}
}