com.amazonaws.services.ec2.model.CreateLaunchTemplateRequest 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.CreateLaunchTemplateRequestMarshaller;
/**
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateLaunchTemplateRequest extends AmazonWebServiceRequest implements Serializable, Cloneable,
DryRunSupportedRequest {
/**
*
* Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see
* Ensuring
* idempotency.
*
*
* Constraint: Maximum 128 ASCII characters.
*
*/
private String clientToken;
/**
*
* A name for the launch template.
*
*/
private String launchTemplateName;
/**
*
* A description for the first version of the launch template.
*
*/
private String versionDescription;
/**
*
* The information for the launch template.
*
*/
private RequestLaunchTemplateData launchTemplateData;
/**
*
* The tags to apply to the launch template on creation. To tag the launch template, the resource type must be
* launch-template
.
*
*
*
* To specify the tags for the resources that are created when an instance is launched, you must use the
* TagSpecifications
parameter in the launch template
* data structure.
*
*
*/
private com.amazonaws.internal.SdkInternalList tagSpecifications;
/**
*
* Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see
* Ensuring
* idempotency.
*
*
* Constraint: Maximum 128 ASCII characters.
*
*
* @param clientToken
* Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more
* information, see Ensuring
* idempotency.
*
* Constraint: Maximum 128 ASCII characters.
*/
public void setClientToken(String clientToken) {
this.clientToken = clientToken;
}
/**
*
* Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see
* Ensuring
* idempotency.
*
*
* Constraint: Maximum 128 ASCII characters.
*
*
* @return Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more
* information, see Ensuring
* idempotency.
*
* Constraint: Maximum 128 ASCII characters.
*/
public String getClientToken() {
return this.clientToken;
}
/**
*
* Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see
* Ensuring
* idempotency.
*
*
* Constraint: Maximum 128 ASCII characters.
*
*
* @param clientToken
* Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more
* information, see Ensuring
* idempotency.
*
* Constraint: Maximum 128 ASCII characters.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLaunchTemplateRequest withClientToken(String clientToken) {
setClientToken(clientToken);
return this;
}
/**
*
* A name for the launch template.
*
*
* @param launchTemplateName
* A name for the launch template.
*/
public void setLaunchTemplateName(String launchTemplateName) {
this.launchTemplateName = launchTemplateName;
}
/**
*
* A name for the launch template.
*
*
* @return A name for the launch template.
*/
public String getLaunchTemplateName() {
return this.launchTemplateName;
}
/**
*
* A name for the launch template.
*
*
* @param launchTemplateName
* A name for the launch template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLaunchTemplateRequest withLaunchTemplateName(String launchTemplateName) {
setLaunchTemplateName(launchTemplateName);
return this;
}
/**
*
* A description for the first version of the launch template.
*
*
* @param versionDescription
* A description for the first version of the launch template.
*/
public void setVersionDescription(String versionDescription) {
this.versionDescription = versionDescription;
}
/**
*
* A description for the first version of the launch template.
*
*
* @return A description for the first version of the launch template.
*/
public String getVersionDescription() {
return this.versionDescription;
}
/**
*
* A description for the first version of the launch template.
*
*
* @param versionDescription
* A description for the first version of the launch template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLaunchTemplateRequest withVersionDescription(String versionDescription) {
setVersionDescription(versionDescription);
return this;
}
/**
*
* The information for the launch template.
*
*
* @param launchTemplateData
* The information for the launch template.
*/
public void setLaunchTemplateData(RequestLaunchTemplateData launchTemplateData) {
this.launchTemplateData = launchTemplateData;
}
/**
*
* The information for the launch template.
*
*
* @return The information for the launch template.
*/
public RequestLaunchTemplateData getLaunchTemplateData() {
return this.launchTemplateData;
}
/**
*
* The information for the launch template.
*
*
* @param launchTemplateData
* The information for the launch template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLaunchTemplateRequest withLaunchTemplateData(RequestLaunchTemplateData launchTemplateData) {
setLaunchTemplateData(launchTemplateData);
return this;
}
/**
*
* The tags to apply to the launch template on creation. To tag the launch template, the resource type must be
* launch-template
.
*
*
*
* To specify the tags for the resources that are created when an instance is launched, you must use the
* TagSpecifications
parameter in the launch template
* data structure.
*
*
*
* @return The tags to apply to the launch template on creation. To tag the launch template, the resource type must
* be launch-template
.
*
* To specify the tags for the resources that are created when an instance is launched, you must use the
* TagSpecifications
parameter in the launch
* template data structure.
*
*/
public java.util.List getTagSpecifications() {
if (tagSpecifications == null) {
tagSpecifications = new com.amazonaws.internal.SdkInternalList();
}
return tagSpecifications;
}
/**
*
* The tags to apply to the launch template on creation. To tag the launch template, the resource type must be
* launch-template
.
*
*
*
* To specify the tags for the resources that are created when an instance is launched, you must use the
* TagSpecifications
parameter in the launch template
* data structure.
*
*
*
* @param tagSpecifications
* The tags to apply to the launch template on creation. To tag the launch template, the resource type must
* be launch-template
.
*
* To specify the tags for the resources that are created when an instance is launched, you must use the
* TagSpecifications
parameter in the launch
* template data structure.
*
*/
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 launch template on creation. To tag the launch template, the resource type must be
* launch-template
.
*
*
*
* To specify the tags for the resources that are created when an instance is launched, you must use the
* TagSpecifications
parameter in the launch template
* data structure.
*
*
*
* 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 launch template on creation. To tag the launch template, the resource type must
* be launch-template
.
*
* To specify the tags for the resources that are created when an instance is launched, you must use the
* TagSpecifications
parameter in the launch
* template data structure.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLaunchTemplateRequest 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 launch template on creation. To tag the launch template, the resource type must be
* launch-template
.
*
*
*
* To specify the tags for the resources that are created when an instance is launched, you must use the
* TagSpecifications
parameter in the launch template
* data structure.
*
*
*
* @param tagSpecifications
* The tags to apply to the launch template on creation. To tag the launch template, the resource type must
* be launch-template
.
*
* To specify the tags for the resources that are created when an instance is launched, you must use the
* TagSpecifications
parameter in the launch
* template data structure.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLaunchTemplateRequest withTagSpecifications(java.util.Collection tagSpecifications) {
setTagSpecifications(tagSpecifications);
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 CreateLaunchTemplateRequestMarshaller().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 (getClientToken() != null)
sb.append("ClientToken: ").append(getClientToken()).append(",");
if (getLaunchTemplateName() != null)
sb.append("LaunchTemplateName: ").append(getLaunchTemplateName()).append(",");
if (getVersionDescription() != null)
sb.append("VersionDescription: ").append(getVersionDescription()).append(",");
if (getLaunchTemplateData() != null)
sb.append("LaunchTemplateData: ").append(getLaunchTemplateData()).append(",");
if (getTagSpecifications() != null)
sb.append("TagSpecifications: ").append(getTagSpecifications());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CreateLaunchTemplateRequest == false)
return false;
CreateLaunchTemplateRequest other = (CreateLaunchTemplateRequest) obj;
if (other.getClientToken() == null ^ this.getClientToken() == null)
return false;
if (other.getClientToken() != null && other.getClientToken().equals(this.getClientToken()) == false)
return false;
if (other.getLaunchTemplateName() == null ^ this.getLaunchTemplateName() == null)
return false;
if (other.getLaunchTemplateName() != null && other.getLaunchTemplateName().equals(this.getLaunchTemplateName()) == false)
return false;
if (other.getVersionDescription() == null ^ this.getVersionDescription() == null)
return false;
if (other.getVersionDescription() != null && other.getVersionDescription().equals(this.getVersionDescription()) == false)
return false;
if (other.getLaunchTemplateData() == null ^ this.getLaunchTemplateData() == null)
return false;
if (other.getLaunchTemplateData() != null && other.getLaunchTemplateData().equals(this.getLaunchTemplateData()) == false)
return false;
if (other.getTagSpecifications() == null ^ this.getTagSpecifications() == null)
return false;
if (other.getTagSpecifications() != null && other.getTagSpecifications().equals(this.getTagSpecifications()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getClientToken() == null) ? 0 : getClientToken().hashCode());
hashCode = prime * hashCode + ((getLaunchTemplateName() == null) ? 0 : getLaunchTemplateName().hashCode());
hashCode = prime * hashCode + ((getVersionDescription() == null) ? 0 : getVersionDescription().hashCode());
hashCode = prime * hashCode + ((getLaunchTemplateData() == null) ? 0 : getLaunchTemplateData().hashCode());
hashCode = prime * hashCode + ((getTagSpecifications() == null) ? 0 : getTagSpecifications().hashCode());
return hashCode;
}
@Override
public CreateLaunchTemplateRequest clone() {
return (CreateLaunchTemplateRequest) super.clone();
}
}