All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.ecs.model.SubmitContainerStateChangeRequest Maven / Gradle / Ivy

Go to download

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

There is a newer version: 2.30.1
Show newest version
/*
 * 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 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 getter(Function g) { return obj -> g.apply((SubmitContainerStateChangeRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends EcsRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The short name or full ARN of the cluster that hosts the container. *

* * @param cluster * The short name or full ARN of the cluster that hosts the container. * @return Returns a reference to this object so that method calls can be chained together. */ Builder cluster(String cluster); /** *

* The task ID or full Amazon Resource Name (ARN) of the task that hosts the container. *

* * @param task * The task ID or full Amazon Resource Name (ARN) of the task that hosts the container. * @return Returns a reference to this object so that method calls can be chained together. */ Builder task(String task); /** *

* 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. */ Builder containerName(String containerName); /** *

* 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. */ Builder runtimeId(String runtimeId); /** *

* The status of the state change request. *

* * @param status * The status of the state change request. * @return Returns a reference to this object so that method calls can be chained together. */ Builder status(String status); /** *

* The exit code returned for the state change request. *

* * @param exitCode * The exit code returned for the state change request. * @return Returns a reference to this object so that method calls can be chained together. */ Builder exitCode(Integer exitCode); /** *

* The reason for the state change request. *

* * @param reason * The reason for the state change request. * @return Returns a reference to this object so that method calls can be chained together. */ Builder reason(String reason); /** *

* The network bindings of the container. *

* * @param networkBindings * The network bindings of the container. * @return Returns a reference to this object so that method calls can be chained together. */ Builder networkBindings(Collection networkBindings); /** *

* The network bindings of the container. *

* * @param networkBindings * The network bindings of the container. * @return Returns a reference to this object so that method calls can be chained together. */ Builder networkBindings(NetworkBinding... networkBindings); /** *

* The network bindings of the container. *

* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need * to create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and * its result is passed to {@link #networkBindings(List)}. * * @param networkBindings * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #networkBindings(List) */ Builder networkBindings(Consumer... networkBindings); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends EcsRequest.BuilderImpl implements Builder { private String cluster; private String task; private String containerName; private String runtimeId; private String status; private Integer exitCode; private String reason; private List networkBindings = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(SubmitContainerStateChangeRequest model) { super(model); cluster(model.cluster); task(model.task); containerName(model.containerName); runtimeId(model.runtimeId); status(model.status); exitCode(model.exitCode); reason(model.reason); networkBindings(model.networkBindings); } public final String getCluster() { return cluster; } @Override public final Builder cluster(String cluster) { this.cluster = cluster; return this; } public final void setCluster(String cluster) { this.cluster = cluster; } public final String getTask() { return task; } @Override public final Builder task(String task) { this.task = task; return this; } public final void setTask(String task) { this.task = task; } public final String getContainerName() { return containerName; } @Override public final Builder containerName(String containerName) { this.containerName = containerName; return this; } public final void setContainerName(String containerName) { this.containerName = containerName; } public final String getRuntimeId() { return runtimeId; } @Override public final Builder runtimeId(String runtimeId) { this.runtimeId = runtimeId; return this; } public final void setRuntimeId(String runtimeId) { this.runtimeId = runtimeId; } public final String getStatus() { return status; } @Override public final Builder status(String status) { this.status = status; return this; } public final void setStatus(String status) { this.status = status; } public final Integer getExitCode() { return exitCode; } @Override public final Builder exitCode(Integer exitCode) { this.exitCode = exitCode; return this; } public final void setExitCode(Integer exitCode) { this.exitCode = exitCode; } public final String getReason() { return reason; } @Override public final Builder reason(String reason) { this.reason = reason; return this; } public final void setReason(String reason) { this.reason = reason; } public final List getNetworkBindings() { List result = NetworkBindingsCopier.copyToBuilder(this.networkBindings); if (result instanceof SdkAutoConstructList) { return null; } return result; } @Override public final Builder networkBindings(Collection networkBindings) { this.networkBindings = NetworkBindingsCopier.copy(networkBindings); return this; } @Override @SafeVarargs public final Builder networkBindings(NetworkBinding... networkBindings) { networkBindings(Arrays.asList(networkBindings)); return this; } @Override @SafeVarargs public final Builder networkBindings(Consumer... networkBindings) { networkBindings(Stream.of(networkBindings).map(c -> NetworkBinding.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setNetworkBindings(Collection networkBindings) { this.networkBindings = NetworkBindingsCopier.copyFromBuilder(networkBindings); } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public SubmitContainerStateChangeRequest build() { return new SubmitContainerStateChangeRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy