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.config.model;
 

The relationship of the related resource to the main resource.

 
 public class Relationship implements SerializableCloneable {

    
The resource type of the related resource.

Constraints:
Allowed Values: AWS::EC2::CustomerGateway, AWS::EC2::EIP, AWS::EC2::Instance, AWS::EC2::InternetGateway, AWS::EC2::NetworkAcl, AWS::EC2::NetworkInterface, AWS::EC2::RouteTable, AWS::EC2::SecurityGroup, AWS::EC2::Subnet, AWS::CloudTrail::Trail, AWS::EC2::Volume, AWS::EC2::VPC, AWS::EC2::VPNConnection, AWS::EC2::VPNGateway

 
     private String resourceType;

    
The resource ID of the related resource (for example, sg-xxxxxx.
 
     private String resourceId;

    
The name of the related resource.
 
     private String relationshipName;

    
The resource type of the related resource.

Constraints:
Allowed Values: AWS::EC2::CustomerGateway, AWS::EC2::EIP, AWS::EC2::Instance, AWS::EC2::InternetGateway, AWS::EC2::NetworkAcl, AWS::EC2::NetworkInterface, AWS::EC2::RouteTable, AWS::EC2::SecurityGroup, AWS::EC2::Subnet, AWS::CloudTrail::Trail, AWS::EC2::Volume, AWS::EC2::VPC, AWS::EC2::VPNConnection, AWS::EC2::VPNGateway

Returns:
The resource type of the related resource.
See also:
ResourceType
 
     public String getResourceType() {
         return ;
     }
    
    
The resource type of the related resource.

Constraints:
Allowed Values: AWS::EC2::CustomerGateway, AWS::EC2::EIP, AWS::EC2::Instance, AWS::EC2::InternetGateway, AWS::EC2::NetworkAcl, AWS::EC2::NetworkInterface, AWS::EC2::RouteTable, AWS::EC2::SecurityGroup, AWS::EC2::Subnet, AWS::CloudTrail::Trail, AWS::EC2::Volume, AWS::EC2::VPC, AWS::EC2::VPNConnection, AWS::EC2::VPNGateway

Parameters:
resourceType The resource type of the related resource.
See also:
ResourceType
 
     public void setResourceType(String resourceType) {
         this. = resourceType;
     }
    
    
The resource type of the related resource.

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

Constraints:
Allowed Values: AWS::EC2::CustomerGateway, AWS::EC2::EIP, AWS::EC2::Instance, AWS::EC2::InternetGateway, AWS::EC2::NetworkAcl, AWS::EC2::NetworkInterface, AWS::EC2::RouteTable, AWS::EC2::SecurityGroup, AWS::EC2::Subnet, AWS::CloudTrail::Trail, AWS::EC2::Volume, AWS::EC2::VPC, AWS::EC2::VPNConnection, AWS::EC2::VPNGateway

Parameters:
resourceType The resource type of the related resource.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
ResourceType
 
     public Relationship withResourceType(String resourceType) {
         this. = resourceType;
         return this;
     }

    
The resource type of the related resource.

Constraints:
Allowed Values: AWS::EC2::CustomerGateway, AWS::EC2::EIP, AWS::EC2::Instance, AWS::EC2::InternetGateway, AWS::EC2::NetworkAcl, AWS::EC2::NetworkInterface, AWS::EC2::RouteTable, AWS::EC2::SecurityGroup, AWS::EC2::Subnet, AWS::CloudTrail::Trail, AWS::EC2::Volume, AWS::EC2::VPC, AWS::EC2::VPNConnection, AWS::EC2::VPNGateway

Parameters:
resourceType The resource type of the related resource.
See also:
ResourceType
    public void setResourceType(ResourceType resourceType) {
        this. = resourceType.toString();
    }
    
    
The resource type of the related resource.

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

Constraints:
Allowed Values: AWS::EC2::CustomerGateway, AWS::EC2::EIP, AWS::EC2::Instance, AWS::EC2::InternetGateway, AWS::EC2::NetworkAcl, AWS::EC2::NetworkInterface, AWS::EC2::RouteTable, AWS::EC2::SecurityGroup, AWS::EC2::Subnet, AWS::CloudTrail::Trail, AWS::EC2::Volume, AWS::EC2::VPC, AWS::EC2::VPNConnection, AWS::EC2::VPNGateway

Parameters:
resourceType The resource type of the related resource.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
ResourceType
    public Relationship withResourceType(ResourceType resourceType) {
        this. = resourceType.toString();
        return this;
    }

    
The resource ID of the related resource (for example, sg-xxxxxx.

Returns:
The resource ID of the related resource (for example, sg-xxxxxx.
    public String getResourceId() {
        return ;
    }
    
    
The resource ID of the related resource (for example, sg-xxxxxx.

Parameters:
resourceId The resource ID of the related resource (for example, sg-xxxxxx.
    public void setResourceId(String resourceId) {
        this. = resourceId;
    }
    
    
The resource ID of the related resource (for example, sg-xxxxxx.

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

Parameters:
resourceId The resource ID of the related resource (for example, sg-xxxxxx.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Relationship withResourceId(String resourceId) {
        this. = resourceId;
        return this;
    }

    
The name of the related resource.

Returns:
The name of the related resource.
    public String getRelationshipName() {
        return ;
    }
    
    
The name of the related resource.

Parameters:
relationshipName The name of the related resource.
    public void setRelationshipName(String relationshipName) {
        this. = relationshipName;
    }
    
    
The name of the related resource.

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

Parameters:
relationshipName The name of the related resource.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Relationship withRelationshipName(String relationshipName) {
        this. = relationshipName;
        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 (getResourceType() != nullsb.append("ResourceType: " + getResourceType() + ",");
        if (getResourceId() != nullsb.append("ResourceId: " + getResourceId() + ",");
        if (getRelationshipName() != nullsb.append("RelationshipName: " + getRelationshipName() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getResourceType() == null) ? 0 : getResourceType().hashCode()); 
        hashCode = prime * hashCode + ((getResourceId() == null) ? 0 : getResourceId().hashCode()); 
        hashCode = prime * hashCode + ((getRelationshipName() == null) ? 0 : getRelationshipName().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Relationship == falsereturn false;
        Relationship other = (Relationship)obj;
        
        if (other.getResourceType() == null ^ this.getResourceType() == nullreturn false;
        if (other.getResourceType() != null && other.getResourceType().equals(this.getResourceType()) == falsereturn false
        if (other.getResourceId() == null ^ this.getResourceId() == nullreturn false;
        if (other.getResourceId() != null && other.getResourceId().equals(this.getResourceId()) == falsereturn false
        if (other.getRelationshipName() == null ^ this.getRelationshipName() == nullreturn false;
        if (other.getRelationshipName() != null && other.getRelationshipName().equals(this.getRelationshipName()) == falsereturn false
        return true;
    }
    
    @Override
    public Relationship clone() {
        try {
            return (Relationshipsuper.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