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

software.amazon.awssdk.services.guardduty.model.EcsTaskDetails Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon GuardDuty module holds the client classes that are used for communicating with Amazon GuardDuty Service

There is a newer version: 2.28.3
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.guardduty.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.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Contains information about the task in an ECS cluster. *

*/ @Generated("software.amazon.awssdk:codegen") public final class EcsTaskDetails implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn") .getter(getter(EcsTaskDetails::arn)).setter(setter(Builder::arn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build(); private static final SdkField DEFINITION_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("DefinitionArn").getter(getter(EcsTaskDetails::definitionArn)).setter(setter(Builder::definitionArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("definitionArn").build()).build(); private static final SdkField VERSION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Version") .getter(getter(EcsTaskDetails::version)).setter(setter(Builder::version)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("version").build()).build(); private static final SdkField TASK_CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("TaskCreatedAt").getter(getter(EcsTaskDetails::taskCreatedAt)).setter(setter(Builder::taskCreatedAt)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createdAt").build()).build(); private static final SdkField STARTED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("StartedAt").getter(getter(EcsTaskDetails::startedAt)).setter(setter(Builder::startedAt)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startedAt").build()).build(); private static final SdkField STARTED_BY_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("StartedBy").getter(getter(EcsTaskDetails::startedBy)).setter(setter(Builder::startedBy)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startedBy").build()).build(); private static final SdkField> TAGS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Tags") .getter(getter(EcsTaskDetails::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 SdkField> VOLUMES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Volumes") .getter(getter(EcsTaskDetails::volumes)) .setter(setter(Builder::volumes)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("volumes").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Volume::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> CONTAINERS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Containers") .getter(getter(EcsTaskDetails::containers)) .setter(setter(Builder::containers)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("containers").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Container::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField GROUP_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Group") .getter(getter(EcsTaskDetails::group)).setter(setter(Builder::group)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("group").build()).build(); private static final SdkField LAUNCH_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("LaunchType").getter(getter(EcsTaskDetails::launchType)).setter(setter(Builder::launchType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("launchType").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, DEFINITION_ARN_FIELD, VERSION_FIELD, TASK_CREATED_AT_FIELD, STARTED_AT_FIELD, STARTED_BY_FIELD, TAGS_FIELD, VOLUMES_FIELD, CONTAINERS_FIELD, GROUP_FIELD, LAUNCH_TYPE_FIELD)); private static final long serialVersionUID = 1L; private final String arn; private final String definitionArn; private final String version; private final Instant taskCreatedAt; private final Instant startedAt; private final String startedBy; private final List tags; private final List volumes; private final List containers; private final String group; private final String launchType; private EcsTaskDetails(BuilderImpl builder) { this.arn = builder.arn; this.definitionArn = builder.definitionArn; this.version = builder.version; this.taskCreatedAt = builder.taskCreatedAt; this.startedAt = builder.startedAt; this.startedBy = builder.startedBy; this.tags = builder.tags; this.volumes = builder.volumes; this.containers = builder.containers; this.group = builder.group; this.launchType = builder.launchType; } /** *

* The Amazon Resource Name (ARN) of the task. *

* * @return The Amazon Resource Name (ARN) of the task. */ public final String arn() { return arn; } /** *

* The ARN of the task definition that creates the task. *

* * @return The ARN of the task definition that creates the task. */ public final String definitionArn() { return definitionArn; } /** *

* The version counter for the task. *

* * @return The version counter for the task. */ public final String version() { return version; } /** *

* The Unix timestamp for the time when the task was created. *

* * @return The Unix timestamp for the time when the task was created. */ public final Instant taskCreatedAt() { return taskCreatedAt; } /** *

* The Unix timestamp for the time when the task started. *

* * @return The Unix timestamp for the time when the task started. */ public final Instant startedAt() { return startedAt; } /** *

* Contains the tag specified when a task is started. *

* * @return Contains the tag specified when a task is started. */ public final String startedBy() { return startedBy; } /** * For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that * the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful * because the SDK will never return a null collection or map, but you may need to differentiate between the service * returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true * if a value for the property was specified in the request builder, and false if a value was not specified. */ public final boolean hasTags() { return tags != null && !(tags instanceof SdkAutoConstructList); } /** *

* The tags of the ECS Task. *

*

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

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasTags} method. *

* * @return The tags of the ECS Task. */ public final List tags() { return tags; } /** * For responses, this returns true if the service returned a value for the Volumes property. This DOES NOT check * that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is * useful because the SDK will never return a null collection or map, but you may need to differentiate between the * service returning nothing (or null) and the service returning an empty collection or map. For requests, this * returns true if a value for the property was specified in the request builder, and false if a value was not * specified. */ public final boolean hasVolumes() { return volumes != null && !(volumes instanceof SdkAutoConstructList); } /** *

* The list of data volume definitions for the task. *

*

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

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasVolumes} method. *

* * @return The list of data volume definitions for the task. */ public final List volumes() { return volumes; } /** * For responses, this returns true if the service returned a value for the Containers property. This DOES NOT check * that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is * useful because the SDK will never return a null collection or map, but you may need to differentiate between the * service returning nothing (or null) and the service returning an empty collection or map. For requests, this * returns true if a value for the property was specified in the request builder, and false if a value was not * specified. */ public final boolean hasContainers() { return containers != null && !(containers instanceof SdkAutoConstructList); } /** *

* The containers that's associated with the task. *

*

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

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasContainers} method. *

* * @return The containers that's associated with the task. */ public final List containers() { return containers; } /** *

* The name of the task group that's associated with the task. *

* * @return The name of the task group that's associated with the task. */ public final String group() { return group; } /** *

* A capacity on which the task is running. For example, Fargate and EC2. *

* * @return A capacity on which the task is running. For example, Fargate and EC2. */ public final String launchType() { return launchType; } @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 + Objects.hashCode(arn()); hashCode = 31 * hashCode + Objects.hashCode(definitionArn()); hashCode = 31 * hashCode + Objects.hashCode(version()); hashCode = 31 * hashCode + Objects.hashCode(taskCreatedAt()); hashCode = 31 * hashCode + Objects.hashCode(startedAt()); hashCode = 31 * hashCode + Objects.hashCode(startedBy()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); hashCode = 31 * hashCode + Objects.hashCode(hasVolumes() ? volumes() : null); hashCode = 31 * hashCode + Objects.hashCode(hasContainers() ? containers() : null); hashCode = 31 * hashCode + Objects.hashCode(group()); hashCode = 31 * hashCode + Objects.hashCode(launchType()); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof EcsTaskDetails)) { return false; } EcsTaskDetails other = (EcsTaskDetails) obj; return Objects.equals(arn(), other.arn()) && Objects.equals(definitionArn(), other.definitionArn()) && Objects.equals(version(), other.version()) && Objects.equals(taskCreatedAt(), other.taskCreatedAt()) && Objects.equals(startedAt(), other.startedAt()) && Objects.equals(startedBy(), other.startedBy()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()) && hasVolumes() == other.hasVolumes() && Objects.equals(volumes(), other.volumes()) && hasContainers() == other.hasContainers() && Objects.equals(containers(), other.containers()) && Objects.equals(group(), other.group()) && Objects.equals(launchType(), other.launchType()); } /** * 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("EcsTaskDetails").add("Arn", arn()).add("DefinitionArn", definitionArn()) .add("Version", version()).add("TaskCreatedAt", taskCreatedAt()).add("StartedAt", startedAt()) .add("StartedBy", startedBy()).add("Tags", hasTags() ? tags() : null) .add("Volumes", hasVolumes() ? volumes() : null).add("Containers", hasContainers() ? containers() : null) .add("Group", group()).add("LaunchType", launchType()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Arn": return Optional.ofNullable(clazz.cast(arn())); case "DefinitionArn": return Optional.ofNullable(clazz.cast(definitionArn())); case "Version": return Optional.ofNullable(clazz.cast(version())); case "TaskCreatedAt": return Optional.ofNullable(clazz.cast(taskCreatedAt())); case "StartedAt": return Optional.ofNullable(clazz.cast(startedAt())); case "StartedBy": return Optional.ofNullable(clazz.cast(startedBy())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); case "Volumes": return Optional.ofNullable(clazz.cast(volumes())); case "Containers": return Optional.ofNullable(clazz.cast(containers())); case "Group": return Optional.ofNullable(clazz.cast(group())); case "LaunchType": return Optional.ofNullable(clazz.cast(launchType())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((EcsTaskDetails) 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 task. *

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

* The ARN of the task definition that creates the task. *

* * @param definitionArn * The ARN of the task definition that creates the task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder definitionArn(String definitionArn); /** *

* The version counter for the task. *

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

* The Unix timestamp for the time when the task was created. *

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

* The Unix timestamp for the time when the task started. *

* * @param startedAt * The Unix timestamp for the time when the task started. * @return Returns a reference to this object so that method calls can be chained together. */ Builder startedAt(Instant startedAt); /** *

* Contains the tag specified when a task is started. *

* * @param startedBy * Contains the tag specified when a task is started. * @return Returns a reference to this object so that method calls can be chained together. */ Builder startedBy(String startedBy); /** *

* The tags of the ECS Task. *

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

* The tags of the ECS Task. *

* * @param tags * The tags of the ECS Task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Tag... tags); /** *

* The tags of the ECS Task. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.guardduty.model.Tag.Builder} avoiding the need to create one manually * via {@link software.amazon.awssdk.services.guardduty.model.Tag#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.guardduty.model.Tag.Builder#build()} is called immediately and its * result is passed to {@link #tags(List)}. * * @param tags * a consumer that will call methods on * {@link software.amazon.awssdk.services.guardduty.model.Tag.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tags(java.util.Collection) */ Builder tags(Consumer... tags); /** *

* The list of data volume definitions for the task. *

* * @param volumes * The list of data volume definitions for the task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder volumes(Collection volumes); /** *

* The list of data volume definitions for the task. *

* * @param volumes * The list of data volume definitions for the task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder volumes(Volume... volumes); /** *

* The list of data volume definitions for the task. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.guardduty.model.Volume.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.guardduty.model.Volume#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.guardduty.model.Volume.Builder#build()} is called immediately and its * result is passed to {@link #volumes(List)}. * * @param volumes * a consumer that will call methods on * {@link software.amazon.awssdk.services.guardduty.model.Volume.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #volumes(java.util.Collection) */ Builder volumes(Consumer... volumes); /** *

* The containers that's associated with the task. *

* * @param containers * The containers that's associated with the task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder containers(Collection containers); /** *

* The containers that's associated with the task. *

* * @param containers * The containers that's associated with the task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder containers(Container... containers); /** *

* The containers that's associated with the task. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.guardduty.model.Container.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.guardduty.model.Container#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.guardduty.model.Container.Builder#build()} is called immediately and * its result is passed to {@link #containers(List)}. * * @param containers * a consumer that will call methods on * {@link software.amazon.awssdk.services.guardduty.model.Container.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #containers(java.util.Collection) */ Builder containers(Consumer... containers); /** *

* The name of the task group that's associated with the task. *

* * @param group * The name of the task group that's associated with the task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder group(String group); /** *

* A capacity on which the task is running. For example, Fargate and EC2. *

* * @param launchType * A capacity on which the task is running. For example, Fargate and EC2. * @return Returns a reference to this object so that method calls can be chained together. */ Builder launchType(String launchType); } static final class BuilderImpl implements Builder { private String arn; private String definitionArn; private String version; private Instant taskCreatedAt; private Instant startedAt; private String startedBy; private List tags = DefaultSdkAutoConstructList.getInstance(); private List volumes = DefaultSdkAutoConstructList.getInstance(); private List containers = DefaultSdkAutoConstructList.getInstance(); private String group; private String launchType; private BuilderImpl() { } private BuilderImpl(EcsTaskDetails model) { arn(model.arn); definitionArn(model.definitionArn); version(model.version); taskCreatedAt(model.taskCreatedAt); startedAt(model.startedAt); startedBy(model.startedBy); tags(model.tags); volumes(model.volumes); containers(model.containers); group(model.group); launchType(model.launchType); } public final String getArn() { return arn; } public final void setArn(String arn) { this.arn = arn; } @Override public final Builder arn(String arn) { this.arn = arn; return this; } public final String getDefinitionArn() { return definitionArn; } public final void setDefinitionArn(String definitionArn) { this.definitionArn = definitionArn; } @Override public final Builder definitionArn(String definitionArn) { this.definitionArn = definitionArn; return this; } public final String getVersion() { return version; } public final void setVersion(String version) { this.version = version; } @Override public final Builder version(String version) { this.version = version; return this; } public final Instant getTaskCreatedAt() { return taskCreatedAt; } public final void setTaskCreatedAt(Instant taskCreatedAt) { this.taskCreatedAt = taskCreatedAt; } @Override public final Builder taskCreatedAt(Instant taskCreatedAt) { this.taskCreatedAt = taskCreatedAt; return this; } public final Instant getStartedAt() { return startedAt; } public final void setStartedAt(Instant startedAt) { this.startedAt = startedAt; } @Override public final Builder startedAt(Instant startedAt) { this.startedAt = startedAt; return this; } public final String getStartedBy() { return startedBy; } public final void setStartedBy(String startedBy) { this.startedBy = startedBy; } @Override public final Builder startedBy(String startedBy) { this.startedBy = startedBy; return this; } public final List getTags() { List result = TagsCopier.copyToBuilder(this.tags); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setTags(Collection tags) { this.tags = TagsCopier.copyFromBuilder(tags); } @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 List getVolumes() { List result = VolumesCopier.copyToBuilder(this.volumes); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setVolumes(Collection volumes) { this.volumes = VolumesCopier.copyFromBuilder(volumes); } @Override public final Builder volumes(Collection volumes) { this.volumes = VolumesCopier.copy(volumes); return this; } @Override @SafeVarargs public final Builder volumes(Volume... volumes) { volumes(Arrays.asList(volumes)); return this; } @Override @SafeVarargs public final Builder volumes(Consumer... volumes) { volumes(Stream.of(volumes).map(c -> Volume.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final List getContainers() { List result = ContainersCopier.copyToBuilder(this.containers); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setContainers(Collection containers) { this.containers = ContainersCopier.copyFromBuilder(containers); } @Override public final Builder containers(Collection containers) { this.containers = ContainersCopier.copy(containers); return this; } @Override @SafeVarargs public final Builder containers(Container... containers) { containers(Arrays.asList(containers)); return this; } @Override @SafeVarargs public final Builder containers(Consumer... containers) { containers(Stream.of(containers).map(c -> Container.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final String getGroup() { return group; } public final void setGroup(String group) { this.group = group; } @Override public final Builder group(String group) { this.group = group; return this; } public final String getLaunchType() { return launchType; } public final void setLaunchType(String launchType) { this.launchType = launchType; } @Override public final Builder launchType(String launchType) { this.launchType = launchType; return this; } @Override public EcsTaskDetails build() { return new EcsTaskDetails(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy