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

software.amazon.awssdk.services.deadline.model.GetSessionActionResponse Maven / Gradle / Ivy

Go to download

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

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.deadline.model;

import java.time.Instant;
import java.util.Arrays;
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 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.LocationTrait;
import software.amazon.awssdk.core.traits.TimestampFormatTrait;
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 GetSessionActionResponse extends DeadlineResponse implements
        ToCopyableBuilder {
    private static final SdkField SESSION_ACTION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("sessionActionId").getter(getter(GetSessionActionResponse::sessionActionId))
            .setter(setter(Builder::sessionActionId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sessionActionId").build()).build();

    private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
            .getter(getter(GetSessionActionResponse::statusAsString)).setter(setter(Builder::status))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();

    private static final SdkField STARTED_AT_FIELD = SdkField
            . builder(MarshallingType.INSTANT)
            .memberName("startedAt")
            .getter(getter(GetSessionActionResponse::startedAt))
            .setter(setter(Builder::startedAt))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startedAt").build(),
                    TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();

    private static final SdkField ENDED_AT_FIELD = SdkField
            . builder(MarshallingType.INSTANT)
            .memberName("endedAt")
            .getter(getter(GetSessionActionResponse::endedAt))
            .setter(setter(Builder::endedAt))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("endedAt").build(),
                    TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();

    private static final SdkField WORKER_UPDATED_AT_FIELD = SdkField
            . builder(MarshallingType.INSTANT)
            .memberName("workerUpdatedAt")
            .getter(getter(GetSessionActionResponse::workerUpdatedAt))
            .setter(setter(Builder::workerUpdatedAt))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("workerUpdatedAt").build(),
                    TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();

    private static final SdkField PROGRESS_PERCENT_FIELD = SdkField. builder(MarshallingType.FLOAT)
            .memberName("progressPercent").getter(getter(GetSessionActionResponse::progressPercent))
            .setter(setter(Builder::progressPercent))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("progressPercent").build()).build();

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

    private static final SdkField PROCESS_EXIT_CODE_FIELD = SdkField. builder(MarshallingType.INTEGER)
            .memberName("processExitCode").getter(getter(GetSessionActionResponse::processExitCode))
            .setter(setter(Builder::processExitCode))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("processExitCode").build()).build();

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

    private static final SdkField DEFINITION_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("definition")
            .getter(getter(GetSessionActionResponse::definition)).setter(setter(Builder::definition))
            .constructor(SessionActionDefinition::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("definition").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SESSION_ACTION_ID_FIELD,
            STATUS_FIELD, STARTED_AT_FIELD, ENDED_AT_FIELD, WORKER_UPDATED_AT_FIELD, PROGRESS_PERCENT_FIELD, SESSION_ID_FIELD,
            PROCESS_EXIT_CODE_FIELD, PROGRESS_MESSAGE_FIELD, DEFINITION_FIELD));

    private final String sessionActionId;

    private final String status;

    private final Instant startedAt;

    private final Instant endedAt;

    private final Instant workerUpdatedAt;

    private final Float progressPercent;

    private final String sessionId;

    private final Integer processExitCode;

    private final String progressMessage;

    private final SessionActionDefinition definition;

    private GetSessionActionResponse(BuilderImpl builder) {
        super(builder);
        this.sessionActionId = builder.sessionActionId;
        this.status = builder.status;
        this.startedAt = builder.startedAt;
        this.endedAt = builder.endedAt;
        this.workerUpdatedAt = builder.workerUpdatedAt;
        this.progressPercent = builder.progressPercent;
        this.sessionId = builder.sessionId;
        this.processExitCode = builder.processExitCode;
        this.progressMessage = builder.progressMessage;
        this.definition = builder.definition;
    }

    /**
     * 

* The session action ID. *

* * @return The session action ID. */ public final String sessionActionId() { return sessionActionId; } /** *

* The status of the session action. *

*

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

* * @return The status of the session action. * @see SessionActionStatus */ public final SessionActionStatus status() { return SessionActionStatus.fromValue(status); } /** *

* The status of the session action. *

*

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

* * @return The status of the session action. * @see SessionActionStatus */ public final String statusAsString() { return status; } /** *

* The date and time the resource started running. *

* * @return The date and time the resource started running. */ public final Instant startedAt() { return startedAt; } /** *

* The date and time the resource ended running. *

* * @return The date and time the resource ended running. */ public final Instant endedAt() { return endedAt; } /** *

* The Linux timestamp of the date and time the session action was last updated. *

* * @return The Linux timestamp of the date and time the session action was last updated. */ public final Instant workerUpdatedAt() { return workerUpdatedAt; } /** *

* The percentage completed for a session action. *

* * @return The percentage completed for a session action. */ public final Float progressPercent() { return progressPercent; } /** *

* The session ID for the session action. *

* * @return The session ID for the session action. */ public final String sessionId() { return sessionId; } /** *

* The exit code to exit the session. *

* * @return The exit code to exit the session. */ public final Integer processExitCode() { return processExitCode; } /** *

* The message that communicates the progress of the session action. *

* * @return The message that communicates the progress of the session action. */ public final String progressMessage() { return progressMessage; } /** *

* The session action definition. *

* * @return The session action definition. */ public final SessionActionDefinition definition() { return definition; } @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(sessionActionId()); hashCode = 31 * hashCode + Objects.hashCode(statusAsString()); hashCode = 31 * hashCode + Objects.hashCode(startedAt()); hashCode = 31 * hashCode + Objects.hashCode(endedAt()); hashCode = 31 * hashCode + Objects.hashCode(workerUpdatedAt()); hashCode = 31 * hashCode + Objects.hashCode(progressPercent()); hashCode = 31 * hashCode + Objects.hashCode(sessionId()); hashCode = 31 * hashCode + Objects.hashCode(processExitCode()); hashCode = 31 * hashCode + Objects.hashCode(progressMessage()); hashCode = 31 * hashCode + Objects.hashCode(definition()); 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 GetSessionActionResponse)) { return false; } GetSessionActionResponse other = (GetSessionActionResponse) obj; return Objects.equals(sessionActionId(), other.sessionActionId()) && Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(startedAt(), other.startedAt()) && Objects.equals(endedAt(), other.endedAt()) && Objects.equals(workerUpdatedAt(), other.workerUpdatedAt()) && Objects.equals(progressPercent(), other.progressPercent()) && Objects.equals(sessionId(), other.sessionId()) && Objects.equals(processExitCode(), other.processExitCode()) && Objects.equals(progressMessage(), other.progressMessage()) && Objects.equals(definition(), other.definition()); } /** * 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("GetSessionActionResponse").add("SessionActionId", sessionActionId()) .add("Status", statusAsString()).add("StartedAt", startedAt()).add("EndedAt", endedAt()) .add("WorkerUpdatedAt", workerUpdatedAt()).add("ProgressPercent", progressPercent()) .add("SessionId", sessionId()).add("ProcessExitCode", processExitCode()) .add("ProgressMessage", progressMessage() == null ? null : "*** Sensitive Data Redacted ***") .add("Definition", definition()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "sessionActionId": return Optional.ofNullable(clazz.cast(sessionActionId())); case "status": return Optional.ofNullable(clazz.cast(statusAsString())); case "startedAt": return Optional.ofNullable(clazz.cast(startedAt())); case "endedAt": return Optional.ofNullable(clazz.cast(endedAt())); case "workerUpdatedAt": return Optional.ofNullable(clazz.cast(workerUpdatedAt())); case "progressPercent": return Optional.ofNullable(clazz.cast(progressPercent())); case "sessionId": return Optional.ofNullable(clazz.cast(sessionId())); case "processExitCode": return Optional.ofNullable(clazz.cast(processExitCode())); case "progressMessage": return Optional.ofNullable(clazz.cast(progressMessage())); case "definition": return Optional.ofNullable(clazz.cast(definition())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((GetSessionActionResponse) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends DeadlineResponse.Builder, SdkPojo, CopyableBuilder { /** *

* The session action ID. *

* * @param sessionActionId * The session action ID. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sessionActionId(String sessionActionId); /** *

* The status of the session action. *

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

* The status of the session action. *

* * @param status * The status of the session action. * @see SessionActionStatus * @return Returns a reference to this object so that method calls can be chained together. * @see SessionActionStatus */ Builder status(SessionActionStatus status); /** *

* The date and time the resource started running. *

* * @param startedAt * The date and time the resource started running. * @return Returns a reference to this object so that method calls can be chained together. */ Builder startedAt(Instant startedAt); /** *

* The date and time the resource ended running. *

* * @param endedAt * The date and time the resource ended running. * @return Returns a reference to this object so that method calls can be chained together. */ Builder endedAt(Instant endedAt); /** *

* The Linux timestamp of the date and time the session action was last updated. *

* * @param workerUpdatedAt * The Linux timestamp of the date and time the session action was last updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder workerUpdatedAt(Instant workerUpdatedAt); /** *

* The percentage completed for a session action. *

* * @param progressPercent * The percentage completed for a session action. * @return Returns a reference to this object so that method calls can be chained together. */ Builder progressPercent(Float progressPercent); /** *

* The session ID for the session action. *

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

* The exit code to exit the session. *

* * @param processExitCode * The exit code to exit the session. * @return Returns a reference to this object so that method calls can be chained together. */ Builder processExitCode(Integer processExitCode); /** *

* The message that communicates the progress of the session action. *

* * @param progressMessage * The message that communicates the progress of the session action. * @return Returns a reference to this object so that method calls can be chained together. */ Builder progressMessage(String progressMessage); /** *

* The session action definition. *

* * @param definition * The session action definition. * @return Returns a reference to this object so that method calls can be chained together. */ Builder definition(SessionActionDefinition definition); /** *

* The session action definition. *

* This is a convenience method that creates an instance of the {@link SessionActionDefinition.Builder} avoiding * the need to create one manually via {@link SessionActionDefinition#builder()}. * *

* When the {@link Consumer} completes, {@link SessionActionDefinition.Builder#build()} is called immediately * and its result is passed to {@link #definition(SessionActionDefinition)}. * * @param definition * a consumer that will call methods on {@link SessionActionDefinition.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #definition(SessionActionDefinition) */ default Builder definition(Consumer definition) { return definition(SessionActionDefinition.builder().applyMutation(definition).build()); } } static final class BuilderImpl extends DeadlineResponse.BuilderImpl implements Builder { private String sessionActionId; private String status; private Instant startedAt; private Instant endedAt; private Instant workerUpdatedAt; private Float progressPercent; private String sessionId; private Integer processExitCode; private String progressMessage; private SessionActionDefinition definition; private BuilderImpl() { } private BuilderImpl(GetSessionActionResponse model) { super(model); sessionActionId(model.sessionActionId); status(model.status); startedAt(model.startedAt); endedAt(model.endedAt); workerUpdatedAt(model.workerUpdatedAt); progressPercent(model.progressPercent); sessionId(model.sessionId); processExitCode(model.processExitCode); progressMessage(model.progressMessage); definition(model.definition); } public final String getSessionActionId() { return sessionActionId; } public final void setSessionActionId(String sessionActionId) { this.sessionActionId = sessionActionId; } @Override public final Builder sessionActionId(String sessionActionId) { this.sessionActionId = sessionActionId; return this; } public final String getStatus() { return status; } public final void setStatus(String status) { this.status = status; } @Override public final Builder status(String status) { this.status = status; return this; } @Override public final Builder status(SessionActionStatus status) { this.status(status == null ? null : status.toString()); 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 Instant getEndedAt() { return endedAt; } public final void setEndedAt(Instant endedAt) { this.endedAt = endedAt; } @Override public final Builder endedAt(Instant endedAt) { this.endedAt = endedAt; return this; } public final Instant getWorkerUpdatedAt() { return workerUpdatedAt; } public final void setWorkerUpdatedAt(Instant workerUpdatedAt) { this.workerUpdatedAt = workerUpdatedAt; } @Override public final Builder workerUpdatedAt(Instant workerUpdatedAt) { this.workerUpdatedAt = workerUpdatedAt; return this; } public final Float getProgressPercent() { return progressPercent; } public final void setProgressPercent(Float progressPercent) { this.progressPercent = progressPercent; } @Override public final Builder progressPercent(Float progressPercent) { this.progressPercent = progressPercent; return this; } public final String getSessionId() { return sessionId; } public final void setSessionId(String sessionId) { this.sessionId = sessionId; } @Override public final Builder sessionId(String sessionId) { this.sessionId = sessionId; return this; } public final Integer getProcessExitCode() { return processExitCode; } public final void setProcessExitCode(Integer processExitCode) { this.processExitCode = processExitCode; } @Override public final Builder processExitCode(Integer processExitCode) { this.processExitCode = processExitCode; return this; } public final String getProgressMessage() { return progressMessage; } public final void setProgressMessage(String progressMessage) { this.progressMessage = progressMessage; } @Override public final Builder progressMessage(String progressMessage) { this.progressMessage = progressMessage; return this; } public final SessionActionDefinition.Builder getDefinition() { return definition != null ? definition.toBuilder() : null; } public final void setDefinition(SessionActionDefinition.BuilderImpl definition) { this.definition = definition != null ? definition.build() : null; } @Override public final Builder definition(SessionActionDefinition definition) { this.definition = definition; return this; } @Override public GetSessionActionResponse build() { return new GetSessionActionResponse(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy