com.amazonaws.services.ec2.model.CreateSnapshotsRequest 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.CreateSnapshotsRequestMarshaller;
/**
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateSnapshotsRequest extends AmazonWebServiceRequest implements Serializable, Cloneable, DryRunSupportedRequest {
/**
*
* A description propagated to every snapshot specified by the instance.
*
*/
private String description;
/**
*
* The instance to specify which volumes should be included in the snapshots.
*
*/
private InstanceSpecification instanceSpecification;
/**
*
* The Amazon Resource Name (ARN) of the Outpost on which to create the local snapshots.
*
*
* -
*
* To create snapshots from an instance in a Region, omit this parameter. The snapshots are created in the same
* Region as the instance.
*
*
* -
*
* To create snapshots from an instance on an Outpost and store the snapshots in the Region, omit this parameter.
* The snapshots are created in the Region for the Outpost.
*
*
* -
*
* To create snapshots from an instance on an Outpost and store the snapshots on an Outpost, specify the ARN of the
* destination Outpost. The snapshots must be created on the same Outpost as the instance.
*
*
*
*
* For more information, see
* Create multi-volume local snapshots from instances on an Outpost in the Amazon Elastic Compute Cloud User
* Guide.
*
*/
private String outpostArn;
/**
*
* Tags to apply to every snapshot specified by the instance.
*
*/
private com.amazonaws.internal.SdkInternalList tagSpecifications;
/**
*
* Copies the tags from the specified volume to corresponding snapshot.
*
*/
private String copyTagsFromSource;
/**
*
* A description propagated to every snapshot specified by the instance.
*
*
* @param description
* A description propagated to every snapshot specified by the instance.
*/
public void setDescription(String description) {
this.description = description;
}
/**
*
* A description propagated to every snapshot specified by the instance.
*
*
* @return A description propagated to every snapshot specified by the instance.
*/
public String getDescription() {
return this.description;
}
/**
*
* A description propagated to every snapshot specified by the instance.
*
*
* @param description
* A description propagated to every snapshot specified by the instance.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateSnapshotsRequest withDescription(String description) {
setDescription(description);
return this;
}
/**
*
* The instance to specify which volumes should be included in the snapshots.
*
*
* @param instanceSpecification
* The instance to specify which volumes should be included in the snapshots.
*/
public void setInstanceSpecification(InstanceSpecification instanceSpecification) {
this.instanceSpecification = instanceSpecification;
}
/**
*
* The instance to specify which volumes should be included in the snapshots.
*
*
* @return The instance to specify which volumes should be included in the snapshots.
*/
public InstanceSpecification getInstanceSpecification() {
return this.instanceSpecification;
}
/**
*
* The instance to specify which volumes should be included in the snapshots.
*
*
* @param instanceSpecification
* The instance to specify which volumes should be included in the snapshots.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateSnapshotsRequest withInstanceSpecification(InstanceSpecification instanceSpecification) {
setInstanceSpecification(instanceSpecification);
return this;
}
/**
*
* The Amazon Resource Name (ARN) of the Outpost on which to create the local snapshots.
*
*
* -
*
* To create snapshots from an instance in a Region, omit this parameter. The snapshots are created in the same
* Region as the instance.
*
*
* -
*
* To create snapshots from an instance on an Outpost and store the snapshots in the Region, omit this parameter.
* The snapshots are created in the Region for the Outpost.
*
*
* -
*
* To create snapshots from an instance on an Outpost and store the snapshots on an Outpost, specify the ARN of the
* destination Outpost. The snapshots must be created on the same Outpost as the instance.
*
*
*
*
* For more information, see
* Create multi-volume local snapshots from instances on an Outpost in the Amazon Elastic Compute Cloud User
* Guide.
*
*
* @param outpostArn
* The Amazon Resource Name (ARN) of the Outpost on which to create the local snapshots.
*
* -
*
* To create snapshots from an instance in a Region, omit this parameter. The snapshots are created in the
* same Region as the instance.
*
*
* -
*
* To create snapshots from an instance on an Outpost and store the snapshots in the Region, omit this
* parameter. The snapshots are created in the Region for the Outpost.
*
*
* -
*
* To create snapshots from an instance on an Outpost and store the snapshots on an Outpost, specify the ARN
* of the destination Outpost. The snapshots must be created on the same Outpost as the instance.
*
*
*
*
* For more information, see
* Create multi-volume local snapshots from instances on an Outpost in the Amazon Elastic Compute
* Cloud User Guide.
*/
public void setOutpostArn(String outpostArn) {
this.outpostArn = outpostArn;
}
/**
*
* The Amazon Resource Name (ARN) of the Outpost on which to create the local snapshots.
*
*
* -
*
* To create snapshots from an instance in a Region, omit this parameter. The snapshots are created in the same
* Region as the instance.
*
*
* -
*
* To create snapshots from an instance on an Outpost and store the snapshots in the Region, omit this parameter.
* The snapshots are created in the Region for the Outpost.
*
*
* -
*
* To create snapshots from an instance on an Outpost and store the snapshots on an Outpost, specify the ARN of the
* destination Outpost. The snapshots must be created on the same Outpost as the instance.
*
*
*
*
* For more information, see
* Create multi-volume local snapshots from instances on an Outpost in the Amazon Elastic Compute Cloud User
* Guide.
*
*
* @return The Amazon Resource Name (ARN) of the Outpost on which to create the local snapshots.
*
* -
*
* To create snapshots from an instance in a Region, omit this parameter. The snapshots are created in the
* same Region as the instance.
*
*
* -
*
* To create snapshots from an instance on an Outpost and store the snapshots in the Region, omit this
* parameter. The snapshots are created in the Region for the Outpost.
*
*
* -
*
* To create snapshots from an instance on an Outpost and store the snapshots on an Outpost, specify the ARN
* of the destination Outpost. The snapshots must be created on the same Outpost as the instance.
*
*
*
*
* For more information, see
* Create multi-volume local snapshots from instances on an Outpost in the Amazon Elastic Compute
* Cloud User Guide.
*/
public String getOutpostArn() {
return this.outpostArn;
}
/**
*
* The Amazon Resource Name (ARN) of the Outpost on which to create the local snapshots.
*
*
* -
*
* To create snapshots from an instance in a Region, omit this parameter. The snapshots are created in the same
* Region as the instance.
*
*
* -
*
* To create snapshots from an instance on an Outpost and store the snapshots in the Region, omit this parameter.
* The snapshots are created in the Region for the Outpost.
*
*
* -
*
* To create snapshots from an instance on an Outpost and store the snapshots on an Outpost, specify the ARN of the
* destination Outpost. The snapshots must be created on the same Outpost as the instance.
*
*
*
*
* For more information, see
* Create multi-volume local snapshots from instances on an Outpost in the Amazon Elastic Compute Cloud User
* Guide.
*
*
* @param outpostArn
* The Amazon Resource Name (ARN) of the Outpost on which to create the local snapshots.
*
* -
*
* To create snapshots from an instance in a Region, omit this parameter. The snapshots are created in the
* same Region as the instance.
*
*
* -
*
* To create snapshots from an instance on an Outpost and store the snapshots in the Region, omit this
* parameter. The snapshots are created in the Region for the Outpost.
*
*
* -
*
* To create snapshots from an instance on an Outpost and store the snapshots on an Outpost, specify the ARN
* of the destination Outpost. The snapshots must be created on the same Outpost as the instance.
*
*
*
*
* For more information, see
* Create multi-volume local snapshots from instances on an Outpost in the Amazon Elastic Compute
* Cloud User Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateSnapshotsRequest withOutpostArn(String outpostArn) {
setOutpostArn(outpostArn);
return this;
}
/**
*
* Tags to apply to every snapshot specified by the instance.
*
*
* @return Tags to apply to every snapshot specified by the instance.
*/
public java.util.List getTagSpecifications() {
if (tagSpecifications == null) {
tagSpecifications = new com.amazonaws.internal.SdkInternalList();
}
return tagSpecifications;
}
/**
*
* Tags to apply to every snapshot specified by the instance.
*
*
* @param tagSpecifications
* Tags to apply to every snapshot specified by the instance.
*/
public void setTagSpecifications(java.util.Collection tagSpecifications) {
if (tagSpecifications == null) {
this.tagSpecifications = null;
return;
}
this.tagSpecifications = new com.amazonaws.internal.SdkInternalList(tagSpecifications);
}
/**
*
* Tags to apply to every snapshot specified by the instance.
*
*
* 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
* Tags to apply to every snapshot specified by the instance.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateSnapshotsRequest 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;
}
/**
*
* Tags to apply to every snapshot specified by the instance.
*
*
* @param tagSpecifications
* Tags to apply to every snapshot specified by the instance.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateSnapshotsRequest withTagSpecifications(java.util.Collection tagSpecifications) {
setTagSpecifications(tagSpecifications);
return this;
}
/**
*
* Copies the tags from the specified volume to corresponding snapshot.
*
*
* @param copyTagsFromSource
* Copies the tags from the specified volume to corresponding snapshot.
* @see CopyTagsFromSource
*/
public void setCopyTagsFromSource(String copyTagsFromSource) {
this.copyTagsFromSource = copyTagsFromSource;
}
/**
*
* Copies the tags from the specified volume to corresponding snapshot.
*
*
* @return Copies the tags from the specified volume to corresponding snapshot.
* @see CopyTagsFromSource
*/
public String getCopyTagsFromSource() {
return this.copyTagsFromSource;
}
/**
*
* Copies the tags from the specified volume to corresponding snapshot.
*
*
* @param copyTagsFromSource
* Copies the tags from the specified volume to corresponding snapshot.
* @return Returns a reference to this object so that method calls can be chained together.
* @see CopyTagsFromSource
*/
public CreateSnapshotsRequest withCopyTagsFromSource(String copyTagsFromSource) {
setCopyTagsFromSource(copyTagsFromSource);
return this;
}
/**
*
* Copies the tags from the specified volume to corresponding snapshot.
*
*
* @param copyTagsFromSource
* Copies the tags from the specified volume to corresponding snapshot.
* @return Returns a reference to this object so that method calls can be chained together.
* @see CopyTagsFromSource
*/
public CreateSnapshotsRequest withCopyTagsFromSource(CopyTagsFromSource copyTagsFromSource) {
this.copyTagsFromSource = copyTagsFromSource.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 CreateSnapshotsRequestMarshaller().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 (getDescription() != null)
sb.append("Description: ").append(getDescription()).append(",");
if (getInstanceSpecification() != null)
sb.append("InstanceSpecification: ").append(getInstanceSpecification()).append(",");
if (getOutpostArn() != null)
sb.append("OutpostArn: ").append(getOutpostArn()).append(",");
if (getTagSpecifications() != null)
sb.append("TagSpecifications: ").append(getTagSpecifications()).append(",");
if (getCopyTagsFromSource() != null)
sb.append("CopyTagsFromSource: ").append(getCopyTagsFromSource());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CreateSnapshotsRequest == false)
return false;
CreateSnapshotsRequest other = (CreateSnapshotsRequest) obj;
if (other.getDescription() == null ^ this.getDescription() == null)
return false;
if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false)
return false;
if (other.getInstanceSpecification() == null ^ this.getInstanceSpecification() == null)
return false;
if (other.getInstanceSpecification() != null && other.getInstanceSpecification().equals(this.getInstanceSpecification()) == false)
return false;
if (other.getOutpostArn() == null ^ this.getOutpostArn() == null)
return false;
if (other.getOutpostArn() != null && other.getOutpostArn().equals(this.getOutpostArn()) == 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.getCopyTagsFromSource() == null ^ this.getCopyTagsFromSource() == null)
return false;
if (other.getCopyTagsFromSource() != null && other.getCopyTagsFromSource().equals(this.getCopyTagsFromSource()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode());
hashCode = prime * hashCode + ((getInstanceSpecification() == null) ? 0 : getInstanceSpecification().hashCode());
hashCode = prime * hashCode + ((getOutpostArn() == null) ? 0 : getOutpostArn().hashCode());
hashCode = prime * hashCode + ((getTagSpecifications() == null) ? 0 : getTagSpecifications().hashCode());
hashCode = prime * hashCode + ((getCopyTagsFromSource() == null) ? 0 : getCopyTagsFromSource().hashCode());
return hashCode;
}
@Override
public CreateSnapshotsRequest clone() {
return (CreateSnapshotsRequest) super.clone();
}
}