/* * Copyright 2018-2023 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.iotsecuretunneling.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* A connection between a source computer and a destination device. *

* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Tunnel implements Serializable, Cloneable, StructuredPojo { /** *

* A unique alpha-numeric ID that identifies a tunnel. *

*/ private String tunnelId; /** *

* The Amazon Resource Name (ARN) of a tunnel. *

*/ private String tunnelArn; /** *

* The status of a tunnel. Valid values are: Open and Closed. *

*/ private String status; /** *

* The connection state of the source application. *

*/ private ConnectionState sourceConnectionState; /** *

* The connection state of the destination application. *

*/ private ConnectionState destinationConnectionState; /** *

* A description of the tunnel. *

*/ private String description; /** *

* The destination configuration that specifies the thing name of the destination device and a service name that the * local proxy uses to connect to the destination application. *

*/ private DestinationConfig destinationConfig; /** *

* Timeout configuration for the tunnel. *

*/ private TimeoutConfig timeoutConfig; /** *

* A list of tag metadata associated with the secure tunnel. *

*/ private java.util.List tags; /** *

* The time when the tunnel was created. *

*/ private java.util.Date createdAt; /** *

* The last time the tunnel was updated. *

*/ private java.util.Date lastUpdatedAt; /** *

* A unique alpha-numeric ID that identifies a tunnel. *

* * @param tunnelId * A unique alpha-numeric ID that identifies a tunnel. */ public void setTunnelId(String tunnelId) { this.tunnelId = tunnelId; } /** *

* A unique alpha-numeric ID that identifies a tunnel. *

* * @return A unique alpha-numeric ID that identifies a tunnel. */ public String getTunnelId() { return this.tunnelId; } /** *

* A unique alpha-numeric ID that identifies a tunnel. *

* * @param tunnelId * A unique alpha-numeric ID that identifies a tunnel. * @return Returns a reference to this object so that method calls can be chained together. */ public Tunnel withTunnelId(String tunnelId) { setTunnelId(tunnelId); return this; } /** *

* The Amazon Resource Name (ARN) of a tunnel. *

* * @param tunnelArn * The Amazon Resource Name (ARN) of a tunnel. */ public void setTunnelArn(String tunnelArn) { this.tunnelArn = tunnelArn; } /** *

* The Amazon Resource Name (ARN) of a tunnel. *

* * @return The Amazon Resource Name (ARN) of a tunnel. */ public String getTunnelArn() { return this.tunnelArn; } /** *

* The Amazon Resource Name (ARN) of a tunnel. *

* * @param tunnelArn * The Amazon Resource Name (ARN) of a tunnel. * @return Returns a reference to this object so that method calls can be chained together. */ public Tunnel withTunnelArn(String tunnelArn) { setTunnelArn(tunnelArn); return this; } /** *

* The status of a tunnel. Valid values are: Open and Closed. *

* * @param status * The status of a tunnel. Valid values are: Open and Closed. * @see TunnelStatus */ public void setStatus(String status) { this.status = status; } /** *

* The status of a tunnel. Valid values are: Open and Closed. *

* * @return The status of a tunnel. Valid values are: Open and Closed. * @see TunnelStatus */ public String getStatus() { return this.status; } /** *

* The status of a tunnel. Valid values are: Open and Closed. *

* * @param status * The status of a tunnel. Valid values are: Open and Closed. * @return Returns a reference to this object so that method calls can be chained together. * @see TunnelStatus */ public Tunnel withStatus(String status) { setStatus(status); return this; } /** *

* The status of a tunnel. Valid values are: Open and Closed. *

* * @param status * The status of a tunnel. Valid values are: Open and Closed. * @return Returns a reference to this object so that method calls can be chained together. * @see TunnelStatus */ public Tunnel withStatus(TunnelStatus status) { this.status = status.toString(); return this; } /** *

* The connection state of the source application. *

* * @param sourceConnectionState * The connection state of the source application. */ public void setSourceConnectionState(ConnectionState sourceConnectionState) { this.sourceConnectionState = sourceConnectionState; } /** *

* The connection state of the source application. *

* * @return The connection state of the source application. */ public ConnectionState getSourceConnectionState() { return this.sourceConnectionState; } /** *

* The connection state of the source application. *

* * @param sourceConnectionState * The connection state of the source application. * @return Returns a reference to this object so that method calls can be chained together. */ public Tunnel withSourceConnectionState(ConnectionState sourceConnectionState) { setSourceConnectionState(sourceConnectionState); return this; } /** *

* The connection state of the destination application. *

* * @param destinationConnectionState * The connection state of the destination application. */ public void setDestinationConnectionState(ConnectionState destinationConnectionState) { this.destinationConnectionState = destinationConnectionState; } /** *

* The connection state of the destination application. *

* * @return The connection state of the destination application. */ public ConnectionState getDestinationConnectionState() { return this.destinationConnectionState; } /** *

* The connection state of the destination application. *

* * @param destinationConnectionState * The connection state of the destination application. * @return Returns a reference to this object so that method calls can be chained together. */ public Tunnel withDestinationConnectionState(ConnectionState destinationConnectionState) { setDestinationConnectionState(destinationConnectionState); return this; } /** *

* A description of the tunnel. *

* * @param description * A description of the tunnel. */ public void setDescription(String description) { this.description = description; } /** *

* A description of the tunnel. *

* * @return A description of the tunnel. */ public String getDescription() { return this.description; } /** *

* A description of the tunnel. *

* * @param description * A description of the tunnel. * @return Returns a reference to this object so that method calls can be chained together. */ public Tunnel withDescription(String description) { setDescription(description); return this; } /** *

* The destination configuration that specifies the thing name of the destination device and a service name that the * local proxy uses to connect to the destination application. *

* * @param destinationConfig * The destination configuration that specifies the thing name of the destination device and a service name * that the local proxy uses to connect to the destination application. */ public void setDestinationConfig(DestinationConfig destinationConfig) { this.destinationConfig = destinationConfig; } /** *

* The destination configuration that specifies the thing name of the destination device and a service name that the * local proxy uses to connect to the destination application. *

* * @return The destination configuration that specifies the thing name of the destination device and a service name * that the local proxy uses to connect to the destination application. */ public DestinationConfig getDestinationConfig() { return this.destinationConfig; } /** *

* The destination configuration that specifies the thing name of the destination device and a service name that the * local proxy uses to connect to the destination application. *

* * @param destinationConfig * The destination configuration that specifies the thing name of the destination device and a service name * that the local proxy uses to connect to the destination application. * @return Returns a reference to this object so that method calls can be chained together. */ public Tunnel withDestinationConfig(DestinationConfig destinationConfig) { setDestinationConfig(destinationConfig); return this; } /** *

* Timeout configuration for the tunnel. *

* * @param timeoutConfig * Timeout configuration for the tunnel. */ public void setTimeoutConfig(TimeoutConfig timeoutConfig) { this.timeoutConfig = timeoutConfig; } /** *

* Timeout configuration for the tunnel. *

* * @return Timeout configuration for the tunnel. */ public TimeoutConfig getTimeoutConfig() { return this.timeoutConfig; } /** *

* Timeout configuration for the tunnel. *

* * @param timeoutConfig * Timeout configuration for the tunnel. * @return Returns a reference to this object so that method calls can be chained together. */ public Tunnel withTimeoutConfig(TimeoutConfig timeoutConfig) { setTimeoutConfig(timeoutConfig); return this; } /** *

* A list of tag metadata associated with the secure tunnel. *

* * @return A list of tag metadata associated with the secure tunnel. */ public java.util.List getTags() { return tags; } /** *

* A list of tag metadata associated with the secure tunnel. *

* * @param tags * A list of tag metadata associated with the secure tunnel. */ public void setTags(java.util.Collection tags) { if (tags == null) { this.tags = null; return; } this.tags = new java.util.ArrayList(tags); } /** *

* A list of tag metadata associated with the secure tunnel. *

*

* 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 * A list of tag metadata associated with the secure tunnel. * @return Returns a reference to this object so that method calls can be chained together. */ public Tunnel withTags(Tag... tags) { if (this.tags == null) { setTags(new java.util.ArrayList(tags.length)); } for (Tag ele : tags) { this.tags.add(ele); } return this; } /** *

* A list of tag metadata associated with the secure tunnel. *

* * @param tags * A list of tag metadata associated with the secure tunnel. * @return Returns a reference to this object so that method calls can be chained together. */ public Tunnel withTags(java.util.Collection tags) { setTags(tags); return this; } /** *

* The time when the tunnel was created. *

* * @param createdAt * The time when the tunnel was created. */ public void setCreatedAt(java.util.Date createdAt) { this.createdAt = createdAt; } /** *

* The time when the tunnel was created. *

* * @return The time when the tunnel was created. */ public java.util.Date getCreatedAt() { return this.createdAt; } /** *

* The time when the tunnel was created. *

* * @param createdAt * The time when the tunnel was created. * @return Returns a reference to this object so that method calls can be chained together. */ public Tunnel withCreatedAt(java.util.Date createdAt) { setCreatedAt(createdAt); return this; } /** *

* The last time the tunnel was updated. *

* * @param lastUpdatedAt * The last time the tunnel was updated. */ public void setLastUpdatedAt(java.util.Date lastUpdatedAt) { this.lastUpdatedAt = lastUpdatedAt; } /** *

* The last time the tunnel was updated. *

* * @return The last time the tunnel was updated. */ public java.util.Date getLastUpdatedAt() { return this.lastUpdatedAt; } /** *

* The last time the tunnel was updated. *

* * @param lastUpdatedAt * The last time the tunnel was updated. * @return Returns a reference to this object so that method calls can be chained together. */ public Tunnel withLastUpdatedAt(java.util.Date lastUpdatedAt) { setLastUpdatedAt(lastUpdatedAt); 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 (getTunnelId() != null) sb.append("TunnelId: ").append(getTunnelId()).append(","); if (getTunnelArn() != null) sb.append("TunnelArn: ").append(getTunnelArn()).append(","); if (getStatus() != null) sb.append("Status: ").append(getStatus()).append(","); if (getSourceConnectionState() != null) sb.append("SourceConnectionState: ").append(getSourceConnectionState()).append(","); if (getDestinationConnectionState() != null) sb.append("DestinationConnectionState: ").append(getDestinationConnectionState()).append(","); if (getDescription() != null) sb.append("Description: ").append(getDescription()).append(","); if (getDestinationConfig() != null) sb.append("DestinationConfig: ").append(getDestinationConfig()).append(","); if (getTimeoutConfig() != null) sb.append("TimeoutConfig: ").append(getTimeoutConfig()).append(","); if (getTags() != null) sb.append("Tags: ").append(getTags()).append(","); if (getCreatedAt() != null) sb.append("CreatedAt: ").append(getCreatedAt()).append(","); if (getLastUpdatedAt() != null) sb.append("LastUpdatedAt: ").append(getLastUpdatedAt()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Tunnel == false) return false; Tunnel other = (Tunnel) obj; if (other.getTunnelId() == null ^ this.getTunnelId() == null) return false; if (other.getTunnelId() != null && other.getTunnelId().equals(this.getTunnelId()) == false) return false; if (other.getTunnelArn() == null ^ this.getTunnelArn() == null) return false; if (other.getTunnelArn() != null && other.getTunnelArn().equals(this.getTunnelArn()) == false) return false; if (other.getStatus() == null ^ this.getStatus() == null) return false; if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false) return false; if (other.getSourceConnectionState() == null ^ this.getSourceConnectionState() == null) return false; if (other.getSourceConnectionState() != null && other.getSourceConnectionState().equals(this.getSourceConnectionState()) == false) return false; if (other.getDestinationConnectionState() == null ^ this.getDestinationConnectionState() == null) return false; if (other.getDestinationConnectionState() != null && other.getDestinationConnectionState().equals(this.getDestinationConnectionState()) == false) return false; if (other.getDescription() == null ^ this.getDescription() == null) return false; if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false) return false; if (other.getDestinationConfig() == null ^ this.getDestinationConfig() == null) return false; if (other.getDestinationConfig() != null && other.getDestinationConfig().equals(this.getDestinationConfig()) == false) return false; if (other.getTimeoutConfig() == null ^ this.getTimeoutConfig() == null) return false; if (other.getTimeoutConfig() != null && other.getTimeoutConfig().equals(this.getTimeoutConfig()) == 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.getCreatedAt() == null ^ this.getCreatedAt() == null) return false; if (other.getCreatedAt() != null && other.getCreatedAt().equals(this.getCreatedAt()) == false) return false; if (other.getLastUpdatedAt() == null ^ this.getLastUpdatedAt() == null) return false; if (other.getLastUpdatedAt() != null && other.getLastUpdatedAt().equals(this.getLastUpdatedAt()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getTunnelId() == null) ? 0 : getTunnelId().hashCode()); hashCode = prime * hashCode + ((getTunnelArn() == null) ? 0 : getTunnelArn().hashCode()); hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); hashCode = prime * hashCode + ((getSourceConnectionState() == null) ? 0 : getSourceConnectionState().hashCode()); hashCode = prime * hashCode + ((getDestinationConnectionState() == null) ? 0 : getDestinationConnectionState().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getDestinationConfig() == null) ? 0 : getDestinationConfig().hashCode()); hashCode = prime * hashCode + ((getTimeoutConfig() == null) ? 0 : getTimeoutConfig().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); hashCode = prime * hashCode + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode()); hashCode = prime * hashCode + ((getLastUpdatedAt() == null) ? 0 : getLastUpdatedAt().hashCode()); return hashCode; } @Override public Tunnel clone() { try { return (Tunnel) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.iotsecuretunneling.model.transform.TunnelMarshaller.getInstance().marshall(this, protocolMarshaller); } }