software.amazon.awssdk.services.ecs.model.SubmitContainerStateChangeRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ecs Show documentation
Show all versions of ecs Show documentation
The AWS Java SDK for the Amazon EC2 Container Service holds the client classes that are used for
communicating with the
Amazon EC2 Container Service
/*
* Copyright 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 software.amazon.awssdk.services.ecs.model;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class SubmitContainerStateChangeRequest extends EcsRequest implements
ToCopyableBuilder {
private static final SdkField CLUSTER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("cluster")
.getter(getter(SubmitContainerStateChangeRequest::cluster)).setter(setter(Builder::cluster))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("cluster").build()).build();
private static final SdkField TASK_FIELD = SdkField. builder(MarshallingType.STRING).memberName("task")
.getter(getter(SubmitContainerStateChangeRequest::task)).setter(setter(Builder::task))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("task").build()).build();
private static final SdkField CONTAINER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("containerName").getter(getter(SubmitContainerStateChangeRequest::containerName))
.setter(setter(Builder::containerName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("containerName").build()).build();
private static final SdkField RUNTIME_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("runtimeId").getter(getter(SubmitContainerStateChangeRequest::runtimeId))
.setter(setter(Builder::runtimeId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("runtimeId").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(SubmitContainerStateChangeRequest::status)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField EXIT_CODE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("exitCode").getter(getter(SubmitContainerStateChangeRequest::exitCode)).setter(setter(Builder::exitCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("exitCode").build()).build();
private static final SdkField REASON_FIELD = SdkField. builder(MarshallingType.STRING).memberName("reason")
.getter(getter(SubmitContainerStateChangeRequest::reason)).setter(setter(Builder::reason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("reason").build()).build();
private static final SdkField> NETWORK_BINDINGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("networkBindings")
.getter(getter(SubmitContainerStateChangeRequest::networkBindings))
.setter(setter(Builder::networkBindings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("networkBindings").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(NetworkBinding::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CLUSTER_FIELD, TASK_FIELD,
CONTAINER_NAME_FIELD, RUNTIME_ID_FIELD, STATUS_FIELD, EXIT_CODE_FIELD, REASON_FIELD, NETWORK_BINDINGS_FIELD));
private final String cluster;
private final String task;
private final String containerName;
private final String runtimeId;
private final String status;
private final Integer exitCode;
private final String reason;
private final List networkBindings;
private SubmitContainerStateChangeRequest(BuilderImpl builder) {
super(builder);
this.cluster = builder.cluster;
this.task = builder.task;
this.containerName = builder.containerName;
this.runtimeId = builder.runtimeId;
this.status = builder.status;
this.exitCode = builder.exitCode;
this.reason = builder.reason;
this.networkBindings = builder.networkBindings;
}
/**
*
* The short name or full ARN of the cluster that hosts the container.
*
*
* @return The short name or full ARN of the cluster that hosts the container.
*/
public final String cluster() {
return cluster;
}
/**
*
* The task ID or full Amazon Resource Name (ARN) of the task that hosts the container.
*
*
* @return The task ID or full Amazon Resource Name (ARN) of the task that hosts the container.
*/
public final String task() {
return task;
}
/**
*
* The name of the container.
*
*
* @return The name of the container.
*/
public final String containerName() {
return containerName;
}
/**
*
* The ID of the Docker container.
*
*
* @return The ID of the Docker container.
*/
public final String runtimeId() {
return runtimeId;
}
/**
*
* The status of the state change request.
*
*
* @return The status of the state change request.
*/
public final String status() {
return status;
}
/**
*
* The exit code returned for the state change request.
*
*
* @return The exit code returned for the state change request.
*/
public final Integer exitCode() {
return exitCode;
}
/**
*
* The reason for the state change request.
*
*
* @return The reason for the state change request.
*/
public final String reason() {
return reason;
}
/**
* Returns true if the NetworkBindings property was specified by the sender (it may be empty), or false if the
* sender did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS
* service.
*/
public final boolean hasNetworkBindings() {
return networkBindings != null && !(networkBindings instanceof SdkAutoConstructList);
}
/**
*
* The network bindings of the container.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasNetworkBindings()} to see if a value was sent in this field.
*
*
* @return The network bindings of the container.
*/
public final List networkBindings() {
return networkBindings;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(cluster());
hashCode = 31 * hashCode + Objects.hashCode(task());
hashCode = 31 * hashCode + Objects.hashCode(containerName());
hashCode = 31 * hashCode + Objects.hashCode(runtimeId());
hashCode = 31 * hashCode + Objects.hashCode(status());
hashCode = 31 * hashCode + Objects.hashCode(exitCode());
hashCode = 31 * hashCode + Objects.hashCode(reason());
hashCode = 31 * hashCode + Objects.hashCode(hasNetworkBindings() ? networkBindings() : null);
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof SubmitContainerStateChangeRequest)) {
return false;
}
SubmitContainerStateChangeRequest other = (SubmitContainerStateChangeRequest) obj;
return Objects.equals(cluster(), other.cluster()) && Objects.equals(task(), other.task())
&& Objects.equals(containerName(), other.containerName()) && Objects.equals(runtimeId(), other.runtimeId())
&& Objects.equals(status(), other.status()) && Objects.equals(exitCode(), other.exitCode())
&& Objects.equals(reason(), other.reason()) && hasNetworkBindings() == other.hasNetworkBindings()
&& Objects.equals(networkBindings(), other.networkBindings());
}
/**
* 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.
*/
@Override
public final String toString() {
return ToString.builder("SubmitContainerStateChangeRequest").add("Cluster", cluster()).add("Task", task())
.add("ContainerName", containerName()).add("RuntimeId", runtimeId()).add("Status", status())
.add("ExitCode", exitCode()).add("Reason", reason())
.add("NetworkBindings", hasNetworkBindings() ? networkBindings() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "cluster":
return Optional.ofNullable(clazz.cast(cluster()));
case "task":
return Optional.ofNullable(clazz.cast(task()));
case "containerName":
return Optional.ofNullable(clazz.cast(containerName()));
case "runtimeId":
return Optional.ofNullable(clazz.cast(runtimeId()));
case "status":
return Optional.ofNullable(clazz.cast(status()));
case "exitCode":
return Optional.ofNullable(clazz.cast(exitCode()));
case "reason":
return Optional.ofNullable(clazz.cast(reason()));
case "networkBindings":
return Optional.ofNullable(clazz.cast(networkBindings()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy