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

software.amazon.awssdk.services.ecs.model.ContainerInstance 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.29.39
Show newest version
/*
 * Copyright 2014-2019 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.io.Serializable;
import java.time.Instant;
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.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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* An EC2 instance that is running the Amazon ECS agent and has been registered with a cluster. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ContainerInstance implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField CONTAINER_INSTANCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ContainerInstance::containerInstanceArn)).setter(setter(Builder::containerInstanceArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("containerInstanceArn").build()) .build(); private static final SdkField EC2_INSTANCE_ID_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ContainerInstance::ec2InstanceId)).setter(setter(Builder::ec2InstanceId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ec2InstanceId").build()).build(); private static final SdkField VERSION_FIELD = SdkField. builder(MarshallingType.LONG) .getter(getter(ContainerInstance::version)).setter(setter(Builder::version)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("version").build()).build(); private static final SdkField VERSION_INFO_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .getter(getter(ContainerInstance::versionInfo)).setter(setter(Builder::versionInfo)) .constructor(VersionInfo::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("versionInfo").build()).build(); private static final SdkField> REMAINING_RESOURCES_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(ContainerInstance::remainingResources)) .setter(setter(Builder::remainingResources)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("remainingResources").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Resource::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> REGISTERED_RESOURCES_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(ContainerInstance::registeredResources)) .setter(setter(Builder::registeredResources)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("registeredResources").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Resource::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ContainerInstance::status)).setter(setter(Builder::status)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build(); private static final SdkField STATUS_REASON_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ContainerInstance::statusReason)).setter(setter(Builder::statusReason)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("statusReason").build()).build(); private static final SdkField AGENT_CONNECTED_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .getter(getter(ContainerInstance::agentConnected)).setter(setter(Builder::agentConnected)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("agentConnected").build()).build(); private static final SdkField RUNNING_TASKS_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER) .getter(getter(ContainerInstance::runningTasksCount)).setter(setter(Builder::runningTasksCount)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("runningTasksCount").build()).build(); private static final SdkField PENDING_TASKS_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER) .getter(getter(ContainerInstance::pendingTasksCount)).setter(setter(Builder::pendingTasksCount)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("pendingTasksCount").build()).build(); private static final SdkField AGENT_UPDATE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ContainerInstance::agentUpdateStatusAsString)).setter(setter(Builder::agentUpdateStatus)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("agentUpdateStatus").build()).build(); private static final SdkField> ATTRIBUTES_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(ContainerInstance::attributes)) .setter(setter(Builder::attributes)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("attributes").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Attribute::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField REGISTERED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT) .getter(getter(ContainerInstance::registeredAt)).setter(setter(Builder::registeredAt)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("registeredAt").build()).build(); private static final SdkField> ATTACHMENTS_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(ContainerInstance::attachments)) .setter(setter(Builder::attachments)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("attachments").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Attachment::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> TAGS_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(ContainerInstance::tags)) .setter(setter(Builder::tags)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Tag::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CONTAINER_INSTANCE_ARN_FIELD, EC2_INSTANCE_ID_FIELD, VERSION_FIELD, VERSION_INFO_FIELD, REMAINING_RESOURCES_FIELD, REGISTERED_RESOURCES_FIELD, STATUS_FIELD, STATUS_REASON_FIELD, AGENT_CONNECTED_FIELD, RUNNING_TASKS_COUNT_FIELD, PENDING_TASKS_COUNT_FIELD, AGENT_UPDATE_STATUS_FIELD, ATTRIBUTES_FIELD, REGISTERED_AT_FIELD, ATTACHMENTS_FIELD, TAGS_FIELD)); private static final long serialVersionUID = 1L; private final String containerInstanceArn; private final String ec2InstanceId; private final Long version; private final VersionInfo versionInfo; private final List remainingResources; private final List registeredResources; private final String status; private final String statusReason; private final Boolean agentConnected; private final Integer runningTasksCount; private final Integer pendingTasksCount; private final String agentUpdateStatus; private final List attributes; private final Instant registeredAt; private final List attachments; private final List tags; private ContainerInstance(BuilderImpl builder) { this.containerInstanceArn = builder.containerInstanceArn; this.ec2InstanceId = builder.ec2InstanceId; this.version = builder.version; this.versionInfo = builder.versionInfo; this.remainingResources = builder.remainingResources; this.registeredResources = builder.registeredResources; this.status = builder.status; this.statusReason = builder.statusReason; this.agentConnected = builder.agentConnected; this.runningTasksCount = builder.runningTasksCount; this.pendingTasksCount = builder.pendingTasksCount; this.agentUpdateStatus = builder.agentUpdateStatus; this.attributes = builder.attributes; this.registeredAt = builder.registeredAt; this.attachments = builder.attachments; this.tags = builder.tags; } /** *

* The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs * namespace, followed by the Region of the container instance, the AWS account ID of the container instance owner, * the container-instance namespace, and then the container instance ID. For example, * arn:aws:ecs:region:aws_account_id:container-instance/container_instance_ID. *

* * @return The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs * namespace, followed by the Region of the container instance, the AWS account ID of the container instance * owner, the container-instance namespace, and then the container instance ID. For example, * arn:aws:ecs:region:aws_account_id:container-instance/container_instance_ID. */ public String containerInstanceArn() { return containerInstanceArn; } /** *

* The EC2 instance ID of the container instance. *

* * @return The EC2 instance ID of the container instance. */ public String ec2InstanceId() { return ec2InstanceId; } /** *

* The version counter for the container instance. Every time a container instance experiences a change that * triggers a CloudWatch event, the version counter is incremented. If you are replicating your Amazon ECS container * instance state with CloudWatch Events, you can compare the version of a container instance reported by the Amazon * ECS APIs with the version reported in CloudWatch Events for the container instance (inside the * detail object) to verify that the version in your event stream is current. *

* * @return The version counter for the container instance. Every time a container instance experiences a change that * triggers a CloudWatch event, the version counter is incremented. If you are replicating your Amazon ECS * container instance state with CloudWatch Events, you can compare the version of a container instance * reported by the Amazon ECS APIs with the version reported in CloudWatch Events for the container instance * (inside the detail object) to verify that the version in your event stream is current. */ public Long version() { return version; } /** *

* The version information for the Amazon ECS container agent and Docker daemon running on the container instance. *

* * @return The version information for the Amazon ECS container agent and Docker daemon running on the container * instance. */ public VersionInfo versionInfo() { return versionInfo; } /** *

* For CPU and memory resource types, this parameter describes the remaining CPU and memory that has not already * been allocated to tasks and is therefore available for new tasks. For port resource types, this parameter * describes the ports that were reserved by the Amazon ECS container agent (at instance registration time) and any * task containers that have reserved port mappings on the host (with the host or bridge * network mode). Any port that is not specified here is available for new tasks. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

* * @return For CPU and memory resource types, this parameter describes the remaining CPU and memory that has not * already been allocated to tasks and is therefore available for new tasks. For port resource types, this * parameter describes the ports that were reserved by the Amazon ECS container agent (at instance * registration time) and any task containers that have reserved port mappings on the host (with the * host or bridge network mode). Any port that is not specified here is available * for new tasks. */ public List remainingResources() { return remainingResources; } /** *

* For CPU and memory resource types, this parameter describes the amount of each resource that was available on the * container instance when the container agent registered it with Amazon ECS. This value represents the total amount * of CPU and memory that can be allocated on this container instance to tasks. For port resource types, this * parameter describes the ports that were reserved by the Amazon ECS container agent when it registered the * container instance with Amazon ECS. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

* * @return For CPU and memory resource types, this parameter describes the amount of each resource that was * available on the container instance when the container agent registered it with Amazon ECS. This value * represents the total amount of CPU and memory that can be allocated on this container instance to tasks. * For port resource types, this parameter describes the ports that were reserved by the Amazon ECS * container agent when it registered the container instance with Amazon ECS. */ public List registeredResources() { return registeredResources; } /** *

* The status of the container instance. The valid values are REGISTERING, * REGISTRATION_FAILED, ACTIVE, INACTIVE, DEREGISTERING, or * DRAINING. *

*

* If your account has opted in to the awsvpcTrunking account setting, then any newly registered * container instance will transition to a REGISTERING status while the trunk elastic network interface * is provisioned for the instance. If the registration fails, the instance will transition to a * REGISTRATION_FAILED status. You can describe the container instance and see the reason for failure * in the statusReason parameter. Once the container instance is terminated, the instance transitions * to a DEREGISTERING status while the trunk elastic network interface is deprovisioned. The instance * then transitions to an INACTIVE status. *

*

* The ACTIVE status indicates that the container instance can accept tasks. The DRAINING * indicates that new tasks are not placed on the container instance and any service tasks running on the container * instance are removed if possible. For more information, see Container * Instance Draining in the Amazon Elastic Container Service Developer Guide. *

* * @return The status of the container instance. The valid values are REGISTERING, * REGISTRATION_FAILED, ACTIVE, INACTIVE, DEREGISTERING, * or DRAINING.

*

* If your account has opted in to the awsvpcTrunking account setting, then any newly * registered container instance will transition to a REGISTERING status while the trunk * elastic network interface is provisioned for the instance. If the registration fails, the instance will * transition to a REGISTRATION_FAILED status. You can describe the container instance and see * the reason for failure in the statusReason parameter. Once the container instance is * terminated, the instance transitions to a DEREGISTERING status while the trunk elastic * network interface is deprovisioned. The instance then transitions to an INACTIVE status. *

*

* The ACTIVE status indicates that the container instance can accept tasks. The * DRAINING indicates that new tasks are not placed on the container instance and any service * tasks running on the container instance are removed if possible. For more information, see Container Instance Draining in the Amazon Elastic Container Service Developer Guide. */ public String status() { return status; } /** *

* The reason that the container instance reached its current status. *

* * @return The reason that the container instance reached its current status. */ public String statusReason() { return statusReason; } /** *

* This parameter returns true if the agent is connected to Amazon ECS. Registered instances with an * agent that may be unhealthy or stopped return false. Only instances connected to an agent can accept * placement requests. *

* * @return This parameter returns true if the agent is connected to Amazon ECS. Registered instances * with an agent that may be unhealthy or stopped return false. Only instances connected to an * agent can accept placement requests. */ public Boolean agentConnected() { return agentConnected; } /** *

* The number of tasks on the container instance that are in the RUNNING status. *

* * @return The number of tasks on the container instance that are in the RUNNING status. */ public Integer runningTasksCount() { return runningTasksCount; } /** *

* The number of tasks on the container instance that are in the PENDING status. *

* * @return The number of tasks on the container instance that are in the PENDING status. */ public Integer pendingTasksCount() { return pendingTasksCount; } /** *

* The status of the most recent agent update. If an update has never been requested, this value is * NULL. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #agentUpdateStatus} * will return {@link AgentUpdateStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #agentUpdateStatusAsString}. *

* * @return The status of the most recent agent update. If an update has never been requested, this value is * NULL. * @see AgentUpdateStatus */ public AgentUpdateStatus agentUpdateStatus() { return AgentUpdateStatus.fromValue(agentUpdateStatus); } /** *

* The status of the most recent agent update. If an update has never been requested, this value is * NULL. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #agentUpdateStatus} * will return {@link AgentUpdateStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #agentUpdateStatusAsString}. *

* * @return The status of the most recent agent update. If an update has never been requested, this value is * NULL. * @see AgentUpdateStatus */ public String agentUpdateStatusAsString() { return agentUpdateStatus; } /** *

* The attributes set for the container instance, either by the Amazon ECS container agent at instance registration * or manually with the PutAttributes operation. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

* * @return The attributes set for the container instance, either by the Amazon ECS container agent at instance * registration or manually with the PutAttributes operation. */ public List attributes() { return attributes; } /** *

* The Unix timestamp for when the container instance was registered. *

* * @return The Unix timestamp for when the container instance was registered. */ public Instant registeredAt() { return registeredAt; } /** *

* The resources attached to a container instance, such as elastic network interfaces. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

* * @return The resources attached to a container instance, such as elastic network interfaces. */ public List attachments() { return attachments; } /** *

* The metadata that you apply to the container instance to help you categorize and organize them. Each tag consists * of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 * characters, and tag values can have a maximum length of 256 characters. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

* * @return The metadata that you apply to the container instance to help you categorize and organize them. Each tag * consists of a key and an optional value, both of which you define. Tag keys can have a maximum character * length of 128 characters, and tag values can have a maximum length of 256 characters. */ public List tags() { return tags; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(containerInstanceArn()); hashCode = 31 * hashCode + Objects.hashCode(ec2InstanceId()); hashCode = 31 * hashCode + Objects.hashCode(version()); hashCode = 31 * hashCode + Objects.hashCode(versionInfo()); hashCode = 31 * hashCode + Objects.hashCode(remainingResources()); hashCode = 31 * hashCode + Objects.hashCode(registeredResources()); hashCode = 31 * hashCode + Objects.hashCode(status()); hashCode = 31 * hashCode + Objects.hashCode(statusReason()); hashCode = 31 * hashCode + Objects.hashCode(agentConnected()); hashCode = 31 * hashCode + Objects.hashCode(runningTasksCount()); hashCode = 31 * hashCode + Objects.hashCode(pendingTasksCount()); hashCode = 31 * hashCode + Objects.hashCode(agentUpdateStatusAsString()); hashCode = 31 * hashCode + Objects.hashCode(attributes()); hashCode = 31 * hashCode + Objects.hashCode(registeredAt()); hashCode = 31 * hashCode + Objects.hashCode(attachments()); hashCode = 31 * hashCode + Objects.hashCode(tags()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ContainerInstance)) { return false; } ContainerInstance other = (ContainerInstance) obj; return Objects.equals(containerInstanceArn(), other.containerInstanceArn()) && Objects.equals(ec2InstanceId(), other.ec2InstanceId()) && Objects.equals(version(), other.version()) && Objects.equals(versionInfo(), other.versionInfo()) && Objects.equals(remainingResources(), other.remainingResources()) && Objects.equals(registeredResources(), other.registeredResources()) && Objects.equals(status(), other.status()) && Objects.equals(statusReason(), other.statusReason()) && Objects.equals(agentConnected(), other.agentConnected()) && Objects.equals(runningTasksCount(), other.runningTasksCount()) && Objects.equals(pendingTasksCount(), other.pendingTasksCount()) && Objects.equals(agentUpdateStatusAsString(), other.agentUpdateStatusAsString()) && Objects.equals(attributes(), other.attributes()) && Objects.equals(registeredAt(), other.registeredAt()) && Objects.equals(attachments(), other.attachments()) && Objects.equals(tags(), other.tags()); } /** * 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 String toString() { return ToString.builder("ContainerInstance").add("ContainerInstanceArn", containerInstanceArn()) .add("Ec2InstanceId", ec2InstanceId()).add("Version", version()).add("VersionInfo", versionInfo()) .add("RemainingResources", remainingResources()).add("RegisteredResources", registeredResources()) .add("Status", status()).add("StatusReason", statusReason()).add("AgentConnected", agentConnected()) .add("RunningTasksCount", runningTasksCount()).add("PendingTasksCount", pendingTasksCount()) .add("AgentUpdateStatus", agentUpdateStatusAsString()).add("Attributes", attributes()) .add("RegisteredAt", registeredAt()).add("Attachments", attachments()).add("Tags", tags()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "containerInstanceArn": return Optional.ofNullable(clazz.cast(containerInstanceArn())); case "ec2InstanceId": return Optional.ofNullable(clazz.cast(ec2InstanceId())); case "version": return Optional.ofNullable(clazz.cast(version())); case "versionInfo": return Optional.ofNullable(clazz.cast(versionInfo())); case "remainingResources": return Optional.ofNullable(clazz.cast(remainingResources())); case "registeredResources": return Optional.ofNullable(clazz.cast(registeredResources())); case "status": return Optional.ofNullable(clazz.cast(status())); case "statusReason": return Optional.ofNullable(clazz.cast(statusReason())); case "agentConnected": return Optional.ofNullable(clazz.cast(agentConnected())); case "runningTasksCount": return Optional.ofNullable(clazz.cast(runningTasksCount())); case "pendingTasksCount": return Optional.ofNullable(clazz.cast(pendingTasksCount())); case "agentUpdateStatus": return Optional.ofNullable(clazz.cast(agentUpdateStatusAsString())); case "attributes": return Optional.ofNullable(clazz.cast(attributes())); case "registeredAt": return Optional.ofNullable(clazz.cast(registeredAt())); case "attachments": return Optional.ofNullable(clazz.cast(attachments())); case "tags": return Optional.ofNullable(clazz.cast(tags())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ContainerInstance) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The Amazon Resource Name (ARN) of the container instance. The ARN contains the arn:aws:ecs * namespace, followed by the Region of the container instance, the AWS account ID of the container instance * owner, the container-instance namespace, and then the container instance ID. For example, * arn:aws:ecs:region:aws_account_id:container-instance/container_instance_ID. *

* * @param containerInstanceArn * The Amazon Resource Name (ARN) of the container instance. The ARN contains the * arn:aws:ecs namespace, followed by the Region of the container instance, the AWS account * ID of the container instance owner, the container-instance namespace, and then the * container instance ID. For example, * arn:aws:ecs:region:aws_account_id:container-instance/container_instance_ID. * @return Returns a reference to this object so that method calls can be chained together. */ Builder containerInstanceArn(String containerInstanceArn); /** *

* The EC2 instance ID of the container instance. *

* * @param ec2InstanceId * The EC2 instance ID of the container instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ec2InstanceId(String ec2InstanceId); /** *

* The version counter for the container instance. Every time a container instance experiences a change that * triggers a CloudWatch event, the version counter is incremented. If you are replicating your Amazon ECS * container instance state with CloudWatch Events, you can compare the version of a container instance reported * by the Amazon ECS APIs with the version reported in CloudWatch Events for the container instance (inside the * detail object) to verify that the version in your event stream is current. *

* * @param version * The version counter for the container instance. Every time a container instance experiences a change * that triggers a CloudWatch event, the version counter is incremented. If you are replicating your * Amazon ECS container instance state with CloudWatch Events, you can compare the version of a container * instance reported by the Amazon ECS APIs with the version reported in CloudWatch Events for the * container instance (inside the detail object) to verify that the version in your event * stream is current. * @return Returns a reference to this object so that method calls can be chained together. */ Builder version(Long version); /** *

* The version information for the Amazon ECS container agent and Docker daemon running on the container * instance. *

* * @param versionInfo * The version information for the Amazon ECS container agent and Docker daemon running on the container * instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder versionInfo(VersionInfo versionInfo); /** *

* The version information for the Amazon ECS container agent and Docker daemon running on the container * instance. *

* This is a convenience that creates an instance of the {@link VersionInfo.Builder} avoiding the need to create * one manually via {@link VersionInfo#builder()}. * * When the {@link Consumer} completes, {@link VersionInfo.Builder#build()} is called immediately and its result * is passed to {@link #versionInfo(VersionInfo)}. * * @param versionInfo * a consumer that will call methods on {@link VersionInfo.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #versionInfo(VersionInfo) */ default Builder versionInfo(Consumer versionInfo) { return versionInfo(VersionInfo.builder().applyMutation(versionInfo).build()); } /** *

* For CPU and memory resource types, this parameter describes the remaining CPU and memory that has not already * been allocated to tasks and is therefore available for new tasks. For port resource types, this parameter * describes the ports that were reserved by the Amazon ECS container agent (at instance registration time) and * any task containers that have reserved port mappings on the host (with the host or * bridge network mode). Any port that is not specified here is available for new tasks. *

* * @param remainingResources * For CPU and memory resource types, this parameter describes the remaining CPU and memory that has not * already been allocated to tasks and is therefore available for new tasks. For port resource types, * this parameter describes the ports that were reserved by the Amazon ECS container agent (at instance * registration time) and any task containers that have reserved port mappings on the host (with the * host or bridge network mode). Any port that is not specified here is * available for new tasks. * @return Returns a reference to this object so that method calls can be chained together. */ Builder remainingResources(Collection remainingResources); /** *

* For CPU and memory resource types, this parameter describes the remaining CPU and memory that has not already * been allocated to tasks and is therefore available for new tasks. For port resource types, this parameter * describes the ports that were reserved by the Amazon ECS container agent (at instance registration time) and * any task containers that have reserved port mappings on the host (with the host or * bridge network mode). Any port that is not specified here is available for new tasks. *

* * @param remainingResources * For CPU and memory resource types, this parameter describes the remaining CPU and memory that has not * already been allocated to tasks and is therefore available for new tasks. For port resource types, * this parameter describes the ports that were reserved by the Amazon ECS container agent (at instance * registration time) and any task containers that have reserved port mappings on the host (with the * host or bridge network mode). Any port that is not specified here is * available for new tasks. * @return Returns a reference to this object so that method calls can be chained together. */ Builder remainingResources(Resource... remainingResources); /** *

* For CPU and memory resource types, this parameter describes the remaining CPU and memory that has not already * been allocated to tasks and is therefore available for new tasks. For port resource types, this parameter * describes the ports that were reserved by the Amazon ECS container agent (at instance registration time) and * any task containers that have reserved port mappings on the host (with the host or * bridge network mode). Any port that is not specified here is available for new tasks. *

* 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 #remainingResources(List)}. * * @param remainingResources * 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 #remainingResources(List) */ Builder remainingResources(Consumer... remainingResources); /** *

* For CPU and memory resource types, this parameter describes the amount of each resource that was available on * the container instance when the container agent registered it with Amazon ECS. This value represents the * total amount of CPU and memory that can be allocated on this container instance to tasks. For port resource * types, this parameter describes the ports that were reserved by the Amazon ECS container agent when it * registered the container instance with Amazon ECS. *

* * @param registeredResources * For CPU and memory resource types, this parameter describes the amount of each resource that was * available on the container instance when the container agent registered it with Amazon ECS. This value * represents the total amount of CPU and memory that can be allocated on this container instance to * tasks. For port resource types, this parameter describes the ports that were reserved by the Amazon * ECS container agent when it registered the container instance with Amazon ECS. * @return Returns a reference to this object so that method calls can be chained together. */ Builder registeredResources(Collection registeredResources); /** *

* For CPU and memory resource types, this parameter describes the amount of each resource that was available on * the container instance when the container agent registered it with Amazon ECS. This value represents the * total amount of CPU and memory that can be allocated on this container instance to tasks. For port resource * types, this parameter describes the ports that were reserved by the Amazon ECS container agent when it * registered the container instance with Amazon ECS. *

* * @param registeredResources * For CPU and memory resource types, this parameter describes the amount of each resource that was * available on the container instance when the container agent registered it with Amazon ECS. This value * represents the total amount of CPU and memory that can be allocated on this container instance to * tasks. For port resource types, this parameter describes the ports that were reserved by the Amazon * ECS container agent when it registered the container instance with Amazon ECS. * @return Returns a reference to this object so that method calls can be chained together. */ Builder registeredResources(Resource... registeredResources); /** *

* For CPU and memory resource types, this parameter describes the amount of each resource that was available on * the container instance when the container agent registered it with Amazon ECS. This value represents the * total amount of CPU and memory that can be allocated on this container instance to tasks. For port resource * types, this parameter describes the ports that were reserved by the Amazon ECS container agent when it * registered the container instance with Amazon ECS. *

* 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 #registeredResources(List)}. * * @param registeredResources * 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 #registeredResources(List) */ Builder registeredResources(Consumer... registeredResources); /** *

* The status of the container instance. The valid values are REGISTERING, * REGISTRATION_FAILED, ACTIVE, INACTIVE, DEREGISTERING, or * DRAINING. *

*

* If your account has opted in to the awsvpcTrunking account setting, then any newly registered * container instance will transition to a REGISTERING status while the trunk elastic network * interface is provisioned for the instance. If the registration fails, the instance will transition to a * REGISTRATION_FAILED status. You can describe the container instance and see the reason for * failure in the statusReason parameter. Once the container instance is terminated, the instance * transitions to a DEREGISTERING status while the trunk elastic network interface is * deprovisioned. The instance then transitions to an INACTIVE status. *

*

* The ACTIVE status indicates that the container instance can accept tasks. The * DRAINING indicates that new tasks are not placed on the container instance and any service tasks * running on the container instance are removed if possible. For more information, see Container * Instance Draining in the Amazon Elastic Container Service Developer Guide. *

* * @param status * The status of the container instance. The valid values are REGISTERING, * REGISTRATION_FAILED, ACTIVE, INACTIVE, * DEREGISTERING, or DRAINING.

*

* If your account has opted in to the awsvpcTrunking account setting, then any newly * registered container instance will transition to a REGISTERING status while the trunk * elastic network interface is provisioned for the instance. If the registration fails, the instance * will transition to a REGISTRATION_FAILED status. You can describe the container instance * and see the reason for failure in the statusReason parameter. Once the container instance * is terminated, the instance transitions to a DEREGISTERING status while the trunk elastic * network interface is deprovisioned. The instance then transitions to an INACTIVE status. *

*

* The ACTIVE status indicates that the container instance can accept tasks. The * DRAINING indicates that new tasks are not placed on the container instance and any * service tasks running on the container instance are removed if possible. For more information, see * Container Instance Draining in the Amazon Elastic Container Service Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder status(String status); /** *

* The reason that the container instance reached its current status. *

* * @param statusReason * The reason that the container instance reached its current status. * @return Returns a reference to this object so that method calls can be chained together. */ Builder statusReason(String statusReason); /** *

* This parameter returns true if the agent is connected to Amazon ECS. Registered instances with * an agent that may be unhealthy or stopped return false. Only instances connected to an agent can * accept placement requests. *

* * @param agentConnected * This parameter returns true if the agent is connected to Amazon ECS. Registered instances * with an agent that may be unhealthy or stopped return false. Only instances connected to * an agent can accept placement requests. * @return Returns a reference to this object so that method calls can be chained together. */ Builder agentConnected(Boolean agentConnected); /** *

* The number of tasks on the container instance that are in the RUNNING status. *

* * @param runningTasksCount * The number of tasks on the container instance that are in the RUNNING status. * @return Returns a reference to this object so that method calls can be chained together. */ Builder runningTasksCount(Integer runningTasksCount); /** *

* The number of tasks on the container instance that are in the PENDING status. *

* * @param pendingTasksCount * The number of tasks on the container instance that are in the PENDING status. * @return Returns a reference to this object so that method calls can be chained together. */ Builder pendingTasksCount(Integer pendingTasksCount); /** *

* The status of the most recent agent update. If an update has never been requested, this value is * NULL. *

* * @param agentUpdateStatus * The status of the most recent agent update. If an update has never been requested, this value is * NULL. * @see AgentUpdateStatus * @return Returns a reference to this object so that method calls can be chained together. * @see AgentUpdateStatus */ Builder agentUpdateStatus(String agentUpdateStatus); /** *

* The status of the most recent agent update. If an update has never been requested, this value is * NULL. *

* * @param agentUpdateStatus * The status of the most recent agent update. If an update has never been requested, this value is * NULL. * @see AgentUpdateStatus * @return Returns a reference to this object so that method calls can be chained together. * @see AgentUpdateStatus */ Builder agentUpdateStatus(AgentUpdateStatus agentUpdateStatus); /** *

* The attributes set for the container instance, either by the Amazon ECS container agent at instance * registration or manually with the PutAttributes operation. *

* * @param attributes * The attributes set for the container instance, either by the Amazon ECS container agent at instance * registration or manually with the PutAttributes operation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder attributes(Collection attributes); /** *

* The attributes set for the container instance, either by the Amazon ECS container agent at instance * registration or manually with the PutAttributes operation. *

* * @param attributes * The attributes set for the container instance, either by the Amazon ECS container agent at instance * registration or manually with the PutAttributes operation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder attributes(Attribute... attributes); /** *

* The attributes set for the container instance, either by the Amazon ECS container agent at instance * registration or manually with the PutAttributes operation. *

* 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 #attributes(List)}. * * @param attributes * 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 #attributes(List) */ Builder attributes(Consumer... attributes); /** *

* The Unix timestamp for when the container instance was registered. *

* * @param registeredAt * The Unix timestamp for when the container instance was registered. * @return Returns a reference to this object so that method calls can be chained together. */ Builder registeredAt(Instant registeredAt); /** *

* The resources attached to a container instance, such as elastic network interfaces. *

* * @param attachments * The resources attached to a container instance, such as elastic network interfaces. * @return Returns a reference to this object so that method calls can be chained together. */ Builder attachments(Collection attachments); /** *

* The resources attached to a container instance, such as elastic network interfaces. *

* * @param attachments * The resources attached to a container instance, such as elastic network interfaces. * @return Returns a reference to this object so that method calls can be chained together. */ Builder attachments(Attachment... attachments); /** *

* The resources attached to a container instance, such as elastic network interfaces. *

* 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 #attachments(List)}. * * @param attachments * 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 #attachments(List) */ Builder attachments(Consumer... attachments); /** *

* The metadata that you apply to the container instance to help you categorize and organize them. Each tag * consists of a key and an optional value, both of which you define. Tag keys can have a maximum character * length of 128 characters, and tag values can have a maximum length of 256 characters. *

* * @param tags * The metadata that you apply to the container instance to help you categorize and organize them. Each * tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum * character length of 128 characters, and tag values can have a maximum length of 256 characters. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Collection tags); /** *

* The metadata that you apply to the container instance to help you categorize and organize them. Each tag * consists of a key and an optional value, both of which you define. Tag keys can have a maximum character * length of 128 characters, and tag values can have a maximum length of 256 characters. *

* * @param tags * The metadata that you apply to the container instance to help you categorize and organize them. Each * tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum * character length of 128 characters, and tag values can have a maximum length of 256 characters. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Tag... tags); /** *

* The metadata that you apply to the container instance to help you categorize and organize them. Each tag * consists of a key and an optional value, both of which you define. Tag keys can have a maximum character * length of 128 characters, and tag values can have a maximum length of 256 characters. *

* 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 #tags(List)}. * * @param tags * 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 #tags(List) */ Builder tags(Consumer... tags); } static final class BuilderImpl implements Builder { private String containerInstanceArn; private String ec2InstanceId; private Long version; private VersionInfo versionInfo; private List remainingResources = DefaultSdkAutoConstructList.getInstance(); private List registeredResources = DefaultSdkAutoConstructList.getInstance(); private String status; private String statusReason; private Boolean agentConnected; private Integer runningTasksCount; private Integer pendingTasksCount; private String agentUpdateStatus; private List attributes = DefaultSdkAutoConstructList.getInstance(); private Instant registeredAt; private List attachments = DefaultSdkAutoConstructList.getInstance(); private List tags = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(ContainerInstance model) { containerInstanceArn(model.containerInstanceArn); ec2InstanceId(model.ec2InstanceId); version(model.version); versionInfo(model.versionInfo); remainingResources(model.remainingResources); registeredResources(model.registeredResources); status(model.status); statusReason(model.statusReason); agentConnected(model.agentConnected); runningTasksCount(model.runningTasksCount); pendingTasksCount(model.pendingTasksCount); agentUpdateStatus(model.agentUpdateStatus); attributes(model.attributes); registeredAt(model.registeredAt); attachments(model.attachments); tags(model.tags); } public final String getContainerInstanceArn() { return containerInstanceArn; } @Override public final Builder containerInstanceArn(String containerInstanceArn) { this.containerInstanceArn = containerInstanceArn; return this; } public final void setContainerInstanceArn(String containerInstanceArn) { this.containerInstanceArn = containerInstanceArn; } public final String getEc2InstanceId() { return ec2InstanceId; } @Override public final Builder ec2InstanceId(String ec2InstanceId) { this.ec2InstanceId = ec2InstanceId; return this; } public final void setEc2InstanceId(String ec2InstanceId) { this.ec2InstanceId = ec2InstanceId; } public final Long getVersion() { return version; } @Override public final Builder version(Long version) { this.version = version; return this; } public final void setVersion(Long version) { this.version = version; } public final VersionInfo.Builder getVersionInfo() { return versionInfo != null ? versionInfo.toBuilder() : null; } @Override public final Builder versionInfo(VersionInfo versionInfo) { this.versionInfo = versionInfo; return this; } public final void setVersionInfo(VersionInfo.BuilderImpl versionInfo) { this.versionInfo = versionInfo != null ? versionInfo.build() : null; } public final Collection getRemainingResources() { return remainingResources != null ? remainingResources.stream().map(Resource::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder remainingResources(Collection remainingResources) { this.remainingResources = ResourcesCopier.copy(remainingResources); return this; } @Override @SafeVarargs public final Builder remainingResources(Resource... remainingResources) { remainingResources(Arrays.asList(remainingResources)); return this; } @Override @SafeVarargs public final Builder remainingResources(Consumer... remainingResources) { remainingResources(Stream.of(remainingResources).map(c -> Resource.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setRemainingResources(Collection remainingResources) { this.remainingResources = ResourcesCopier.copyFromBuilder(remainingResources); } public final Collection getRegisteredResources() { return registeredResources != null ? registeredResources.stream().map(Resource::toBuilder) .collect(Collectors.toList()) : null; } @Override public final Builder registeredResources(Collection registeredResources) { this.registeredResources = ResourcesCopier.copy(registeredResources); return this; } @Override @SafeVarargs public final Builder registeredResources(Resource... registeredResources) { registeredResources(Arrays.asList(registeredResources)); return this; } @Override @SafeVarargs public final Builder registeredResources(Consumer... registeredResources) { registeredResources(Stream.of(registeredResources).map(c -> Resource.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setRegisteredResources(Collection registeredResources) { this.registeredResources = ResourcesCopier.copyFromBuilder(registeredResources); } 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 String getStatusReason() { return statusReason; } @Override public final Builder statusReason(String statusReason) { this.statusReason = statusReason; return this; } public final void setStatusReason(String statusReason) { this.statusReason = statusReason; } public final Boolean getAgentConnected() { return agentConnected; } @Override public final Builder agentConnected(Boolean agentConnected) { this.agentConnected = agentConnected; return this; } public final void setAgentConnected(Boolean agentConnected) { this.agentConnected = agentConnected; } public final Integer getRunningTasksCount() { return runningTasksCount; } @Override public final Builder runningTasksCount(Integer runningTasksCount) { this.runningTasksCount = runningTasksCount; return this; } public final void setRunningTasksCount(Integer runningTasksCount) { this.runningTasksCount = runningTasksCount; } public final Integer getPendingTasksCount() { return pendingTasksCount; } @Override public final Builder pendingTasksCount(Integer pendingTasksCount) { this.pendingTasksCount = pendingTasksCount; return this; } public final void setPendingTasksCount(Integer pendingTasksCount) { this.pendingTasksCount = pendingTasksCount; } public final String getAgentUpdateStatusAsString() { return agentUpdateStatus; } @Override public final Builder agentUpdateStatus(String agentUpdateStatus) { this.agentUpdateStatus = agentUpdateStatus; return this; } @Override public final Builder agentUpdateStatus(AgentUpdateStatus agentUpdateStatus) { this.agentUpdateStatus(agentUpdateStatus.toString()); return this; } public final void setAgentUpdateStatus(String agentUpdateStatus) { this.agentUpdateStatus = agentUpdateStatus; } public final Collection getAttributes() { return attributes != null ? attributes.stream().map(Attribute::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder attributes(Collection attributes) { this.attributes = AttributesCopier.copy(attributes); return this; } @Override @SafeVarargs public final Builder attributes(Attribute... attributes) { attributes(Arrays.asList(attributes)); return this; } @Override @SafeVarargs public final Builder attributes(Consumer... attributes) { attributes(Stream.of(attributes).map(c -> Attribute.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setAttributes(Collection attributes) { this.attributes = AttributesCopier.copyFromBuilder(attributes); } public final Instant getRegisteredAt() { return registeredAt; } @Override public final Builder registeredAt(Instant registeredAt) { this.registeredAt = registeredAt; return this; } public final void setRegisteredAt(Instant registeredAt) { this.registeredAt = registeredAt; } public final Collection getAttachments() { return attachments != null ? attachments.stream().map(Attachment::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder attachments(Collection attachments) { this.attachments = AttachmentsCopier.copy(attachments); return this; } @Override @SafeVarargs public final Builder attachments(Attachment... attachments) { attachments(Arrays.asList(attachments)); return this; } @Override @SafeVarargs public final Builder attachments(Consumer... attachments) { attachments(Stream.of(attachments).map(c -> Attachment.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setAttachments(Collection attachments) { this.attachments = AttachmentsCopier.copyFromBuilder(attachments); } public final Collection getTags() { return tags != null ? tags.stream().map(Tag::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder tags(Collection tags) { this.tags = TagsCopier.copy(tags); return this; } @Override @SafeVarargs public final Builder tags(Tag... tags) { tags(Arrays.asList(tags)); return this; } @Override @SafeVarargs public final Builder tags(Consumer... tags) { tags(Stream.of(tags).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setTags(Collection tags) { this.tags = TagsCopier.copyFromBuilder(tags); } @Override public ContainerInstance build() { return new ContainerInstance(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy