com.amazonaws.services.ecs.model.ContainerStateChange 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 that represents a change in state for a container.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ContainerStateChange implements Serializable, Cloneable, StructuredPojo {
/**
*
* The name of the container.
*
*/
private String containerName;
/**
*
* The container image SHA 256 digest.
*
*/
private String imageDigest;
/**
*
* The ID of the Docker container.
*
*/
private String runtimeId;
/**
*
* The exit code for the container, if the state change is a result of the container exiting.
*
*/
private Integer exitCode;
/**
*
* Any network bindings that are associated with the container.
*
*/
private com.amazonaws.internal.SdkInternalList networkBindings;
/**
*
* The reason for the state change.
*
*/
private String reason;
/**
*
* The status of the container.
*
*/
private String status;
/**
*
* The name of the container.
*
*
* @param containerName
* The name of the container.
*/
public void setContainerName(String containerName) {
this.containerName = containerName;
}
/**
*
* The name of the container.
*
*
* @return The name of the container.
*/
public String getContainerName() {
return this.containerName;
}
/**
*
* The name of the container.
*
*
* @param containerName
* The name of the container.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ContainerStateChange withContainerName(String containerName) {
setContainerName(containerName);
return this;
}
/**
*
* The container image SHA 256 digest.
*
*
* @param imageDigest
* The container image SHA 256 digest.
*/
public void setImageDigest(String imageDigest) {
this.imageDigest = imageDigest;
}
/**
*
* The container image SHA 256 digest.
*
*
* @return The container image SHA 256 digest.
*/
public String getImageDigest() {
return this.imageDigest;
}
/**
*
* The container image SHA 256 digest.
*
*
* @param imageDigest
* The container image SHA 256 digest.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ContainerStateChange withImageDigest(String imageDigest) {
setImageDigest(imageDigest);
return this;
}
/**
*
* The ID of the Docker container.
*
*
* @param runtimeId
* The ID of the Docker container.
*/
public void setRuntimeId(String runtimeId) {
this.runtimeId = runtimeId;
}
/**
*
* The ID of the Docker container.
*
*
* @return The ID of the Docker container.
*/
public String getRuntimeId() {
return this.runtimeId;
}
/**
*
* The ID of the Docker container.
*
*
* @param runtimeId
* The ID of the Docker container.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ContainerStateChange withRuntimeId(String runtimeId) {
setRuntimeId(runtimeId);
return this;
}
/**
*
* The exit code for the container, if the state change is a result of the container exiting.
*
*
* @param exitCode
* The exit code for the container, if the state change is a result of the container exiting.
*/
public void setExitCode(Integer exitCode) {
this.exitCode = exitCode;
}
/**
*
* The exit code for the container, if the state change is a result of the container exiting.
*
*
* @return The exit code for the container, if the state change is a result of the container exiting.
*/
public Integer getExitCode() {
return this.exitCode;
}
/**
*
* The exit code for the container, if the state change is a result of the container exiting.
*
*
* @param exitCode
* The exit code for the container, if the state change is a result of the container exiting.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ContainerStateChange withExitCode(Integer exitCode) {
setExitCode(exitCode);
return this;
}
/**
*
* Any network bindings that are associated with the container.
*
*
* @return Any network bindings that are associated with the container.
*/
public java.util.List getNetworkBindings() {
if (networkBindings == null) {
networkBindings = new com.amazonaws.internal.SdkInternalList();
}
return networkBindings;
}
/**
*
* Any network bindings that are associated with the container.
*
*
* @param networkBindings
* Any network bindings that are associated with the container.
*/
public void setNetworkBindings(java.util.Collection networkBindings) {
if (networkBindings == null) {
this.networkBindings = null;
return;
}
this.networkBindings = new com.amazonaws.internal.SdkInternalList(networkBindings);
}
/**
*
* Any network bindings that are associated with the container.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setNetworkBindings(java.util.Collection)} or {@link #withNetworkBindings(java.util.Collection)} if you
* want to override the existing values.
*
*
* @param networkBindings
* Any network bindings that are associated with the container.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ContainerStateChange withNetworkBindings(NetworkBinding... networkBindings) {
if (this.networkBindings == null) {
setNetworkBindings(new com.amazonaws.internal.SdkInternalList(networkBindings.length));
}
for (NetworkBinding ele : networkBindings) {
this.networkBindings.add(ele);
}
return this;
}
/**
*
* Any network bindings that are associated with the container.
*
*
* @param networkBindings
* Any network bindings that are associated with the container.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ContainerStateChange withNetworkBindings(java.util.Collection networkBindings) {
setNetworkBindings(networkBindings);
return this;
}
/**
*
* The reason for the state change.
*
*
* @param reason
* The reason for the state change.
*/
public void setReason(String reason) {
this.reason = reason;
}
/**
*
* The reason for the state change.
*
*
* @return The reason for the state change.
*/
public String getReason() {
return this.reason;
}
/**
*
* The reason for the state change.
*
*
* @param reason
* The reason for the state change.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ContainerStateChange withReason(String reason) {
setReason(reason);
return this;
}
/**
*
* The status of the container.
*
*
* @param status
* The status of the container.
*/
public void setStatus(String status) {
this.status = status;
}
/**
*
* The status of the container.
*
*
* @return The status of the container.
*/
public String getStatus() {
return this.status;
}
/**
*
* The status of the container.
*
*
* @param status
* The status of the container.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ContainerStateChange withStatus(String status) {
setStatus(status);
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 (getContainerName() != null)
sb.append("ContainerName: ").append(getContainerName()).append(",");
if (getImageDigest() != null)
sb.append("ImageDigest: ").append(getImageDigest()).append(",");
if (getRuntimeId() != null)
sb.append("RuntimeId: ").append(getRuntimeId()).append(",");
if (getExitCode() != null)
sb.append("ExitCode: ").append(getExitCode()).append(",");
if (getNetworkBindings() != null)
sb.append("NetworkBindings: ").append(getNetworkBindings()).append(",");
if (getReason() != null)
sb.append("Reason: ").append(getReason()).append(",");
if (getStatus() != null)
sb.append("Status: ").append(getStatus());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ContainerStateChange == false)
return false;
ContainerStateChange other = (ContainerStateChange) obj;
if (other.getContainerName() == null ^ this.getContainerName() == null)
return false;
if (other.getContainerName() != null && other.getContainerName().equals(this.getContainerName()) == false)
return false;
if (other.getImageDigest() == null ^ this.getImageDigest() == null)
return false;
if (other.getImageDigest() != null && other.getImageDigest().equals(this.getImageDigest()) == false)
return false;
if (other.getRuntimeId() == null ^ this.getRuntimeId() == null)
return false;
if (other.getRuntimeId() != null && other.getRuntimeId().equals(this.getRuntimeId()) == false)
return false;
if (other.getExitCode() == null ^ this.getExitCode() == null)
return false;
if (other.getExitCode() != null && other.getExitCode().equals(this.getExitCode()) == false)
return false;
if (other.getNetworkBindings() == null ^ this.getNetworkBindings() == null)
return false;
if (other.getNetworkBindings() != null && other.getNetworkBindings().equals(this.getNetworkBindings()) == false)
return false;
if (other.getReason() == null ^ this.getReason() == null)
return false;
if (other.getReason() != null && other.getReason().equals(this.getReason()) == false)
return false;
if (other.getStatus() == null ^ this.getStatus() == null)
return false;
if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getContainerName() == null) ? 0 : getContainerName().hashCode());
hashCode = prime * hashCode + ((getImageDigest() == null) ? 0 : getImageDigest().hashCode());
hashCode = prime * hashCode + ((getRuntimeId() == null) ? 0 : getRuntimeId().hashCode());
hashCode = prime * hashCode + ((getExitCode() == null) ? 0 : getExitCode().hashCode());
hashCode = prime * hashCode + ((getNetworkBindings() == null) ? 0 : getNetworkBindings().hashCode());
hashCode = prime * hashCode + ((getReason() == null) ? 0 : getReason().hashCode());
hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode());
return hashCode;
}
@Override
public ContainerStateChange clone() {
try {
return (ContainerStateChange) 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.ContainerStateChangeMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}