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

software.amazon.awssdk.services.snowdevicemanagement.model.DescribeTaskResponse Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Snow Device Management module holds the client classes that are used for communicating with Snow Device Management.

There is a newer version: 2.28.4
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.snowdevicemanagement.model;

import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
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.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
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 DescribeTaskResponse extends SnowDeviceManagementResponse implements
        ToCopyableBuilder {
    private static final SdkField COMPLETED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
            .memberName("completedAt").getter(getter(DescribeTaskResponse::completedAt)).setter(setter(Builder::completedAt))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("completedAt").build()).build();

    private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
            .memberName("createdAt").getter(getter(DescribeTaskResponse::createdAt)).setter(setter(Builder::createdAt))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createdAt").build()).build();

    private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("description").getter(getter(DescribeTaskResponse::description)).setter(setter(Builder::description))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();

    private static final SdkField LAST_UPDATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
            .memberName("lastUpdatedAt").getter(getter(DescribeTaskResponse::lastUpdatedAt))
            .setter(setter(Builder::lastUpdatedAt))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastUpdatedAt").build()).build();

    private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("state")
            .getter(getter(DescribeTaskResponse::stateAsString)).setter(setter(Builder::state))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("state").build()).build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .memberName("tags")
            .getter(getter(DescribeTaskResponse::tags))
            .setter(setter(Builder::tags))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
                    MapTrait.builder()
                            .keyLocationName("key")
                            .valueLocationName("value")
                            .valueFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("value").build()).build()).build()).build();

    private static final SdkField> TARGETS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("targets")
            .getter(getter(DescribeTaskResponse::targets))
            .setter(setter(Builder::targets))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("targets").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField TASK_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("taskArn").getter(getter(DescribeTaskResponse::taskArn)).setter(setter(Builder::taskArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskArn").build()).build();

    private static final SdkField TASK_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("taskId")
            .getter(getter(DescribeTaskResponse::taskId)).setter(setter(Builder::taskId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskId").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(COMPLETED_AT_FIELD,
            CREATED_AT_FIELD, DESCRIPTION_FIELD, LAST_UPDATED_AT_FIELD, STATE_FIELD, TAGS_FIELD, TARGETS_FIELD, TASK_ARN_FIELD,
            TASK_ID_FIELD));

    private final Instant completedAt;

    private final Instant createdAt;

    private final String description;

    private final Instant lastUpdatedAt;

    private final String state;

    private final Map tags;

    private final List targets;

    private final String taskArn;

    private final String taskId;

    private DescribeTaskResponse(BuilderImpl builder) {
        super(builder);
        this.completedAt = builder.completedAt;
        this.createdAt = builder.createdAt;
        this.description = builder.description;
        this.lastUpdatedAt = builder.lastUpdatedAt;
        this.state = builder.state;
        this.tags = builder.tags;
        this.targets = builder.targets;
        this.taskArn = builder.taskArn;
        this.taskId = builder.taskId;
    }

    /**
     * 

* When the task was completed. *

* * @return When the task was completed. */ public final Instant completedAt() { return completedAt; } /** *

* When the CreateTask operation was called. *

* * @return When the CreateTask operation was called. */ public final Instant createdAt() { return createdAt; } /** *

* The description provided of the task and managed devices. *

* * @return The description provided of the task and managed devices. */ public final String description() { return description; } /** *

* When the state of the task was last updated. *

* * @return When the state of the task was last updated. */ public final Instant lastUpdatedAt() { return lastUpdatedAt; } /** *

* The current state of the task. *

*

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

* * @return The current state of the task. * @see TaskState */ public final TaskState state() { return TaskState.fromValue(state); } /** *

* The current state of the task. *

*

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

* * @return The current state of the task. * @see TaskState */ public final String stateAsString() { return state; } /** * 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 SdkAutoConstructMap); } /** *

* Optional metadata that you assign to a resource. You can use tags to categorize a resource in different ways, * such as by purpose, owner, or environment. *

*

* 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 Optional metadata that you assign to a resource. You can use tags to categorize a resource in different * ways, such as by purpose, owner, or environment. */ public final Map tags() { return tags; } /** * For responses, this returns true if the service returned a value for the Targets 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 hasTargets() { return targets != null && !(targets instanceof SdkAutoConstructList); } /** *

* The managed devices that the task was sent to. *

*

* 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 #hasTargets} method. *

* * @return The managed devices that the task was sent to. */ public final List targets() { return targets; } /** *

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

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

* The ID of the task. *

* * @return The ID of the task. */ public final String taskId() { return taskId; } @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(completedAt()); hashCode = 31 * hashCode + Objects.hashCode(createdAt()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedAt()); hashCode = 31 * hashCode + Objects.hashCode(stateAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); hashCode = 31 * hashCode + Objects.hashCode(hasTargets() ? targets() : null); hashCode = 31 * hashCode + Objects.hashCode(taskArn()); hashCode = 31 * hashCode + Objects.hashCode(taskId()); 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 DescribeTaskResponse)) { return false; } DescribeTaskResponse other = (DescribeTaskResponse) obj; return Objects.equals(completedAt(), other.completedAt()) && Objects.equals(createdAt(), other.createdAt()) && Objects.equals(description(), other.description()) && Objects.equals(lastUpdatedAt(), other.lastUpdatedAt()) && Objects.equals(stateAsString(), other.stateAsString()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()) && hasTargets() == other.hasTargets() && Objects.equals(targets(), other.targets()) && Objects.equals(taskArn(), other.taskArn()) && Objects.equals(taskId(), other.taskId()); } /** * 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("DescribeTaskResponse").add("CompletedAt", completedAt()).add("CreatedAt", createdAt()) .add("Description", description()).add("LastUpdatedAt", lastUpdatedAt()).add("State", stateAsString()) .add("Tags", hasTags() ? tags() : null).add("Targets", hasTargets() ? targets() : null).add("TaskArn", taskArn()) .add("TaskId", taskId()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "completedAt": return Optional.ofNullable(clazz.cast(completedAt())); case "createdAt": return Optional.ofNullable(clazz.cast(createdAt())); case "description": return Optional.ofNullable(clazz.cast(description())); case "lastUpdatedAt": return Optional.ofNullable(clazz.cast(lastUpdatedAt())); case "state": return Optional.ofNullable(clazz.cast(stateAsString())); case "tags": return Optional.ofNullable(clazz.cast(tags())); case "targets": return Optional.ofNullable(clazz.cast(targets())); case "taskArn": return Optional.ofNullable(clazz.cast(taskArn())); case "taskId": return Optional.ofNullable(clazz.cast(taskId())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((DescribeTaskResponse) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SnowDeviceManagementResponse.Builder, SdkPojo, CopyableBuilder { /** *

* When the task was completed. *

* * @param completedAt * When the task was completed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder completedAt(Instant completedAt); /** *

* When the CreateTask operation was called. *

* * @param createdAt * When the CreateTask operation was called. * @return Returns a reference to this object so that method calls can be chained together. */ Builder createdAt(Instant createdAt); /** *

* The description provided of the task and managed devices. *

* * @param description * The description provided of the task and managed devices. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* When the state of the task was last updated. *

* * @param lastUpdatedAt * When the state of the task was last updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastUpdatedAt(Instant lastUpdatedAt); /** *

* The current state of the task. *

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

* The current state of the task. *

* * @param state * The current state of the task. * @see TaskState * @return Returns a reference to this object so that method calls can be chained together. * @see TaskState */ Builder state(TaskState state); /** *

* Optional metadata that you assign to a resource. You can use tags to categorize a resource in different ways, * such as by purpose, owner, or environment. *

* * @param tags * Optional metadata that you assign to a resource. You can use tags to categorize a resource in * different ways, such as by purpose, owner, or environment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Map tags); /** *

* The managed devices that the task was sent to. *

* * @param targets * The managed devices that the task was sent to. * @return Returns a reference to this object so that method calls can be chained together. */ Builder targets(Collection targets); /** *

* The managed devices that the task was sent to. *

* * @param targets * The managed devices that the task was sent to. * @return Returns a reference to this object so that method calls can be chained together. */ Builder targets(String... targets); /** *

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

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

* The ID of the task. *

* * @param taskId * The ID of the task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder taskId(String taskId); } static final class BuilderImpl extends SnowDeviceManagementResponse.BuilderImpl implements Builder { private Instant completedAt; private Instant createdAt; private String description; private Instant lastUpdatedAt; private String state; private Map tags = DefaultSdkAutoConstructMap.getInstance(); private List targets = DefaultSdkAutoConstructList.getInstance(); private String taskArn; private String taskId; private BuilderImpl() { } private BuilderImpl(DescribeTaskResponse model) { super(model); completedAt(model.completedAt); createdAt(model.createdAt); description(model.description); lastUpdatedAt(model.lastUpdatedAt); state(model.state); tags(model.tags); targets(model.targets); taskArn(model.taskArn); taskId(model.taskId); } public final Instant getCompletedAt() { return completedAt; } public final void setCompletedAt(Instant completedAt) { this.completedAt = completedAt; } @Override public final Builder completedAt(Instant completedAt) { this.completedAt = completedAt; return this; } public final Instant getCreatedAt() { return createdAt; } public final void setCreatedAt(Instant createdAt) { this.createdAt = createdAt; } @Override public final Builder createdAt(Instant createdAt) { this.createdAt = createdAt; return this; } public final String getDescription() { return description; } public final void setDescription(String description) { this.description = description; } @Override public final Builder description(String description) { this.description = description; return this; } public final Instant getLastUpdatedAt() { return lastUpdatedAt; } public final void setLastUpdatedAt(Instant lastUpdatedAt) { this.lastUpdatedAt = lastUpdatedAt; } @Override public final Builder lastUpdatedAt(Instant lastUpdatedAt) { this.lastUpdatedAt = lastUpdatedAt; return this; } public final String getState() { return state; } public final void setState(String state) { this.state = state; } @Override public final Builder state(String state) { this.state = state; return this; } @Override public final Builder state(TaskState state) { this.state(state == null ? null : state.toString()); return this; } public final Map getTags() { if (tags instanceof SdkAutoConstructMap) { return null; } return tags; } public final void setTags(Map tags) { this.tags = TagMapCopier.copy(tags); } @Override public final Builder tags(Map tags) { this.tags = TagMapCopier.copy(tags); return this; } public final Collection getTargets() { if (targets instanceof SdkAutoConstructList) { return null; } return targets; } public final void setTargets(Collection targets) { this.targets = TargetListCopier.copy(targets); } @Override public final Builder targets(Collection targets) { this.targets = TargetListCopier.copy(targets); return this; } @Override @SafeVarargs public final Builder targets(String... targets) { targets(Arrays.asList(targets)); return this; } public final String getTaskArn() { return taskArn; } public final void setTaskArn(String taskArn) { this.taskArn = taskArn; } @Override public final Builder taskArn(String taskArn) { this.taskArn = taskArn; return this; } public final String getTaskId() { return taskId; } public final void setTaskId(String taskId) { this.taskId = taskId; } @Override public final Builder taskId(String taskId) { this.taskId = taskId; return this; } @Override public DescribeTaskResponse build() { return new DescribeTaskResponse(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy