com.amazonaws.services.ec2.model.ModifyInstancePlacementRequest 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.ModifyInstancePlacementRequestMarshaller;
/**
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ModifyInstancePlacementRequest extends AmazonWebServiceRequest implements Serializable, Cloneable,
DryRunSupportedRequest {
/**
*
* The affinity setting for the instance.
*
*/
private String affinity;
/**
*
* The name of the placement group in which to place the instance. For spread placement groups, the instance must
* have a tenancy of default
. For cluster and partition placement groups, the instance must have a
* tenancy of default
or dedicated
.
*
*
* To remove an instance from a placement group, specify an empty string ("").
*
*/
private String groupName;
/**
*
* The ID of the Dedicated Host with which to associate the instance.
*
*/
private String hostId;
/**
*
* The ID of the instance that you are modifying.
*
*/
private String instanceId;
/**
*
* The tenancy for the instance.
*
*
*
* For T3 instances, you must launch the instance on a Dedicated Host to use a tenancy of host
. You
* can't change the tenancy from host
to dedicated
or default
. Attempting to
* make one of these unsupported tenancy changes results in an InvalidRequest
error code.
*
*
*/
private String tenancy;
/**
*
* The number of the partition in which to place the instance. Valid only if the placement group strategy is set to
* partition
.
*
*/
private Integer partitionNumber;
/**
*
* The ARN of the host resource group in which to place the instance. The instance must have a tenancy of
* host
to specify this parameter.
*
*/
private String hostResourceGroupArn;
/**
*
* The Group Id of a placement group. You must specify the Placement Group Group Id to launch an instance in
* a shared placement group.
*
*/
private String groupId;
/**
*
* The affinity setting for the instance.
*
*
* @param affinity
* The affinity setting for the instance.
* @see Affinity
*/
public void setAffinity(String affinity) {
this.affinity = affinity;
}
/**
*
* The affinity setting for the instance.
*
*
* @return The affinity setting for the instance.
* @see Affinity
*/
public String getAffinity() {
return this.affinity;
}
/**
*
* The affinity setting for the instance.
*
*
* @param affinity
* The affinity setting for the instance.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Affinity
*/
public ModifyInstancePlacementRequest withAffinity(String affinity) {
setAffinity(affinity);
return this;
}
/**
*
* The affinity setting for the instance.
*
*
* @param affinity
* The affinity setting for the instance.
* @see Affinity
*/
public void setAffinity(Affinity affinity) {
withAffinity(affinity);
}
/**
*
* The affinity setting for the instance.
*
*
* @param affinity
* The affinity setting for the instance.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Affinity
*/
public ModifyInstancePlacementRequest withAffinity(Affinity affinity) {
this.affinity = affinity.toString();
return this;
}
/**
*
* The name of the placement group in which to place the instance. For spread placement groups, the instance must
* have a tenancy of default
. For cluster and partition placement groups, the instance must have a
* tenancy of default
or dedicated
.
*
*
* To remove an instance from a placement group, specify an empty string ("").
*
*
* @param groupName
* The name of the placement group in which to place the instance. For spread placement groups, the instance
* must have a tenancy of default
. For cluster and partition placement groups, the instance must
* have a tenancy of default
or dedicated
.
*
* To remove an instance from a placement group, specify an empty string ("").
*/
public void setGroupName(String groupName) {
this.groupName = groupName;
}
/**
*
* The name of the placement group in which to place the instance. For spread placement groups, the instance must
* have a tenancy of default
. For cluster and partition placement groups, the instance must have a
* tenancy of default
or dedicated
.
*
*
* To remove an instance from a placement group, specify an empty string ("").
*
*
* @return The name of the placement group in which to place the instance. For spread placement groups, the instance
* must have a tenancy of default
. For cluster and partition placement groups, the instance
* must have a tenancy of default
or dedicated
.
*
* To remove an instance from a placement group, specify an empty string ("").
*/
public String getGroupName() {
return this.groupName;
}
/**
*
* The name of the placement group in which to place the instance. For spread placement groups, the instance must
* have a tenancy of default
. For cluster and partition placement groups, the instance must have a
* tenancy of default
or dedicated
.
*
*
* To remove an instance from a placement group, specify an empty string ("").
*
*
* @param groupName
* The name of the placement group in which to place the instance. For spread placement groups, the instance
* must have a tenancy of default
. For cluster and partition placement groups, the instance must
* have a tenancy of default
or dedicated
.
*
* To remove an instance from a placement group, specify an empty string ("").
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ModifyInstancePlacementRequest withGroupName(String groupName) {
setGroupName(groupName);
return this;
}
/**
*
* The ID of the Dedicated Host with which to associate the instance.
*
*
* @param hostId
* The ID of the Dedicated Host with which to associate the instance.
*/
public void setHostId(String hostId) {
this.hostId = hostId;
}
/**
*
* The ID of the Dedicated Host with which to associate the instance.
*
*
* @return The ID of the Dedicated Host with which to associate the instance.
*/
public String getHostId() {
return this.hostId;
}
/**
*
* The ID of the Dedicated Host with which to associate the instance.
*
*
* @param hostId
* The ID of the Dedicated Host with which to associate the instance.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ModifyInstancePlacementRequest withHostId(String hostId) {
setHostId(hostId);
return this;
}
/**
*
* The ID of the instance that you are modifying.
*
*
* @param instanceId
* The ID of the instance that you are modifying.
*/
public void setInstanceId(String instanceId) {
this.instanceId = instanceId;
}
/**
*
* The ID of the instance that you are modifying.
*
*
* @return The ID of the instance that you are modifying.
*/
public String getInstanceId() {
return this.instanceId;
}
/**
*
* The ID of the instance that you are modifying.
*
*
* @param instanceId
* The ID of the instance that you are modifying.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ModifyInstancePlacementRequest withInstanceId(String instanceId) {
setInstanceId(instanceId);
return this;
}
/**
*
* The tenancy for the instance.
*
*
*
* For T3 instances, you must launch the instance on a Dedicated Host to use a tenancy of host
. You
* can't change the tenancy from host
to dedicated
or default
. Attempting to
* make one of these unsupported tenancy changes results in an InvalidRequest
error code.
*
*
*
* @param tenancy
* The tenancy for the instance.
*
* For T3 instances, you must launch the instance on a Dedicated Host to use a tenancy of host
.
* You can't change the tenancy from host
to dedicated
or default
.
* Attempting to make one of these unsupported tenancy changes results in an InvalidRequest
* error code.
*
* @see HostTenancy
*/
public void setTenancy(String tenancy) {
this.tenancy = tenancy;
}
/**
*
* The tenancy for the instance.
*
*
*
* For T3 instances, you must launch the instance on a Dedicated Host to use a tenancy of host
. You
* can't change the tenancy from host
to dedicated
or default
. Attempting to
* make one of these unsupported tenancy changes results in an InvalidRequest
error code.
*
*
*
* @return The tenancy for the instance.
*
* For T3 instances, you must launch the instance on a Dedicated Host to use a tenancy of host
.
* You can't change the tenancy from host
to dedicated
or default
.
* Attempting to make one of these unsupported tenancy changes results in an InvalidRequest
* error code.
*
* @see HostTenancy
*/
public String getTenancy() {
return this.tenancy;
}
/**
*
* The tenancy for the instance.
*
*
*
* For T3 instances, you must launch the instance on a Dedicated Host to use a tenancy of host
. You
* can't change the tenancy from host
to dedicated
or default
. Attempting to
* make one of these unsupported tenancy changes results in an InvalidRequest
error code.
*
*
*
* @param tenancy
* The tenancy for the instance.
*
* For T3 instances, you must launch the instance on a Dedicated Host to use a tenancy of host
.
* You can't change the tenancy from host
to dedicated
or default
.
* Attempting to make one of these unsupported tenancy changes results in an InvalidRequest
* error code.
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see HostTenancy
*/
public ModifyInstancePlacementRequest withTenancy(String tenancy) {
setTenancy(tenancy);
return this;
}
/**
*
* The tenancy for the instance.
*
*
*
* For T3 instances, you must launch the instance on a Dedicated Host to use a tenancy of host
. You
* can't change the tenancy from host
to dedicated
or default
. Attempting to
* make one of these unsupported tenancy changes results in an InvalidRequest
error code.
*
*
*
* @param tenancy
* The tenancy for the instance.
*
* For T3 instances, you must launch the instance on a Dedicated Host to use a tenancy of host
.
* You can't change the tenancy from host
to dedicated
or default
.
* Attempting to make one of these unsupported tenancy changes results in an InvalidRequest
* error code.
*
* @see HostTenancy
*/
public void setTenancy(HostTenancy tenancy) {
withTenancy(tenancy);
}
/**
*
* The tenancy for the instance.
*
*
*
* For T3 instances, you must launch the instance on a Dedicated Host to use a tenancy of host
. You
* can't change the tenancy from host
to dedicated
or default
. Attempting to
* make one of these unsupported tenancy changes results in an InvalidRequest
error code.
*
*
*
* @param tenancy
* The tenancy for the instance.
*
* For T3 instances, you must launch the instance on a Dedicated Host to use a tenancy of host
.
* You can't change the tenancy from host
to dedicated
or default
.
* Attempting to make one of these unsupported tenancy changes results in an InvalidRequest
* error code.
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see HostTenancy
*/
public ModifyInstancePlacementRequest withTenancy(HostTenancy tenancy) {
this.tenancy = tenancy.toString();
return this;
}
/**
*
* The number of the partition in which to place the instance. Valid only if the placement group strategy is set to
* partition
.
*
*
* @param partitionNumber
* The number of the partition in which to place the instance. Valid only if the placement group strategy is
* set to partition
.
*/
public void setPartitionNumber(Integer partitionNumber) {
this.partitionNumber = partitionNumber;
}
/**
*
* The number of the partition in which to place the instance. Valid only if the placement group strategy is set to
* partition
.
*
*
* @return The number of the partition in which to place the instance. Valid only if the placement group strategy is
* set to partition
.
*/
public Integer getPartitionNumber() {
return this.partitionNumber;
}
/**
*
* The number of the partition in which to place the instance. Valid only if the placement group strategy is set to
* partition
.
*
*
* @param partitionNumber
* The number of the partition in which to place the instance. Valid only if the placement group strategy is
* set to partition
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ModifyInstancePlacementRequest withPartitionNumber(Integer partitionNumber) {
setPartitionNumber(partitionNumber);
return this;
}
/**
*
* The ARN of the host resource group in which to place the instance. The instance must have a tenancy of
* host
to specify this parameter.
*
*
* @param hostResourceGroupArn
* The ARN of the host resource group in which to place the instance. The instance must have a tenancy of
* host
to specify this parameter.
*/
public void setHostResourceGroupArn(String hostResourceGroupArn) {
this.hostResourceGroupArn = hostResourceGroupArn;
}
/**
*
* The ARN of the host resource group in which to place the instance. The instance must have a tenancy of
* host
to specify this parameter.
*
*
* @return The ARN of the host resource group in which to place the instance. The instance must have a tenancy of
* host
to specify this parameter.
*/
public String getHostResourceGroupArn() {
return this.hostResourceGroupArn;
}
/**
*
* The ARN of the host resource group in which to place the instance. The instance must have a tenancy of
* host
to specify this parameter.
*
*
* @param hostResourceGroupArn
* The ARN of the host resource group in which to place the instance. The instance must have a tenancy of
* host
to specify this parameter.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ModifyInstancePlacementRequest withHostResourceGroupArn(String hostResourceGroupArn) {
setHostResourceGroupArn(hostResourceGroupArn);
return this;
}
/**
*
* The Group Id of a placement group. You must specify the Placement Group Group Id to launch an instance in
* a shared placement group.
*
*
* @param groupId
* The Group Id of a placement group. You must specify the Placement Group Group Id to launch an
* instance in a shared placement group.
*/
public void setGroupId(String groupId) {
this.groupId = groupId;
}
/**
*
* The Group Id of a placement group. You must specify the Placement Group Group Id to launch an instance in
* a shared placement group.
*
*
* @return The Group Id of a placement group. You must specify the Placement Group Group Id to launch an
* instance in a shared placement group.
*/
public String getGroupId() {
return this.groupId;
}
/**
*
* The Group Id of a placement group. You must specify the Placement Group Group Id to launch an instance in
* a shared placement group.
*
*
* @param groupId
* The Group Id of a placement group. You must specify the Placement Group Group Id to launch an
* instance in a shared placement group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ModifyInstancePlacementRequest withGroupId(String groupId) {
setGroupId(groupId);
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 ModifyInstancePlacementRequestMarshaller().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 (getAffinity() != null)
sb.append("Affinity: ").append(getAffinity()).append(",");
if (getGroupName() != null)
sb.append("GroupName: ").append(getGroupName()).append(",");
if (getHostId() != null)
sb.append("HostId: ").append(getHostId()).append(",");
if (getInstanceId() != null)
sb.append("InstanceId: ").append(getInstanceId()).append(",");
if (getTenancy() != null)
sb.append("Tenancy: ").append(getTenancy()).append(",");
if (getPartitionNumber() != null)
sb.append("PartitionNumber: ").append(getPartitionNumber()).append(",");
if (getHostResourceGroupArn() != null)
sb.append("HostResourceGroupArn: ").append(getHostResourceGroupArn()).append(",");
if (getGroupId() != null)
sb.append("GroupId: ").append(getGroupId());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ModifyInstancePlacementRequest == false)
return false;
ModifyInstancePlacementRequest other = (ModifyInstancePlacementRequest) obj;
if (other.getAffinity() == null ^ this.getAffinity() == null)
return false;
if (other.getAffinity() != null && other.getAffinity().equals(this.getAffinity()) == false)
return false;
if (other.getGroupName() == null ^ this.getGroupName() == null)
return false;
if (other.getGroupName() != null && other.getGroupName().equals(this.getGroupName()) == false)
return false;
if (other.getHostId() == null ^ this.getHostId() == null)
return false;
if (other.getHostId() != null && other.getHostId().equals(this.getHostId()) == false)
return false;
if (other.getInstanceId() == null ^ this.getInstanceId() == null)
return false;
if (other.getInstanceId() != null && other.getInstanceId().equals(this.getInstanceId()) == false)
return false;
if (other.getTenancy() == null ^ this.getTenancy() == null)
return false;
if (other.getTenancy() != null && other.getTenancy().equals(this.getTenancy()) == false)
return false;
if (other.getPartitionNumber() == null ^ this.getPartitionNumber() == null)
return false;
if (other.getPartitionNumber() != null && other.getPartitionNumber().equals(this.getPartitionNumber()) == false)
return false;
if (other.getHostResourceGroupArn() == null ^ this.getHostResourceGroupArn() == null)
return false;
if (other.getHostResourceGroupArn() != null && other.getHostResourceGroupArn().equals(this.getHostResourceGroupArn()) == false)
return false;
if (other.getGroupId() == null ^ this.getGroupId() == null)
return false;
if (other.getGroupId() != null && other.getGroupId().equals(this.getGroupId()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAffinity() == null) ? 0 : getAffinity().hashCode());
hashCode = prime * hashCode + ((getGroupName() == null) ? 0 : getGroupName().hashCode());
hashCode = prime * hashCode + ((getHostId() == null) ? 0 : getHostId().hashCode());
hashCode = prime * hashCode + ((getInstanceId() == null) ? 0 : getInstanceId().hashCode());
hashCode = prime * hashCode + ((getTenancy() == null) ? 0 : getTenancy().hashCode());
hashCode = prime * hashCode + ((getPartitionNumber() == null) ? 0 : getPartitionNumber().hashCode());
hashCode = prime * hashCode + ((getHostResourceGroupArn() == null) ? 0 : getHostResourceGroupArn().hashCode());
hashCode = prime * hashCode + ((getGroupId() == null) ? 0 : getGroupId().hashCode());
return hashCode;
}
@Override
public ModifyInstancePlacementRequest clone() {
return (ModifyInstancePlacementRequest) super.clone();
}
}