com.amazonaws.services.ec2.model.RouteTable 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;
/**
*
* Describes a route table.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class RouteTable implements Serializable, Cloneable {
/**
*
* The associations between the route table and one or more subnets or a gateway.
*
*/
private com.amazonaws.internal.SdkInternalList associations;
/**
*
* Any virtual private gateway (VGW) propagating routes.
*
*/
private com.amazonaws.internal.SdkInternalList propagatingVgws;
/**
*
* The ID of the route table.
*
*/
private String routeTableId;
/**
*
* The routes in the route table.
*
*/
private com.amazonaws.internal.SdkInternalList routes;
/**
*
* Any tags assigned to the route table.
*
*/
private com.amazonaws.internal.SdkInternalList tags;
/**
*
* The ID of the VPC.
*
*/
private String vpcId;
/**
*
* The ID of the Amazon Web Services account that owns the route table.
*
*/
private String ownerId;
/**
*
* The associations between the route table and one or more subnets or a gateway.
*
*
* @return The associations between the route table and one or more subnets or a gateway.
*/
public java.util.List getAssociations() {
if (associations == null) {
associations = new com.amazonaws.internal.SdkInternalList();
}
return associations;
}
/**
*
* The associations between the route table and one or more subnets or a gateway.
*
*
* @param associations
* The associations between the route table and one or more subnets or a gateway.
*/
public void setAssociations(java.util.Collection associations) {
if (associations == null) {
this.associations = null;
return;
}
this.associations = new com.amazonaws.internal.SdkInternalList(associations);
}
/**
*
* The associations between the route table and one or more subnets or a gateway.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setAssociations(java.util.Collection)} or {@link #withAssociations(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param associations
* The associations between the route table and one or more subnets or a gateway.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RouteTable withAssociations(RouteTableAssociation... associations) {
if (this.associations == null) {
setAssociations(new com.amazonaws.internal.SdkInternalList(associations.length));
}
for (RouteTableAssociation ele : associations) {
this.associations.add(ele);
}
return this;
}
/**
*
* The associations between the route table and one or more subnets or a gateway.
*
*
* @param associations
* The associations between the route table and one or more subnets or a gateway.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RouteTable withAssociations(java.util.Collection associations) {
setAssociations(associations);
return this;
}
/**
*
* Any virtual private gateway (VGW) propagating routes.
*
*
* @return Any virtual private gateway (VGW) propagating routes.
*/
public java.util.List getPropagatingVgws() {
if (propagatingVgws == null) {
propagatingVgws = new com.amazonaws.internal.SdkInternalList();
}
return propagatingVgws;
}
/**
*
* Any virtual private gateway (VGW) propagating routes.
*
*
* @param propagatingVgws
* Any virtual private gateway (VGW) propagating routes.
*/
public void setPropagatingVgws(java.util.Collection propagatingVgws) {
if (propagatingVgws == null) {
this.propagatingVgws = null;
return;
}
this.propagatingVgws = new com.amazonaws.internal.SdkInternalList(propagatingVgws);
}
/**
*
* Any virtual private gateway (VGW) propagating routes.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setPropagatingVgws(java.util.Collection)} or {@link #withPropagatingVgws(java.util.Collection)} if you
* want to override the existing values.
*
*
* @param propagatingVgws
* Any virtual private gateway (VGW) propagating routes.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RouteTable withPropagatingVgws(PropagatingVgw... propagatingVgws) {
if (this.propagatingVgws == null) {
setPropagatingVgws(new com.amazonaws.internal.SdkInternalList(propagatingVgws.length));
}
for (PropagatingVgw ele : propagatingVgws) {
this.propagatingVgws.add(ele);
}
return this;
}
/**
*
* Any virtual private gateway (VGW) propagating routes.
*
*
* @param propagatingVgws
* Any virtual private gateway (VGW) propagating routes.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RouteTable withPropagatingVgws(java.util.Collection propagatingVgws) {
setPropagatingVgws(propagatingVgws);
return this;
}
/**
*
* The ID of the route table.
*
*
* @param routeTableId
* The ID of the route table.
*/
public void setRouteTableId(String routeTableId) {
this.routeTableId = routeTableId;
}
/**
*
* The ID of the route table.
*
*
* @return The ID of the route table.
*/
public String getRouteTableId() {
return this.routeTableId;
}
/**
*
* The ID of the route table.
*
*
* @param routeTableId
* The ID of the route table.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RouteTable withRouteTableId(String routeTableId) {
setRouteTableId(routeTableId);
return this;
}
/**
*
* The routes in the route table.
*
*
* @return The routes in the route table.
*/
public java.util.List getRoutes() {
if (routes == null) {
routes = new com.amazonaws.internal.SdkInternalList();
}
return routes;
}
/**
*
* The routes in the route table.
*
*
* @param routes
* The routes in the route table.
*/
public void setRoutes(java.util.Collection routes) {
if (routes == null) {
this.routes = null;
return;
}
this.routes = new com.amazonaws.internal.SdkInternalList(routes);
}
/**
*
* The routes in the route table.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setRoutes(java.util.Collection)} or {@link #withRoutes(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param routes
* The routes in the route table.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RouteTable withRoutes(Route... routes) {
if (this.routes == null) {
setRoutes(new com.amazonaws.internal.SdkInternalList(routes.length));
}
for (Route ele : routes) {
this.routes.add(ele);
}
return this;
}
/**
*
* The routes in the route table.
*
*
* @param routes
* The routes in the route table.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RouteTable withRoutes(java.util.Collection routes) {
setRoutes(routes);
return this;
}
/**
*
* Any tags assigned to the route table.
*
*
* @return Any tags assigned to the route table.
*/
public java.util.List getTags() {
if (tags == null) {
tags = new com.amazonaws.internal.SdkInternalList();
}
return tags;
}
/**
*
* Any tags assigned to the route table.
*
*
* @param tags
* Any tags assigned to the route table.
*/
public void setTags(java.util.Collection tags) {
if (tags == null) {
this.tags = null;
return;
}
this.tags = new com.amazonaws.internal.SdkInternalList(tags);
}
/**
*
* Any tags assigned to the route table.
*
*
* 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
* Any tags assigned to the route table.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RouteTable 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;
}
/**
*
* Any tags assigned to the route table.
*
*
* @param tags
* Any tags assigned to the route table.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RouteTable withTags(java.util.Collection tags) {
setTags(tags);
return this;
}
/**
*
* The ID of the VPC.
*
*
* @param vpcId
* The ID of the VPC.
*/
public void setVpcId(String vpcId) {
this.vpcId = vpcId;
}
/**
*
* The ID of the VPC.
*
*
* @return The ID of the VPC.
*/
public String getVpcId() {
return this.vpcId;
}
/**
*
* The ID of the VPC.
*
*
* @param vpcId
* The ID of the VPC.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RouteTable withVpcId(String vpcId) {
setVpcId(vpcId);
return this;
}
/**
*
* The ID of the Amazon Web Services account that owns the route table.
*
*
* @param ownerId
* The ID of the Amazon Web Services account that owns the route table.
*/
public void setOwnerId(String ownerId) {
this.ownerId = ownerId;
}
/**
*
* The ID of the Amazon Web Services account that owns the route table.
*
*
* @return The ID of the Amazon Web Services account that owns the route table.
*/
public String getOwnerId() {
return this.ownerId;
}
/**
*
* The ID of the Amazon Web Services account that owns the route table.
*
*
* @param ownerId
* The ID of the Amazon Web Services account that owns the route table.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RouteTable withOwnerId(String ownerId) {
setOwnerId(ownerId);
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 (getAssociations() != null)
sb.append("Associations: ").append(getAssociations()).append(",");
if (getPropagatingVgws() != null)
sb.append("PropagatingVgws: ").append(getPropagatingVgws()).append(",");
if (getRouteTableId() != null)
sb.append("RouteTableId: ").append(getRouteTableId()).append(",");
if (getRoutes() != null)
sb.append("Routes: ").append(getRoutes()).append(",");
if (getTags() != null)
sb.append("Tags: ").append(getTags()).append(",");
if (getVpcId() != null)
sb.append("VpcId: ").append(getVpcId()).append(",");
if (getOwnerId() != null)
sb.append("OwnerId: ").append(getOwnerId());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof RouteTable == false)
return false;
RouteTable other = (RouteTable) obj;
if (other.getAssociations() == null ^ this.getAssociations() == null)
return false;
if (other.getAssociations() != null && other.getAssociations().equals(this.getAssociations()) == false)
return false;
if (other.getPropagatingVgws() == null ^ this.getPropagatingVgws() == null)
return false;
if (other.getPropagatingVgws() != null && other.getPropagatingVgws().equals(this.getPropagatingVgws()) == false)
return false;
if (other.getRouteTableId() == null ^ this.getRouteTableId() == null)
return false;
if (other.getRouteTableId() != null && other.getRouteTableId().equals(this.getRouteTableId()) == false)
return false;
if (other.getRoutes() == null ^ this.getRoutes() == null)
return false;
if (other.getRoutes() != null && other.getRoutes().equals(this.getRoutes()) == false)
return false;
if (other.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
if (other.getVpcId() == null ^ this.getVpcId() == null)
return false;
if (other.getVpcId() != null && other.getVpcId().equals(this.getVpcId()) == false)
return false;
if (other.getOwnerId() == null ^ this.getOwnerId() == null)
return false;
if (other.getOwnerId() != null && other.getOwnerId().equals(this.getOwnerId()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAssociations() == null) ? 0 : getAssociations().hashCode());
hashCode = prime * hashCode + ((getPropagatingVgws() == null) ? 0 : getPropagatingVgws().hashCode());
hashCode = prime * hashCode + ((getRouteTableId() == null) ? 0 : getRouteTableId().hashCode());
hashCode = prime * hashCode + ((getRoutes() == null) ? 0 : getRoutes().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
hashCode = prime * hashCode + ((getVpcId() == null) ? 0 : getVpcId().hashCode());
hashCode = prime * hashCode + ((getOwnerId() == null) ? 0 : getOwnerId().hashCode());
return hashCode;
}
@Override
public RouteTable clone() {
try {
return (RouteTable) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}