com.amazonaws.services.ec2.model.TransitGatewayRoute 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;
/**
*
* Describes a route for a transit gateway route table.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class TransitGatewayRoute implements Serializable, Cloneable {
/**
*
* The CIDR block used for destination matches.
*
*/
private String destinationCidrBlock;
/**
*
* The attachments.
*
*/
private com.amazonaws.internal.SdkInternalList transitGatewayAttachments;
/**
*
* The route type.
*
*/
private String type;
/**
*
* The state of the route.
*
*/
private String state;
/**
*
* The CIDR block used for destination matches.
*
*
* @param destinationCidrBlock
* The CIDR block used for destination matches.
*/
public void setDestinationCidrBlock(String destinationCidrBlock) {
this.destinationCidrBlock = destinationCidrBlock;
}
/**
*
* The CIDR block used for destination matches.
*
*
* @return The CIDR block used for destination matches.
*/
public String getDestinationCidrBlock() {
return this.destinationCidrBlock;
}
/**
*
* The CIDR block used for destination matches.
*
*
* @param destinationCidrBlock
* The CIDR block used for destination matches.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TransitGatewayRoute withDestinationCidrBlock(String destinationCidrBlock) {
setDestinationCidrBlock(destinationCidrBlock);
return this;
}
/**
*
* The attachments.
*
*
* @return The attachments.
*/
public java.util.List getTransitGatewayAttachments() {
if (transitGatewayAttachments == null) {
transitGatewayAttachments = new com.amazonaws.internal.SdkInternalList();
}
return transitGatewayAttachments;
}
/**
*
* The attachments.
*
*
* @param transitGatewayAttachments
* The attachments.
*/
public void setTransitGatewayAttachments(java.util.Collection transitGatewayAttachments) {
if (transitGatewayAttachments == null) {
this.transitGatewayAttachments = null;
return;
}
this.transitGatewayAttachments = new com.amazonaws.internal.SdkInternalList(transitGatewayAttachments);
}
/**
*
* The attachments.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setTransitGatewayAttachments(java.util.Collection)} or
* {@link #withTransitGatewayAttachments(java.util.Collection)} if you want to override the existing values.
*
*
* @param transitGatewayAttachments
* The attachments.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TransitGatewayRoute withTransitGatewayAttachments(TransitGatewayRouteAttachment... transitGatewayAttachments) {
if (this.transitGatewayAttachments == null) {
setTransitGatewayAttachments(new com.amazonaws.internal.SdkInternalList(transitGatewayAttachments.length));
}
for (TransitGatewayRouteAttachment ele : transitGatewayAttachments) {
this.transitGatewayAttachments.add(ele);
}
return this;
}
/**
*
* The attachments.
*
*
* @param transitGatewayAttachments
* The attachments.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TransitGatewayRoute withTransitGatewayAttachments(java.util.Collection transitGatewayAttachments) {
setTransitGatewayAttachments(transitGatewayAttachments);
return this;
}
/**
*
* The route type.
*
*
* @param type
* The route type.
* @see TransitGatewayRouteType
*/
public void setType(String type) {
this.type = type;
}
/**
*
* The route type.
*
*
* @return The route type.
* @see TransitGatewayRouteType
*/
public String getType() {
return this.type;
}
/**
*
* The route type.
*
*
* @param type
* The route type.
* @return Returns a reference to this object so that method calls can be chained together.
* @see TransitGatewayRouteType
*/
public TransitGatewayRoute withType(String type) {
setType(type);
return this;
}
/**
*
* The route type.
*
*
* @param type
* The route type.
* @return Returns a reference to this object so that method calls can be chained together.
* @see TransitGatewayRouteType
*/
public TransitGatewayRoute withType(TransitGatewayRouteType type) {
this.type = type.toString();
return this;
}
/**
*
* The state of the route.
*
*
* @param state
* The state of the route.
* @see TransitGatewayRouteState
*/
public void setState(String state) {
this.state = state;
}
/**
*
* The state of the route.
*
*
* @return The state of the route.
* @see TransitGatewayRouteState
*/
public String getState() {
return this.state;
}
/**
*
* The state of the route.
*
*
* @param state
* The state of the route.
* @return Returns a reference to this object so that method calls can be chained together.
* @see TransitGatewayRouteState
*/
public TransitGatewayRoute withState(String state) {
setState(state);
return this;
}
/**
*
* The state of the route.
*
*
* @param state
* The state of the route.
* @return Returns a reference to this object so that method calls can be chained together.
* @see TransitGatewayRouteState
*/
public TransitGatewayRoute withState(TransitGatewayRouteState state) {
this.state = state.toString();
return this;
}
/**
* 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 (getDestinationCidrBlock() != null)
sb.append("DestinationCidrBlock: ").append(getDestinationCidrBlock()).append(",");
if (getTransitGatewayAttachments() != null)
sb.append("TransitGatewayAttachments: ").append(getTransitGatewayAttachments()).append(",");
if (getType() != null)
sb.append("Type: ").append(getType()).append(",");
if (getState() != null)
sb.append("State: ").append(getState());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof TransitGatewayRoute == false)
return false;
TransitGatewayRoute other = (TransitGatewayRoute) obj;
if (other.getDestinationCidrBlock() == null ^ this.getDestinationCidrBlock() == null)
return false;
if (other.getDestinationCidrBlock() != null && other.getDestinationCidrBlock().equals(this.getDestinationCidrBlock()) == false)
return false;
if (other.getTransitGatewayAttachments() == null ^ this.getTransitGatewayAttachments() == null)
return false;
if (other.getTransitGatewayAttachments() != null && other.getTransitGatewayAttachments().equals(this.getTransitGatewayAttachments()) == false)
return false;
if (other.getType() == null ^ this.getType() == null)
return false;
if (other.getType() != null && other.getType().equals(this.getType()) == false)
return false;
if (other.getState() == null ^ this.getState() == null)
return false;
if (other.getState() != null && other.getState().equals(this.getState()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getDestinationCidrBlock() == null) ? 0 : getDestinationCidrBlock().hashCode());
hashCode = prime * hashCode + ((getTransitGatewayAttachments() == null) ? 0 : getTransitGatewayAttachments().hashCode());
hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode());
hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode());
return hashCode;
}
@Override
public TransitGatewayRoute clone() {
try {
return (TransitGatewayRoute) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}