com.amazonaws.services.ec2.model.DeleteTagsRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ec2 Show documentation
/*
* Copyright 2014-2019 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.DeleteTagsRequestMarshaller;
/**
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DeleteTagsRequest extends AmazonWebServiceRequest implements Serializable, Cloneable, DryRunSupportedRequest {
/**
*
* The IDs of one or more resources, separated by spaces.
*
*
* Constraints: Up to 1000 resource IDs. We recommend breaking up this request into smaller batches.
*
*/
private com.amazonaws.internal.SdkInternalList resources;
/**
*
* One or more tags to delete. Specify a tag key and an optional tag value to delete specific tags. If you specify a
* tag key without a tag value, we delete any tag with this key regardless of its value. If you specify a tag key
* with an empty string as the tag value, we delete the tag only if its value is an empty string.
*
*
* If you omit this parameter, we delete all user-defined tags for the specified resources. We do not delete
* AWS-generated tags (tags that have the aws:
prefix).
*
*/
private com.amazonaws.internal.SdkInternalList tags;
/**
* Default constructor for DeleteTagsRequest object. Callers should use the setter or fluent setter (with...)
* methods to initialize the object after creating it.
*/
public DeleteTagsRequest() {
}
/**
* Constructs a new DeleteTagsRequest object. Callers should use the setter or fluent setter (with...) methods to
* initialize any additional object members.
*
* @param resources
* The IDs of one or more resources, separated by spaces.
*
* Constraints: Up to 1000 resource IDs. We recommend breaking up this request into smaller batches.
*/
public DeleteTagsRequest(java.util.List resources) {
setResources(resources);
}
/**
*
* The IDs of one or more resources, separated by spaces.
*
*
* Constraints: Up to 1000 resource IDs. We recommend breaking up this request into smaller batches.
*
*
* @return The IDs of one or more resources, separated by spaces.
*
* Constraints: Up to 1000 resource IDs. We recommend breaking up this request into smaller batches.
*/
public java.util.List getResources() {
if (resources == null) {
resources = new com.amazonaws.internal.SdkInternalList();
}
return resources;
}
/**
*
* The IDs of one or more resources, separated by spaces.
*
*
* Constraints: Up to 1000 resource IDs. We recommend breaking up this request into smaller batches.
*
*
* @param resources
* The IDs of one or more resources, separated by spaces.
*
* Constraints: Up to 1000 resource IDs. We recommend breaking up this request into smaller batches.
*/
public void setResources(java.util.Collection resources) {
if (resources == null) {
this.resources = null;
return;
}
this.resources = new com.amazonaws.internal.SdkInternalList(resources);
}
/**
*
* The IDs of one or more resources, separated by spaces.
*
*
* Constraints: Up to 1000 resource IDs. We recommend breaking up this request into smaller batches.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setResources(java.util.Collection)} or {@link #withResources(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param resources
* The IDs of one or more resources, separated by spaces.
*
* Constraints: Up to 1000 resource IDs. We recommend breaking up this request into smaller batches.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DeleteTagsRequest withResources(String... resources) {
if (this.resources == null) {
setResources(new com.amazonaws.internal.SdkInternalList(resources.length));
}
for (String ele : resources) {
this.resources.add(ele);
}
return this;
}
/**
*
* The IDs of one or more resources, separated by spaces.
*
*
* Constraints: Up to 1000 resource IDs. We recommend breaking up this request into smaller batches.
*
*
* @param resources
* The IDs of one or more resources, separated by spaces.
*
* Constraints: Up to 1000 resource IDs. We recommend breaking up this request into smaller batches.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DeleteTagsRequest withResources(java.util.Collection resources) {
setResources(resources);
return this;
}
/**
*
* One or more tags to delete. Specify a tag key and an optional tag value to delete specific tags. If you specify a
* tag key without a tag value, we delete any tag with this key regardless of its value. If you specify a tag key
* with an empty string as the tag value, we delete the tag only if its value is an empty string.
*
*
* If you omit this parameter, we delete all user-defined tags for the specified resources. We do not delete
* AWS-generated tags (tags that have the aws:
prefix).
*
*
* @return One or more tags to delete. Specify a tag key and an optional tag value to delete specific tags. If you
* specify a tag key without a tag value, we delete any tag with this key regardless of its value. If you
* specify a tag key with an empty string as the tag value, we delete the tag only if its value is an empty
* string.
*
* If you omit this parameter, we delete all user-defined tags for the specified resources. We do not delete
* AWS-generated tags (tags that have the aws:
prefix).
*/
public java.util.List getTags() {
if (tags == null) {
tags = new com.amazonaws.internal.SdkInternalList();
}
return tags;
}
/**
*
* One or more tags to delete. Specify a tag key and an optional tag value to delete specific tags. If you specify a
* tag key without a tag value, we delete any tag with this key regardless of its value. If you specify a tag key
* with an empty string as the tag value, we delete the tag only if its value is an empty string.
*
*
* If you omit this parameter, we delete all user-defined tags for the specified resources. We do not delete
* AWS-generated tags (tags that have the aws:
prefix).
*
*
* @param tags
* One or more tags to delete. Specify a tag key and an optional tag value to delete specific tags. If you
* specify a tag key without a tag value, we delete any tag with this key regardless of its value. If you
* specify a tag key with an empty string as the tag value, we delete the tag only if its value is an empty
* string.
*
* If you omit this parameter, we delete all user-defined tags for the specified resources. We do not delete
* AWS-generated tags (tags that have the aws:
prefix).
*/
public void setTags(java.util.Collection tags) {
if (tags == null) {
this.tags = null;
return;
}
this.tags = new com.amazonaws.internal.SdkInternalList(tags);
}
/**
*
* One or more tags to delete. Specify a tag key and an optional tag value to delete specific tags. If you specify a
* tag key without a tag value, we delete any tag with this key regardless of its value. If you specify a tag key
* with an empty string as the tag value, we delete the tag only if its value is an empty string.
*
*
* If you omit this parameter, we delete all user-defined tags for the specified resources. We do not delete
* AWS-generated tags (tags that have the aws:
prefix).
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param tags
* One or more tags to delete. Specify a tag key and an optional tag value to delete specific tags. If you
* specify a tag key without a tag value, we delete any tag with this key regardless of its value. If you
* specify a tag key with an empty string as the tag value, we delete the tag only if its value is an empty
* string.
*
* If you omit this parameter, we delete all user-defined tags for the specified resources. We do not delete
* AWS-generated tags (tags that have the aws:
prefix).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DeleteTagsRequest withTags(Tag... tags) {
if (this.tags == null) {
setTags(new com.amazonaws.internal.SdkInternalList(tags.length));
}
for (Tag ele : tags) {
this.tags.add(ele);
}
return this;
}
/**
*
* One or more tags to delete. Specify a tag key and an optional tag value to delete specific tags. If you specify a
* tag key without a tag value, we delete any tag with this key regardless of its value. If you specify a tag key
* with an empty string as the tag value, we delete the tag only if its value is an empty string.
*
*
* If you omit this parameter, we delete all user-defined tags for the specified resources. We do not delete
* AWS-generated tags (tags that have the aws:
prefix).
*
*
* @param tags
* One or more tags to delete. Specify a tag key and an optional tag value to delete specific tags. If you
* specify a tag key without a tag value, we delete any tag with this key regardless of its value. If you
* specify a tag key with an empty string as the tag value, we delete the tag only if its value is an empty
* string.
*
* If you omit this parameter, we delete all user-defined tags for the specified resources. We do not delete
* AWS-generated tags (tags that have the aws:
prefix).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DeleteTagsRequest withTags(java.util.Collection tags) {
setTags(tags);
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 DeleteTagsRequestMarshaller().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 (getResources() != null)
sb.append("Resources: ").append(getResources()).append(",");
if (getTags() != null)
sb.append("Tags: ").append(getTags());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof DeleteTagsRequest == false)
return false;
DeleteTagsRequest other = (DeleteTagsRequest) obj;
if (other.getResources() == null ^ this.getResources() == null)
return false;
if (other.getResources() != null && other.getResources().equals(this.getResources()) == false)
return false;
if (other.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getResources() == null) ? 0 : getResources().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
return hashCode;
}
@Override
public DeleteTagsRequest clone() {
return (DeleteTagsRequest) super.clone();
}
}