com.amazonaws.services.ec2.model.CreateFleetInstance 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;
/**
*
* Describes the instances that were launched by the fleet.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateFleetInstance implements Serializable, Cloneable {
/**
*
* The launch templates and overrides that were used for launching the instances. The values that you specify in the
* Overrides replace the values in the launch template.
*
*/
private LaunchTemplateAndOverridesResponse launchTemplateAndOverrides;
/**
*
* Indicates if the instance that was launched is a Spot Instance or On-Demand Instance.
*
*/
private String lifecycle;
/**
*
* The IDs of the instances.
*
*/
private com.amazonaws.internal.SdkInternalList instanceIds;
/**
*
* The instance type.
*
*/
private String instanceType;
/**
*
* The value is Windows
for Windows instances. Otherwise, the value is blank.
*
*/
private String platform;
/**
*
* The launch templates and overrides that were used for launching the instances. The values that you specify in the
* Overrides replace the values in the launch template.
*
*
* @param launchTemplateAndOverrides
* The launch templates and overrides that were used for launching the instances. The values that you specify
* in the Overrides replace the values in the launch template.
*/
public void setLaunchTemplateAndOverrides(LaunchTemplateAndOverridesResponse launchTemplateAndOverrides) {
this.launchTemplateAndOverrides = launchTemplateAndOverrides;
}
/**
*
* The launch templates and overrides that were used for launching the instances. The values that you specify in the
* Overrides replace the values in the launch template.
*
*
* @return The launch templates and overrides that were used for launching the instances. The values that you
* specify in the Overrides replace the values in the launch template.
*/
public LaunchTemplateAndOverridesResponse getLaunchTemplateAndOverrides() {
return this.launchTemplateAndOverrides;
}
/**
*
* The launch templates and overrides that were used for launching the instances. The values that you specify in the
* Overrides replace the values in the launch template.
*
*
* @param launchTemplateAndOverrides
* The launch templates and overrides that were used for launching the instances. The values that you specify
* in the Overrides replace the values in the launch template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateFleetInstance withLaunchTemplateAndOverrides(LaunchTemplateAndOverridesResponse launchTemplateAndOverrides) {
setLaunchTemplateAndOverrides(launchTemplateAndOverrides);
return this;
}
/**
*
* Indicates if the instance that was launched is a Spot Instance or On-Demand Instance.
*
*
* @param lifecycle
* Indicates if the instance that was launched is a Spot Instance or On-Demand Instance.
* @see InstanceLifecycle
*/
public void setLifecycle(String lifecycle) {
this.lifecycle = lifecycle;
}
/**
*
* Indicates if the instance that was launched is a Spot Instance or On-Demand Instance.
*
*
* @return Indicates if the instance that was launched is a Spot Instance or On-Demand Instance.
* @see InstanceLifecycle
*/
public String getLifecycle() {
return this.lifecycle;
}
/**
*
* Indicates if the instance that was launched is a Spot Instance or On-Demand Instance.
*
*
* @param lifecycle
* Indicates if the instance that was launched is a Spot Instance or On-Demand Instance.
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceLifecycle
*/
public CreateFleetInstance withLifecycle(String lifecycle) {
setLifecycle(lifecycle);
return this;
}
/**
*
* Indicates if the instance that was launched is a Spot Instance or On-Demand Instance.
*
*
* @param lifecycle
* Indicates if the instance that was launched is a Spot Instance or On-Demand Instance.
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceLifecycle
*/
public CreateFleetInstance withLifecycle(InstanceLifecycle lifecycle) {
this.lifecycle = lifecycle.toString();
return this;
}
/**
*
* The IDs of the instances.
*
*
* @return The IDs of the instances.
*/
public java.util.List getInstanceIds() {
if (instanceIds == null) {
instanceIds = new com.amazonaws.internal.SdkInternalList();
}
return instanceIds;
}
/**
*
* The IDs of the instances.
*
*
* @param instanceIds
* The IDs of the instances.
*/
public void setInstanceIds(java.util.Collection instanceIds) {
if (instanceIds == null) {
this.instanceIds = null;
return;
}
this.instanceIds = new com.amazonaws.internal.SdkInternalList(instanceIds);
}
/**
*
* The IDs of the instances.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setInstanceIds(java.util.Collection)} or {@link #withInstanceIds(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param instanceIds
* The IDs of the instances.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateFleetInstance withInstanceIds(String... instanceIds) {
if (this.instanceIds == null) {
setInstanceIds(new com.amazonaws.internal.SdkInternalList(instanceIds.length));
}
for (String ele : instanceIds) {
this.instanceIds.add(ele);
}
return this;
}
/**
*
* The IDs of the instances.
*
*
* @param instanceIds
* The IDs of the instances.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateFleetInstance withInstanceIds(java.util.Collection instanceIds) {
setInstanceIds(instanceIds);
return this;
}
/**
*
* The instance type.
*
*
* @param instanceType
* The instance type.
* @see InstanceType
*/
public void setInstanceType(String instanceType) {
this.instanceType = instanceType;
}
/**
*
* The instance type.
*
*
* @return The instance type.
* @see InstanceType
*/
public String getInstanceType() {
return this.instanceType;
}
/**
*
* The instance type.
*
*
* @param instanceType
* The instance type.
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceType
*/
public CreateFleetInstance withInstanceType(String instanceType) {
setInstanceType(instanceType);
return this;
}
/**
*
* The instance type.
*
*
* @param instanceType
* The instance type.
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceType
*/
public CreateFleetInstance withInstanceType(InstanceType instanceType) {
this.instanceType = instanceType.toString();
return this;
}
/**
*
* The value is Windows
for Windows instances. Otherwise, the value is blank.
*
*
* @param platform
* The value is Windows
for Windows instances. Otherwise, the value is blank.
* @see PlatformValues
*/
public void setPlatform(String platform) {
this.platform = platform;
}
/**
*
* The value is Windows
for Windows instances. Otherwise, the value is blank.
*
*
* @return The value is Windows
for Windows instances. Otherwise, the value is blank.
* @see PlatformValues
*/
public String getPlatform() {
return this.platform;
}
/**
*
* The value is Windows
for Windows instances. Otherwise, the value is blank.
*
*
* @param platform
* The value is Windows
for Windows instances. Otherwise, the value is blank.
* @return Returns a reference to this object so that method calls can be chained together.
* @see PlatformValues
*/
public CreateFleetInstance withPlatform(String platform) {
setPlatform(platform);
return this;
}
/**
*
* The value is Windows
for Windows instances. Otherwise, the value is blank.
*
*
* @param platform
* The value is Windows
for Windows instances. Otherwise, the value is blank.
* @return Returns a reference to this object so that method calls can be chained together.
* @see PlatformValues
*/
public CreateFleetInstance withPlatform(PlatformValues platform) {
this.platform = platform.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 (getLaunchTemplateAndOverrides() != null)
sb.append("LaunchTemplateAndOverrides: ").append(getLaunchTemplateAndOverrides()).append(",");
if (getLifecycle() != null)
sb.append("Lifecycle: ").append(getLifecycle()).append(",");
if (getInstanceIds() != null)
sb.append("InstanceIds: ").append(getInstanceIds()).append(",");
if (getInstanceType() != null)
sb.append("InstanceType: ").append(getInstanceType()).append(",");
if (getPlatform() != null)
sb.append("Platform: ").append(getPlatform());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CreateFleetInstance == false)
return false;
CreateFleetInstance other = (CreateFleetInstance) obj;
if (other.getLaunchTemplateAndOverrides() == null ^ this.getLaunchTemplateAndOverrides() == null)
return false;
if (other.getLaunchTemplateAndOverrides() != null && other.getLaunchTemplateAndOverrides().equals(this.getLaunchTemplateAndOverrides()) == false)
return false;
if (other.getLifecycle() == null ^ this.getLifecycle() == null)
return false;
if (other.getLifecycle() != null && other.getLifecycle().equals(this.getLifecycle()) == false)
return false;
if (other.getInstanceIds() == null ^ this.getInstanceIds() == null)
return false;
if (other.getInstanceIds() != null && other.getInstanceIds().equals(this.getInstanceIds()) == 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.getPlatform() == null ^ this.getPlatform() == null)
return false;
if (other.getPlatform() != null && other.getPlatform().equals(this.getPlatform()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getLaunchTemplateAndOverrides() == null) ? 0 : getLaunchTemplateAndOverrides().hashCode());
hashCode = prime * hashCode + ((getLifecycle() == null) ? 0 : getLifecycle().hashCode());
hashCode = prime * hashCode + ((getInstanceIds() == null) ? 0 : getInstanceIds().hashCode());
hashCode = prime * hashCode + ((getInstanceType() == null) ? 0 : getInstanceType().hashCode());
hashCode = prime * hashCode + ((getPlatform() == null) ? 0 : getPlatform().hashCode());
return hashCode;
}
@Override
public CreateFleetInstance clone() {
try {
return (CreateFleetInstance) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}