com.amazonaws.services.ecs.model.Attachment Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ecs Show documentation
/*
* 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.ecs.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* An object representing a container instance or task attachment.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Attachment implements Serializable, Cloneable, StructuredPojo {
/**
*
* The unique identifier for the attachment.
*
*/
private String id;
/**
*
* The type of the attachment, such as ElasticNetworkInterface
.
*
*/
private String type;
/**
*
* The status of the attachment. Valid values are PRECREATED
, CREATED
,
* ATTACHING
, ATTACHED
, DETACHING
, DETACHED
,
* DELETED
, and FAILED
.
*
*/
private String status;
/**
*
* Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC
* address, the subnet ID, and the private IPv4 address.
*
*/
private com.amazonaws.internal.SdkInternalList details;
/**
*
* The unique identifier for the attachment.
*
*
* @param id
* The unique identifier for the attachment.
*/
public void setId(String id) {
this.id = id;
}
/**
*
* The unique identifier for the attachment.
*
*
* @return The unique identifier for the attachment.
*/
public String getId() {
return this.id;
}
/**
*
* The unique identifier for the attachment.
*
*
* @param id
* The unique identifier for the attachment.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Attachment withId(String id) {
setId(id);
return this;
}
/**
*
* The type of the attachment, such as ElasticNetworkInterface
.
*
*
* @param type
* The type of the attachment, such as ElasticNetworkInterface
.
*/
public void setType(String type) {
this.type = type;
}
/**
*
* The type of the attachment, such as ElasticNetworkInterface
.
*
*
* @return The type of the attachment, such as ElasticNetworkInterface
.
*/
public String getType() {
return this.type;
}
/**
*
* The type of the attachment, such as ElasticNetworkInterface
.
*
*
* @param type
* The type of the attachment, such as ElasticNetworkInterface
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Attachment withType(String type) {
setType(type);
return this;
}
/**
*
* The status of the attachment. Valid values are PRECREATED
, CREATED
,
* ATTACHING
, ATTACHED
, DETACHING
, DETACHED
,
* DELETED
, and FAILED
.
*
*
* @param status
* The status of the attachment. Valid values are PRECREATED
, CREATED
,
* ATTACHING
, ATTACHED
, DETACHING
, DETACHED
,
* DELETED
, and FAILED
.
*/
public void setStatus(String status) {
this.status = status;
}
/**
*
* The status of the attachment. Valid values are PRECREATED
, CREATED
,
* ATTACHING
, ATTACHED
, DETACHING
, DETACHED
,
* DELETED
, and FAILED
.
*
*
* @return The status of the attachment. Valid values are PRECREATED
, CREATED
,
* ATTACHING
, ATTACHED
, DETACHING
, DETACHED
,
* DELETED
, and FAILED
.
*/
public String getStatus() {
return this.status;
}
/**
*
* The status of the attachment. Valid values are PRECREATED
, CREATED
,
* ATTACHING
, ATTACHED
, DETACHING
, DETACHED
,
* DELETED
, and FAILED
.
*
*
* @param status
* The status of the attachment. Valid values are PRECREATED
, CREATED
,
* ATTACHING
, ATTACHED
, DETACHING
, DETACHED
,
* DELETED
, and FAILED
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Attachment withStatus(String status) {
setStatus(status);
return this;
}
/**
*
* Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC
* address, the subnet ID, and the private IPv4 address.
*
*
* @return Details of the attachment. For elastic network interfaces, this includes the network interface ID, the
* MAC address, the subnet ID, and the private IPv4 address.
*/
public java.util.List getDetails() {
if (details == null) {
details = new com.amazonaws.internal.SdkInternalList();
}
return details;
}
/**
*
* Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC
* address, the subnet ID, and the private IPv4 address.
*
*
* @param details
* Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC
* address, the subnet ID, and the private IPv4 address.
*/
public void setDetails(java.util.Collection details) {
if (details == null) {
this.details = null;
return;
}
this.details = new com.amazonaws.internal.SdkInternalList(details);
}
/**
*
* Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC
* address, the subnet ID, and the private IPv4 address.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setDetails(java.util.Collection)} or {@link #withDetails(java.util.Collection)} if you want to override
* the existing values.
*
*
* @param details
* Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC
* address, the subnet ID, and the private IPv4 address.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Attachment withDetails(KeyValuePair... details) {
if (this.details == null) {
setDetails(new com.amazonaws.internal.SdkInternalList(details.length));
}
for (KeyValuePair ele : details) {
this.details.add(ele);
}
return this;
}
/**
*
* Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC
* address, the subnet ID, and the private IPv4 address.
*
*
* @param details
* Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC
* address, the subnet ID, and the private IPv4 address.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Attachment withDetails(java.util.Collection details) {
setDetails(details);
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 (getId() != null)
sb.append("Id: ").append(getId()).append(",");
if (getType() != null)
sb.append("Type: ").append(getType()).append(",");
if (getStatus() != null)
sb.append("Status: ").append(getStatus()).append(",");
if (getDetails() != null)
sb.append("Details: ").append(getDetails());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Attachment == false)
return false;
Attachment other = (Attachment) obj;
if (other.getId() == null ^ this.getId() == null)
return false;
if (other.getId() != null && other.getId().equals(this.getId()) == 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.getStatus() == null ^ this.getStatus() == null)
return false;
if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false)
return false;
if (other.getDetails() == null ^ this.getDetails() == null)
return false;
if (other.getDetails() != null && other.getDetails().equals(this.getDetails()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode());
hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode());
hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode());
hashCode = prime * hashCode + ((getDetails() == null) ? 0 : getDetails().hashCode());
return hashCode;
}
@Override
public Attachment clone() {
try {
return (Attachment) 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.ecs.model.transform.AttachmentMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}