software.amazon.awssdk.services.deadline.model.GetSessionActionResponse Maven / Gradle / Ivy
Show all versions of deadline Show documentation
/*
* 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 extends Builder> 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