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

software.amazon.awssdk.services.emr.model.StepConfig Maven / Gradle / Ivy

Go to download

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

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

import java.io.Serializable;
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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Specification for a cluster (job flow) step. *

*/ @Generated("software.amazon.awssdk:codegen") public final class StepConfig implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name") .getter(getter(StepConfig::name)).setter(setter(Builder::name)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build(); private static final SdkField ACTION_ON_FAILURE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ActionOnFailure").getter(getter(StepConfig::actionOnFailureAsString)) .setter(setter(Builder::actionOnFailure)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActionOnFailure").build()).build(); private static final SdkField HADOOP_JAR_STEP_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("HadoopJarStep") .getter(getter(StepConfig::hadoopJarStep)).setter(setter(Builder::hadoopJarStep)) .constructor(HadoopJarStepConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HadoopJarStep").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, ACTION_ON_FAILURE_FIELD, HADOOP_JAR_STEP_FIELD)); private static final long serialVersionUID = 1L; private final String name; private final String actionOnFailure; private final HadoopJarStepConfig hadoopJarStep; private StepConfig(BuilderImpl builder) { this.name = builder.name; this.actionOnFailure = builder.actionOnFailure; this.hadoopJarStep = builder.hadoopJarStep; } /** *

* The name of the step. *

* * @return The name of the step. */ public final String name() { return name; } /** *

* The action to take when the step fails. Use one of the following values: *

*
    *
  • *

    * TERMINATE_CLUSTER - Shuts down the cluster. *

    *
  • *
  • *

    * CANCEL_AND_WAIT - Cancels any pending steps and returns the cluster to the WAITING * state. *

    *
  • *
  • *

    * CONTINUE - Continues to the next step in the queue. *

    *
  • *
  • *

    * TERMINATE_JOB_FLOW - Shuts down the cluster. TERMINATE_JOB_FLOW is provided for * backward compatibility. We recommend using TERMINATE_CLUSTER instead. *

    *
  • *
*

* If a cluster's StepConcurrencyLevel is greater than 1, do not use * AddJobFlowSteps to submit a step with this parameter set to CANCEL_AND_WAIT or * TERMINATE_CLUSTER. The step is not submitted and the action fails with a message that the * ActionOnFailure setting is not valid. *

*

* If you change a cluster's StepConcurrencyLevel to be greater than 1 while a step is running, the * ActionOnFailure parameter may not behave as you expect. In this case, for a step that fails with * this parameter set to CANCEL_AND_WAIT, pending steps and the running step are not canceled; for a * step that fails with this parameter set to TERMINATE_CLUSTER, the cluster does not terminate. *

*

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

* * @return The action to take when the step fails. Use one of the following values:

*
    *
  • *

    * TERMINATE_CLUSTER - Shuts down the cluster. *

    *
  • *
  • *

    * CANCEL_AND_WAIT - Cancels any pending steps and returns the cluster to the * WAITING state. *

    *
  • *
  • *

    * CONTINUE - Continues to the next step in the queue. *

    *
  • *
  • *

    * TERMINATE_JOB_FLOW - Shuts down the cluster. TERMINATE_JOB_FLOW is provided for * backward compatibility. We recommend using TERMINATE_CLUSTER instead. *

    *
  • *
*

* If a cluster's StepConcurrencyLevel is greater than 1, do not use * AddJobFlowSteps to submit a step with this parameter set to CANCEL_AND_WAIT or * TERMINATE_CLUSTER. The step is not submitted and the action fails with a message that the * ActionOnFailure setting is not valid. *

*

* If you change a cluster's StepConcurrencyLevel to be greater than 1 while a step is running, * the ActionOnFailure parameter may not behave as you expect. In this case, for a step that * fails with this parameter set to CANCEL_AND_WAIT, pending steps and the running step are not * canceled; for a step that fails with this parameter set to TERMINATE_CLUSTER, the cluster * does not terminate. * @see ActionOnFailure */ public final ActionOnFailure actionOnFailure() { return ActionOnFailure.fromValue(actionOnFailure); } /** *

* The action to take when the step fails. Use one of the following values: *

*
    *
  • *

    * TERMINATE_CLUSTER - Shuts down the cluster. *

    *
  • *
  • *

    * CANCEL_AND_WAIT - Cancels any pending steps and returns the cluster to the WAITING * state. *

    *
  • *
  • *

    * CONTINUE - Continues to the next step in the queue. *

    *
  • *
  • *

    * TERMINATE_JOB_FLOW - Shuts down the cluster. TERMINATE_JOB_FLOW is provided for * backward compatibility. We recommend using TERMINATE_CLUSTER instead. *

    *
  • *
*

* If a cluster's StepConcurrencyLevel is greater than 1, do not use * AddJobFlowSteps to submit a step with this parameter set to CANCEL_AND_WAIT or * TERMINATE_CLUSTER. The step is not submitted and the action fails with a message that the * ActionOnFailure setting is not valid. *

*

* If you change a cluster's StepConcurrencyLevel to be greater than 1 while a step is running, the * ActionOnFailure parameter may not behave as you expect. In this case, for a step that fails with * this parameter set to CANCEL_AND_WAIT, pending steps and the running step are not canceled; for a * step that fails with this parameter set to TERMINATE_CLUSTER, the cluster does not terminate. *

*

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

* * @return The action to take when the step fails. Use one of the following values:

*
    *
  • *

    * TERMINATE_CLUSTER - Shuts down the cluster. *

    *
  • *
  • *

    * CANCEL_AND_WAIT - Cancels any pending steps and returns the cluster to the * WAITING state. *

    *
  • *
  • *

    * CONTINUE - Continues to the next step in the queue. *

    *
  • *
  • *

    * TERMINATE_JOB_FLOW - Shuts down the cluster. TERMINATE_JOB_FLOW is provided for * backward compatibility. We recommend using TERMINATE_CLUSTER instead. *

    *
  • *
*

* If a cluster's StepConcurrencyLevel is greater than 1, do not use * AddJobFlowSteps to submit a step with this parameter set to CANCEL_AND_WAIT or * TERMINATE_CLUSTER. The step is not submitted and the action fails with a message that the * ActionOnFailure setting is not valid. *

*

* If you change a cluster's StepConcurrencyLevel to be greater than 1 while a step is running, * the ActionOnFailure parameter may not behave as you expect. In this case, for a step that * fails with this parameter set to CANCEL_AND_WAIT, pending steps and the running step are not * canceled; for a step that fails with this parameter set to TERMINATE_CLUSTER, the cluster * does not terminate. * @see ActionOnFailure */ public final String actionOnFailureAsString() { return actionOnFailure; } /** *

* The JAR file used for the step. *

* * @return The JAR file used for the step. */ public final HadoopJarStepConfig hadoopJarStep() { return hadoopJarStep; } @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(name()); hashCode = 31 * hashCode + Objects.hashCode(actionOnFailureAsString()); hashCode = 31 * hashCode + Objects.hashCode(hadoopJarStep()); 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 StepConfig)) { return false; } StepConfig other = (StepConfig) obj; return Objects.equals(name(), other.name()) && Objects.equals(actionOnFailureAsString(), other.actionOnFailureAsString()) && Objects.equals(hadoopJarStep(), other.hadoopJarStep()); } /** * 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("StepConfig").add("Name", name()).add("ActionOnFailure", actionOnFailureAsString()) .add("HadoopJarStep", hadoopJarStep()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Name": return Optional.ofNullable(clazz.cast(name())); case "ActionOnFailure": return Optional.ofNullable(clazz.cast(actionOnFailureAsString())); case "HadoopJarStep": return Optional.ofNullable(clazz.cast(hadoopJarStep())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((StepConfig) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the step. *

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

* The action to take when the step fails. Use one of the following values: *

*
    *
  • *

    * TERMINATE_CLUSTER - Shuts down the cluster. *

    *
  • *
  • *

    * CANCEL_AND_WAIT - Cancels any pending steps and returns the cluster to the WAITING * state. *

    *
  • *
  • *

    * CONTINUE - Continues to the next step in the queue. *

    *
  • *
  • *

    * TERMINATE_JOB_FLOW - Shuts down the cluster. TERMINATE_JOB_FLOW is provided for * backward compatibility. We recommend using TERMINATE_CLUSTER instead. *

    *
  • *
*

* If a cluster's StepConcurrencyLevel is greater than 1, do not use * AddJobFlowSteps to submit a step with this parameter set to CANCEL_AND_WAIT or * TERMINATE_CLUSTER. The step is not submitted and the action fails with a message that the * ActionOnFailure setting is not valid. *

*

* If you change a cluster's StepConcurrencyLevel to be greater than 1 while a step is running, the * ActionOnFailure parameter may not behave as you expect. In this case, for a step that fails with * this parameter set to CANCEL_AND_WAIT, pending steps and the running step are not canceled; for * a step that fails with this parameter set to TERMINATE_CLUSTER, the cluster does not terminate. *

* * @param actionOnFailure * The action to take when the step fails. Use one of the following values:

*
    *
  • *

    * TERMINATE_CLUSTER - Shuts down the cluster. *

    *
  • *
  • *

    * CANCEL_AND_WAIT - Cancels any pending steps and returns the cluster to the * WAITING state. *

    *
  • *
  • *

    * CONTINUE - Continues to the next step in the queue. *

    *
  • *
  • *

    * TERMINATE_JOB_FLOW - Shuts down the cluster. TERMINATE_JOB_FLOW is provided * for backward compatibility. We recommend using TERMINATE_CLUSTER instead. *

    *
  • *
*

* If a cluster's StepConcurrencyLevel is greater than 1, do not use * AddJobFlowSteps to submit a step with this parameter set to CANCEL_AND_WAIT * or TERMINATE_CLUSTER. The step is not submitted and the action fails with a message that * the ActionOnFailure setting is not valid. *

*

* If you change a cluster's StepConcurrencyLevel to be greater than 1 while a step is * running, the ActionOnFailure parameter may not behave as you expect. In this case, for a * step that fails with this parameter set to CANCEL_AND_WAIT, pending steps and the running * step are not canceled; for a step that fails with this parameter set to TERMINATE_CLUSTER * , the cluster does not terminate. * @see ActionOnFailure * @return Returns a reference to this object so that method calls can be chained together. * @see ActionOnFailure */ Builder actionOnFailure(String actionOnFailure); /** *

* The action to take when the step fails. Use one of the following values: *

*
    *
  • *

    * TERMINATE_CLUSTER - Shuts down the cluster. *

    *
  • *
  • *

    * CANCEL_AND_WAIT - Cancels any pending steps and returns the cluster to the WAITING * state. *

    *
  • *
  • *

    * CONTINUE - Continues to the next step in the queue. *

    *
  • *
  • *

    * TERMINATE_JOB_FLOW - Shuts down the cluster. TERMINATE_JOB_FLOW is provided for * backward compatibility. We recommend using TERMINATE_CLUSTER instead. *

    *
  • *
*

* If a cluster's StepConcurrencyLevel is greater than 1, do not use * AddJobFlowSteps to submit a step with this parameter set to CANCEL_AND_WAIT or * TERMINATE_CLUSTER. The step is not submitted and the action fails with a message that the * ActionOnFailure setting is not valid. *

*

* If you change a cluster's StepConcurrencyLevel to be greater than 1 while a step is running, the * ActionOnFailure parameter may not behave as you expect. In this case, for a step that fails with * this parameter set to CANCEL_AND_WAIT, pending steps and the running step are not canceled; for * a step that fails with this parameter set to TERMINATE_CLUSTER, the cluster does not terminate. *

* * @param actionOnFailure * The action to take when the step fails. Use one of the following values:

*
    *
  • *

    * TERMINATE_CLUSTER - Shuts down the cluster. *

    *
  • *
  • *

    * CANCEL_AND_WAIT - Cancels any pending steps and returns the cluster to the * WAITING state. *

    *
  • *
  • *

    * CONTINUE - Continues to the next step in the queue. *

    *
  • *
  • *

    * TERMINATE_JOB_FLOW - Shuts down the cluster. TERMINATE_JOB_FLOW is provided * for backward compatibility. We recommend using TERMINATE_CLUSTER instead. *

    *
  • *
*

* If a cluster's StepConcurrencyLevel is greater than 1, do not use * AddJobFlowSteps to submit a step with this parameter set to CANCEL_AND_WAIT * or TERMINATE_CLUSTER. The step is not submitted and the action fails with a message that * the ActionOnFailure setting is not valid. *

*

* If you change a cluster's StepConcurrencyLevel to be greater than 1 while a step is * running, the ActionOnFailure parameter may not behave as you expect. In this case, for a * step that fails with this parameter set to CANCEL_AND_WAIT, pending steps and the running * step are not canceled; for a step that fails with this parameter set to TERMINATE_CLUSTER * , the cluster does not terminate. * @see ActionOnFailure * @return Returns a reference to this object so that method calls can be chained together. * @see ActionOnFailure */ Builder actionOnFailure(ActionOnFailure actionOnFailure); /** *

* The JAR file used for the step. *

* * @param hadoopJarStep * The JAR file used for the step. * @return Returns a reference to this object so that method calls can be chained together. */ Builder hadoopJarStep(HadoopJarStepConfig hadoopJarStep); /** *

* The JAR file used for the step. *

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

* When the {@link Consumer} completes, {@link HadoopJarStepConfig.Builder#build()} is called immediately and * its result is passed to {@link #hadoopJarStep(HadoopJarStepConfig)}. * * @param hadoopJarStep * a consumer that will call methods on {@link HadoopJarStepConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #hadoopJarStep(HadoopJarStepConfig) */ default Builder hadoopJarStep(Consumer hadoopJarStep) { return hadoopJarStep(HadoopJarStepConfig.builder().applyMutation(hadoopJarStep).build()); } } static final class BuilderImpl implements Builder { private String name; private String actionOnFailure; private HadoopJarStepConfig hadoopJarStep; private BuilderImpl() { } private BuilderImpl(StepConfig model) { name(model.name); actionOnFailure(model.actionOnFailure); hadoopJarStep(model.hadoopJarStep); } public final String getName() { return name; } public final void setName(String name) { this.name = name; } @Override public final Builder name(String name) { this.name = name; return this; } public final String getActionOnFailure() { return actionOnFailure; } public final void setActionOnFailure(String actionOnFailure) { this.actionOnFailure = actionOnFailure; } @Override public final Builder actionOnFailure(String actionOnFailure) { this.actionOnFailure = actionOnFailure; return this; } @Override public final Builder actionOnFailure(ActionOnFailure actionOnFailure) { this.actionOnFailure(actionOnFailure == null ? null : actionOnFailure.toString()); return this; } public final HadoopJarStepConfig.Builder getHadoopJarStep() { return hadoopJarStep != null ? hadoopJarStep.toBuilder() : null; } public final void setHadoopJarStep(HadoopJarStepConfig.BuilderImpl hadoopJarStep) { this.hadoopJarStep = hadoopJarStep != null ? hadoopJarStep.build() : null; } @Override public final Builder hadoopJarStep(HadoopJarStepConfig hadoopJarStep) { this.hadoopJarStep = hadoopJarStep; return this; } @Override public StepConfig build() { return new StepConfig(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy