Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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.redshift.model;
 

A tag and its associated resource.

 
 public class TaggedResource implements SerializableCloneable {

    
The tag for the resource.
 
     private Tag tag;

    
The Amazon Resource Name (ARN) with which the tag is associated. For example, arn:aws:redshift:us-east-1:123456789:cluster:t1.
 
     private String resourceName;

    
The type of resource with which the tag is associated. Valid resource types are:
  • Cluster
  • CIDR/IP
  • EC2 security group
  • Snapshot
  • Cluster security group
  • Subnet group
  • HSM connection
  • HSM certificate
  • Parameter group

For more information about Amazon Redshift resource types and constructing ARNs, go to Constructing an Amazon Redshift Amazon Resource Name (ARN) in the Amazon Redshift Cluster Management Guide.

 
     private String resourceType;

    
The tag for the resource.

Returns:
The tag for the resource.
 
     public Tag getTag() {
         return ;
     }
    
    
The tag for the resource.

Parameters:
tag The tag for the resource.
 
     public void setTag(Tag tag) {
         this. = tag;
     }
    
    
The tag for the resource.

Returns a reference to this object so that method calls can be chained together.

Parameters:
tag The tag for the resource.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public TaggedResource withTag(Tag tag) {
         this. = tag;
         return this;
     }

    
The Amazon Resource Name (ARN) with which the tag is associated. For example, arn:aws:redshift:us-east-1:123456789:cluster:t1.

Returns:
The Amazon Resource Name (ARN) with which the tag is associated. For example, arn:aws:redshift:us-east-1:123456789:cluster:t1.
 
     public String getResourceName() {
         return ;
     }
    
    
The Amazon Resource Name (ARN) with which the tag is associated. For example, arn:aws:redshift:us-east-1:123456789:cluster:t1.

Parameters:
resourceName The Amazon Resource Name (ARN) with which the tag is associated. For example, arn:aws:redshift:us-east-1:123456789:cluster:t1.
    public void setResourceName(String resourceName) {
        this. = resourceName;
    }
    
    
The Amazon Resource Name (ARN) with which the tag is associated. For example, arn:aws:redshift:us-east-1:123456789:cluster:t1.

Returns a reference to this object so that method calls can be chained together.

Parameters:
resourceName The Amazon Resource Name (ARN) with which the tag is associated. For example, arn:aws:redshift:us-east-1:123456789:cluster:t1.
Returns:
A reference to this updated object so that method calls can be chained together.
    public TaggedResource withResourceName(String resourceName) {
        this. = resourceName;
        return this;
    }

    
The type of resource with which the tag is associated. Valid resource types are:
  • Cluster
  • CIDR/IP
  • EC2 security group
  • Snapshot
  • Cluster security group
  • Subnet group
  • HSM connection
  • HSM certificate
  • Parameter group

For more information about Amazon Redshift resource types and constructing ARNs, go to Constructing an Amazon Redshift Amazon Resource Name (ARN) in the Amazon Redshift Cluster Management Guide.

Returns:
The type of resource with which the tag is associated. Valid resource types are:
  • Cluster
  • CIDR/IP
  • EC2 security group
  • Snapshot
  • Cluster security group
  • Subnet group
  • HSM connection
  • HSM certificate
  • Parameter group

For more information about Amazon Redshift resource types and constructing ARNs, go to Constructing an Amazon Redshift Amazon Resource Name (ARN) in the Amazon Redshift Cluster Management Guide.

    public String getResourceType() {
        return ;
    }
    
    
The type of resource with which the tag is associated. Valid resource types are:
  • Cluster
  • CIDR/IP
  • EC2 security group
  • Snapshot
  • Cluster security group
  • Subnet group
  • HSM connection
  • HSM certificate
  • Parameter group

For more information about Amazon Redshift resource types and constructing ARNs, go to Constructing an Amazon Redshift Amazon Resource Name (ARN) in the Amazon Redshift Cluster Management Guide.

Parameters:
resourceType The type of resource with which the tag is associated. Valid resource types are:
  • Cluster
  • CIDR/IP
  • EC2 security group
  • Snapshot
  • Cluster security group
  • Subnet group
  • HSM connection
  • HSM certificate
  • Parameter group

For more information about Amazon Redshift resource types and constructing ARNs, go to Constructing an Amazon Redshift Amazon Resource Name (ARN) in the Amazon Redshift Cluster Management Guide.

    public void setResourceType(String resourceType) {
        this. = resourceType;
    }
    
    
The type of resource with which the tag is associated. Valid resource types are:
  • Cluster
  • CIDR/IP
  • EC2 security group
  • Snapshot
  • Cluster security group
  • Subnet group
  • HSM connection
  • HSM certificate
  • Parameter group

For more information about Amazon Redshift resource types and constructing ARNs, go to Constructing an Amazon Redshift Amazon Resource Name (ARN) in the Amazon Redshift Cluster Management Guide.

Returns a reference to this object so that method calls can be chained together.

Parameters:
resourceType The type of resource with which the tag is associated. Valid resource types are:
  • Cluster
  • CIDR/IP
  • EC2 security group
  • Snapshot
  • Cluster security group
  • Subnet group
  • HSM connection
  • HSM certificate
  • Parameter group

For more information about Amazon Redshift resource types and constructing ARNs, go to Constructing an Amazon Redshift Amazon Resource Name (ARN) in the Amazon Redshift Cluster Management Guide.

Returns:
A reference to this updated object so that method calls can be chained together.
    public TaggedResource withResourceType(String resourceType) {
        this. = resourceType;
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getTag() != nullsb.append("Tag: " + getTag() + ",");
        if (getResourceName() != nullsb.append("ResourceName: " + getResourceName() + ",");
        if (getResourceType() != nullsb.append("ResourceType: " + getResourceType() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getTag() == null) ? 0 : getTag().hashCode()); 
        hashCode = prime * hashCode + ((getResourceName() == null) ? 0 : getResourceName().hashCode()); 
        hashCode = prime * hashCode + ((getResourceType() == null) ? 0 : getResourceType().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof TaggedResource == falsereturn false;
        TaggedResource other = (TaggedResource)obj;
        
        if (other.getTag() == null ^ this.getTag() == nullreturn false;
        if (other.getTag() != null && other.getTag().equals(this.getTag()) == falsereturn false
        if (other.getResourceName() == null ^ this.getResourceName() == nullreturn false;
        if (other.getResourceName() != null && other.getResourceName().equals(this.getResourceName()) == falsereturn false
        if (other.getResourceType() == null ^ this.getResourceType() == nullreturn false;
        if (other.getResourceType() != null && other.getResourceType().equals(this.getResourceType()) == falsereturn false
        return true;
    }
    
    @Override
    public TaggedResource clone() {
        try {
            return (TaggedResourcesuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X