software.amazon.awssdk.services.emr.model.NotebookExecution Maven / Gradle / Ivy
Show all versions of emr 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.emr.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;
/**
*
* A notebook execution. An execution is a specific instance that an EMR Notebook is run using the
* StartNotebookExecution
action.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class NotebookExecution implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField NOTEBOOK_EXECUTION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(NotebookExecution::notebookExecutionId)).setter(setter(Builder::notebookExecutionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NotebookExecutionId").build())
.build();
private static final SdkField EDITOR_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(NotebookExecution::editorId)).setter(setter(Builder::editorId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EditorId").build()).build();
private static final SdkField EXECUTION_ENGINE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(NotebookExecution::executionEngine))
.setter(setter(Builder::executionEngine)).constructor(ExecutionEngineConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExecutionEngine").build()).build();
private static final SdkField NOTEBOOK_EXECUTION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(NotebookExecution::notebookExecutionName)).setter(setter(Builder::notebookExecutionName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NotebookExecutionName").build())
.build();
private static final SdkField NOTEBOOK_PARAMS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(NotebookExecution::notebookParams)).setter(setter(Builder::notebookParams))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NotebookParams").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(NotebookExecution::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(NotebookExecution::startTime)).setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartTime").build()).build();
private static final SdkField END_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(NotebookExecution::endTime)).setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndTime").build()).build();
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(NotebookExecution::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build();
private static final SdkField OUTPUT_NOTEBOOK_URI_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(NotebookExecution::outputNotebookURI)).setter(setter(Builder::outputNotebookURI))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutputNotebookURI").build()).build();
private static final SdkField LAST_STATE_CHANGE_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(NotebookExecution::lastStateChangeReason)).setter(setter(Builder::lastStateChangeReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastStateChangeReason").build())
.build();
private static final SdkField NOTEBOOK_INSTANCE_SECURITY_GROUP_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.getter(getter(NotebookExecution::notebookInstanceSecurityGroupId))
.setter(setter(Builder::notebookInstanceSecurityGroupId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NotebookInstanceSecurityGroupId")
.build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(NotebookExecution::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(NOTEBOOK_EXECUTION_ID_FIELD,
EDITOR_ID_FIELD, EXECUTION_ENGINE_FIELD, NOTEBOOK_EXECUTION_NAME_FIELD, NOTEBOOK_PARAMS_FIELD, STATUS_FIELD,
START_TIME_FIELD, END_TIME_FIELD, ARN_FIELD, OUTPUT_NOTEBOOK_URI_FIELD, LAST_STATE_CHANGE_REASON_FIELD,
NOTEBOOK_INSTANCE_SECURITY_GROUP_ID_FIELD, TAGS_FIELD));
private static final long serialVersionUID = 1L;
private final String notebookExecutionId;
private final String editorId;
private final ExecutionEngineConfig executionEngine;
private final String notebookExecutionName;
private final String notebookParams;
private final String status;
private final Instant startTime;
private final Instant endTime;
private final String arn;
private final String outputNotebookURI;
private final String lastStateChangeReason;
private final String notebookInstanceSecurityGroupId;
private final List tags;
private NotebookExecution(BuilderImpl builder) {
this.notebookExecutionId = builder.notebookExecutionId;
this.editorId = builder.editorId;
this.executionEngine = builder.executionEngine;
this.notebookExecutionName = builder.notebookExecutionName;
this.notebookParams = builder.notebookParams;
this.status = builder.status;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
this.arn = builder.arn;
this.outputNotebookURI = builder.outputNotebookURI;
this.lastStateChangeReason = builder.lastStateChangeReason;
this.notebookInstanceSecurityGroupId = builder.notebookInstanceSecurityGroupId;
this.tags = builder.tags;
}
/**
*
* The unique identifier of a notebook execution.
*
*
* @return The unique identifier of a notebook execution.
*/
public String notebookExecutionId() {
return notebookExecutionId;
}
/**
*
* The unique identifier of the EMR Notebook that is used for the notebook execution.
*
*
* @return The unique identifier of the EMR Notebook that is used for the notebook execution.
*/
public String editorId() {
return editorId;
}
/**
*
* The execution engine, such as an EMR cluster, used to run the EMR notebook and perform the notebook execution.
*
*
* @return The execution engine, such as an EMR cluster, used to run the EMR notebook and perform the notebook
* execution.
*/
public ExecutionEngineConfig executionEngine() {
return executionEngine;
}
/**
*
* A name for the notebook execution.
*
*
* @return A name for the notebook execution.
*/
public String notebookExecutionName() {
return notebookExecutionName;
}
/**
*
* Input parameters in JSON format passed to the EMR Notebook at runtime for execution.
*
*
* @return Input parameters in JSON format passed to the EMR Notebook at runtime for execution.
*/
public String notebookParams() {
return notebookParams;
}
/**
*
* The status of the notebook execution.
*
*
* -
*
* START_PENDING
indicates that the cluster has received the execution request but execution has not
* begun.
*
*
* -
*
* STARTING
indicates that the execution is starting on the cluster.
*
*
* -
*
* RUNNING
indicates that the execution is being processed by the cluster.
*
*
* -
*
* FINISHING
indicates that execution processing is in the final stages.
*
*
* -
*
* FINISHED
indicates that the execution has completed without error.
*
*
* -
*
* FAILING
indicates that the execution is failing and will not finish successfully.
*
*
* -
*
* FAILED
indicates that the execution failed.
*
*
* -
*
* STOP_PENDING
indicates that the cluster has received a StopNotebookExecution
request
* and the stop is pending.
*
*
* -
*
* STOPPING
indicates that the cluster is in the process of stopping the execution as a result of a
* StopNotebookExecution
request.
*
*
* -
*
* STOPPED
indicates that the execution stopped because of a StopNotebookExecution
* request.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link NotebookExecutionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the notebook execution.
*
* -
*
* START_PENDING
indicates that the cluster has received the execution request but execution
* has not begun.
*
*
* -
*
* STARTING
indicates that the execution is starting on the cluster.
*
*
* -
*
* RUNNING
indicates that the execution is being processed by the cluster.
*
*
* -
*
* FINISHING
indicates that execution processing is in the final stages.
*
*
* -
*
* FINISHED
indicates that the execution has completed without error.
*
*
* -
*
* FAILING
indicates that the execution is failing and will not finish successfully.
*
*
* -
*
* FAILED
indicates that the execution failed.
*
*
* -
*
* STOP_PENDING
indicates that the cluster has received a StopNotebookExecution
* request and the stop is pending.
*
*
* -
*
* STOPPING
indicates that the cluster is in the process of stopping the execution as a result
* of a StopNotebookExecution
request.
*
*
* -
*
* STOPPED
indicates that the execution stopped because of a StopNotebookExecution
* request.
*
*
* @see NotebookExecutionStatus
*/
public NotebookExecutionStatus status() {
return NotebookExecutionStatus.fromValue(status);
}
/**
*
* The status of the notebook execution.
*
*
* -
*
* START_PENDING
indicates that the cluster has received the execution request but execution has not
* begun.
*
*
* -
*
* STARTING
indicates that the execution is starting on the cluster.
*
*
* -
*
* RUNNING
indicates that the execution is being processed by the cluster.
*
*
* -
*
* FINISHING
indicates that execution processing is in the final stages.
*
*
* -
*
* FINISHED
indicates that the execution has completed without error.
*
*
* -
*
* FAILING
indicates that the execution is failing and will not finish successfully.
*
*
* -
*
* FAILED
indicates that the execution failed.
*
*
* -
*
* STOP_PENDING
indicates that the cluster has received a StopNotebookExecution
request
* and the stop is pending.
*
*
* -
*
* STOPPING
indicates that the cluster is in the process of stopping the execution as a result of a
* StopNotebookExecution
request.
*
*
* -
*
* STOPPED
indicates that the execution stopped because of a StopNotebookExecution
* request.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link NotebookExecutionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the notebook execution.
*
* -
*
* START_PENDING
indicates that the cluster has received the execution request but execution
* has not begun.
*
*
* -
*
* STARTING
indicates that the execution is starting on the cluster.
*
*
* -
*
* RUNNING
indicates that the execution is being processed by the cluster.
*
*
* -
*
* FINISHING
indicates that execution processing is in the final stages.
*
*
* -
*
* FINISHED
indicates that the execution has completed without error.
*
*
* -
*
* FAILING
indicates that the execution is failing and will not finish successfully.
*
*
* -
*
* FAILED
indicates that the execution failed.
*
*
* -
*
* STOP_PENDING
indicates that the cluster has received a StopNotebookExecution
* request and the stop is pending.
*
*
* -
*
* STOPPING
indicates that the cluster is in the process of stopping the execution as a result
* of a StopNotebookExecution
request.
*
*
* -
*
* STOPPED
indicates that the execution stopped because of a StopNotebookExecution
* request.
*
*
* @see NotebookExecutionStatus
*/
public String statusAsString() {
return status;
}
/**
*
* The timestamp when notebook execution started.
*
*
* @return The timestamp when notebook execution started.
*/
public Instant startTime() {
return startTime;
}
/**
*
* The timestamp when notebook execution ended.
*
*
* @return The timestamp when notebook execution ended.
*/
public Instant endTime() {
return endTime;
}
/**
*
* The Amazon Resource Name (ARN) of the notebook execution.
*
*
* @return The Amazon Resource Name (ARN) of the notebook execution.
*/
public String arn() {
return arn;
}
/**
*
* The location of the notebook execution's output file in Amazon S3.
*
*
* @return The location of the notebook execution's output file in Amazon S3.
*/
public String outputNotebookURI() {
return outputNotebookURI;
}
/**
*
* The reason for the latest status change of the notebook execution.
*
*
* @return The reason for the latest status change of the notebook execution.
*/
public String lastStateChangeReason() {
return lastStateChangeReason;
}
/**
*
* The unique identifier of the EC2 security group associated with the EMR Notebook instance. For more information
* see
* Specifying EC2 Security Groups for EMR Notebooks in the EMR Management Guide.
*
*
* @return The unique identifier of the EC2 security group associated with the EMR Notebook instance. For more
* information see Specifying EC2 Security Groups for EMR Notebooks in the EMR Management Guide.
*/
public String notebookInstanceSecurityGroupId() {
return notebookInstanceSecurityGroupId;
}
/**
* Returns true if the Tags property was specified by the sender (it may be empty), or false if the sender did not
* specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* A list of tags associated with a notebook execution. Tags are user-defined key value pairs that consist of a
* required key string with a maximum of 128 characters and an optional value string with a maximum of 256
* characters.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasTags()} to see if a value was sent in this field.
*
*
* @return A list of tags associated with a notebook execution. Tags are user-defined key value pairs that consist
* of a required key string with a maximum of 128 characters and an optional value string with a maximum 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 extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(notebookExecutionId());
hashCode = 31 * hashCode + Objects.hashCode(editorId());
hashCode = 31 * hashCode + Objects.hashCode(executionEngine());
hashCode = 31 * hashCode + Objects.hashCode(notebookExecutionName());
hashCode = 31 * hashCode + Objects.hashCode(notebookParams());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(outputNotebookURI());
hashCode = 31 * hashCode + Objects.hashCode(lastStateChangeReason());
hashCode = 31 * hashCode + Objects.hashCode(notebookInstanceSecurityGroupId());
hashCode = 31 * hashCode + Objects.hashCode(tags());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof NotebookExecution)) {
return false;
}
NotebookExecution other = (NotebookExecution) obj;
return Objects.equals(notebookExecutionId(), other.notebookExecutionId()) && Objects.equals(editorId(), other.editorId())
&& Objects.equals(executionEngine(), other.executionEngine())
&& Objects.equals(notebookExecutionName(), other.notebookExecutionName())
&& Objects.equals(notebookParams(), other.notebookParams())
&& Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(startTime(), other.startTime())
&& Objects.equals(endTime(), other.endTime()) && Objects.equals(arn(), other.arn())
&& Objects.equals(outputNotebookURI(), other.outputNotebookURI())
&& Objects.equals(lastStateChangeReason(), other.lastStateChangeReason())
&& Objects.equals(notebookInstanceSecurityGroupId(), other.notebookInstanceSecurityGroupId())
&& 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("NotebookExecution").add("NotebookExecutionId", notebookExecutionId())
.add("EditorId", editorId()).add("ExecutionEngine", executionEngine())
.add("NotebookExecutionName", notebookExecutionName()).add("NotebookParams", notebookParams())
.add("Status", statusAsString()).add("StartTime", startTime()).add("EndTime", endTime()).add("Arn", arn())
.add("OutputNotebookURI", outputNotebookURI()).add("LastStateChangeReason", lastStateChangeReason())
.add("NotebookInstanceSecurityGroupId", notebookInstanceSecurityGroupId()).add("Tags", tags()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "NotebookExecutionId":
return Optional.ofNullable(clazz.cast(notebookExecutionId()));
case "EditorId":
return Optional.ofNullable(clazz.cast(editorId()));
case "ExecutionEngine":
return Optional.ofNullable(clazz.cast(executionEngine()));
case "NotebookExecutionName":
return Optional.ofNullable(clazz.cast(notebookExecutionName()));
case "NotebookParams":
return Optional.ofNullable(clazz.cast(notebookParams()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "StartTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "EndTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "Arn":
return Optional.ofNullable(clazz.cast(arn()));
case "OutputNotebookURI":
return Optional.ofNullable(clazz.cast(outputNotebookURI()));
case "LastStateChangeReason":
return Optional.ofNullable(clazz.cast(lastStateChangeReason()));
case "NotebookInstanceSecurityGroupId":
return Optional.ofNullable(clazz.cast(notebookInstanceSecurityGroupId()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function