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

software.amazon.awssdk.services.emr.model.StepSummary 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;

/**
 * 

* The summary of the cluster step. *

*/ @Generated("software.amazon.awssdk:codegen") public final class StepSummary implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(StepSummary::id)).setter(setter(Builder::id)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build(); private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(StepSummary::name)).setter(setter(Builder::name)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build(); private static final SdkField CONFIG_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .getter(getter(StepSummary::config)).setter(setter(Builder::config)).constructor(HadoopStepConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Config").build()).build(); private static final SdkField ACTION_ON_FAILURE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(StepSummary::actionOnFailureAsString)).setter(setter(Builder::actionOnFailure)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActionOnFailure").build()).build(); private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .getter(getter(StepSummary::status)).setter(setter(Builder::status)).constructor(StepStatus::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, NAME_FIELD, CONFIG_FIELD, ACTION_ON_FAILURE_FIELD, STATUS_FIELD)); private static final long serialVersionUID = 1L; private final String id; private final String name; private final HadoopStepConfig config; private final String actionOnFailure; private final StepStatus status; private StepSummary(BuilderImpl builder) { this.id = builder.id; this.name = builder.name; this.config = builder.config; this.actionOnFailure = builder.actionOnFailure; this.status = builder.status; } /** *

* The identifier of the cluster step. *

* * @return The identifier of the cluster step. */ public String id() { return id; } /** *

* The name of the cluster step. *

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

* The Hadoop job configuration of the cluster step. *

* * @return The Hadoop job configuration of the cluster step. */ public HadoopStepConfig config() { return config; } /** *

* The action to take when the cluster step fails. Possible values are TERMINATE_CLUSTER, CANCEL_AND_WAIT, and * CONTINUE. TERMINATE_JOB_FLOW is available for backward compatibility. We recommend using TERMINATE_CLUSTER * instead. *

*

* 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 cluster step fails. Possible values are TERMINATE_CLUSTER, CANCEL_AND_WAIT, * and CONTINUE. TERMINATE_JOB_FLOW is available for backward compatibility. We recommend using * TERMINATE_CLUSTER instead. * @see ActionOnFailure */ public ActionOnFailure actionOnFailure() { return ActionOnFailure.fromValue(actionOnFailure); } /** *

* The action to take when the cluster step fails. Possible values are TERMINATE_CLUSTER, CANCEL_AND_WAIT, and * CONTINUE. TERMINATE_JOB_FLOW is available for backward compatibility. We recommend using TERMINATE_CLUSTER * instead. *

*

* 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 cluster step fails. Possible values are TERMINATE_CLUSTER, CANCEL_AND_WAIT, * and CONTINUE. TERMINATE_JOB_FLOW is available for backward compatibility. We recommend using * TERMINATE_CLUSTER instead. * @see ActionOnFailure */ public String actionOnFailureAsString() { return actionOnFailure; } /** *

* The current execution status details of the cluster step. *

* * @return The current execution status details of the cluster step. */ public StepStatus status() { return status; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(id()); hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(config()); hashCode = 31 * hashCode + Objects.hashCode(actionOnFailureAsString()); hashCode = 31 * hashCode + Objects.hashCode(status()); 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 StepSummary)) { return false; } StepSummary other = (StepSummary) obj; return Objects.equals(id(), other.id()) && Objects.equals(name(), other.name()) && Objects.equals(config(), other.config()) && Objects.equals(actionOnFailureAsString(), other.actionOnFailureAsString()) && Objects.equals(status(), other.status()); } /** * 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("StepSummary").add("Id", id()).add("Name", name()).add("Config", config()) .add("ActionOnFailure", actionOnFailureAsString()).add("Status", status()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Id": return Optional.ofNullable(clazz.cast(id())); case "Name": return Optional.ofNullable(clazz.cast(name())); case "Config": return Optional.ofNullable(clazz.cast(config())); case "ActionOnFailure": return Optional.ofNullable(clazz.cast(actionOnFailureAsString())); case "Status": return Optional.ofNullable(clazz.cast(status())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((StepSummary) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The identifier of the cluster step. *

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

* The name of the cluster step. *

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

* The Hadoop job configuration of the cluster step. *

* * @param config * The Hadoop job configuration of the cluster step. * @return Returns a reference to this object so that method calls can be chained together. */ Builder config(HadoopStepConfig config); /** *

* The Hadoop job configuration of the cluster step. *

* This is a convenience that creates an instance of the {@link HadoopStepConfig.Builder} avoiding the need to * create one manually via {@link HadoopStepConfig#builder()}. * * When the {@link Consumer} completes, {@link HadoopStepConfig.Builder#build()} is called immediately and its * result is passed to {@link #config(HadoopStepConfig)}. * * @param config * a consumer that will call methods on {@link HadoopStepConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #config(HadoopStepConfig) */ default Builder config(Consumer config) { return config(HadoopStepConfig.builder().applyMutation(config).build()); } /** *

* The action to take when the cluster step fails. Possible values are TERMINATE_CLUSTER, CANCEL_AND_WAIT, and * CONTINUE. TERMINATE_JOB_FLOW is available for backward compatibility. We recommend using TERMINATE_CLUSTER * instead. *

* * @param actionOnFailure * The action to take when the cluster step fails. Possible values are TERMINATE_CLUSTER, * CANCEL_AND_WAIT, and CONTINUE. TERMINATE_JOB_FLOW is available for backward compatibility. We * recommend using TERMINATE_CLUSTER instead. * @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 cluster step fails. Possible values are TERMINATE_CLUSTER, CANCEL_AND_WAIT, and * CONTINUE. TERMINATE_JOB_FLOW is available for backward compatibility. We recommend using TERMINATE_CLUSTER * instead. *

* * @param actionOnFailure * The action to take when the cluster step fails. Possible values are TERMINATE_CLUSTER, * CANCEL_AND_WAIT, and CONTINUE. TERMINATE_JOB_FLOW is available for backward compatibility. We * recommend using TERMINATE_CLUSTER instead. * @see ActionOnFailure * @return Returns a reference to this object so that method calls can be chained together. * @see ActionOnFailure */ Builder actionOnFailure(ActionOnFailure actionOnFailure); /** *

* The current execution status details of the cluster step. *

* * @param status * The current execution status details of the cluster step. * @return Returns a reference to this object so that method calls can be chained together. */ Builder status(StepStatus status); /** *

* The current execution status details of the cluster step. *

* This is a convenience that creates an instance of the {@link StepStatus.Builder} avoiding the need to create * one manually via {@link StepStatus#builder()}. * * When the {@link Consumer} completes, {@link StepStatus.Builder#build()} is called immediately and its result * is passed to {@link #status(StepStatus)}. * * @param status * a consumer that will call methods on {@link StepStatus.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #status(StepStatus) */ default Builder status(Consumer status) { return status(StepStatus.builder().applyMutation(status).build()); } } static final class BuilderImpl implements Builder { private String id; private String name; private HadoopStepConfig config; private String actionOnFailure; private StepStatus status; private BuilderImpl() { } private BuilderImpl(StepSummary model) { id(model.id); name(model.name); config(model.config); actionOnFailure(model.actionOnFailure); status(model.status); } public final String getId() { return id; } @Override public final Builder id(String id) { this.id = id; return this; } public final void setId(String id) { this.id = id; } public final String getName() { return name; } @Override public final Builder name(String name) { this.name = name; return this; } public final void setName(String name) { this.name = name; } public final HadoopStepConfig.Builder getConfig() { return config != null ? config.toBuilder() : null; } @Override public final Builder config(HadoopStepConfig config) { this.config = config; return this; } public final void setConfig(HadoopStepConfig.BuilderImpl config) { this.config = config != null ? config.build() : null; } public final String getActionOnFailure() { return 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 void setActionOnFailure(String actionOnFailure) { this.actionOnFailure = actionOnFailure; } public final StepStatus.Builder getStatus() { return status != null ? status.toBuilder() : null; } @Override public final Builder status(StepStatus status) { this.status = status; return this; } public final void setStatus(StepStatus.BuilderImpl status) { this.status = status != null ? status.build() : null; } @Override public StepSummary build() { return new StepSummary(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy