software.amazon.awssdk.services.emr.model.StepSummary 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.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).memberName("Id")
.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).memberName("Name")
.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)
.memberName("Config").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)
.memberName("ActionOnFailure").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)
.memberName("Status").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 final String id() {
return id;
}
/**
*
* The name of the cluster step.
*
*
* @return The name of the cluster step.
*/
public final String name() {
return name;
}
/**
*
* The Hadoop job configuration of the cluster step.
*
*
* @return The Hadoop job configuration of the cluster step.
*/
public final 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.
*
*
* 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.
* @see ActionOnFailure
*/
public final 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.
*
*
* 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.
* @see ActionOnFailure
*/
public final String actionOnFailureAsString() {
return actionOnFailure;
}
/**
*
* The current execution status details of the cluster step.
*
*
* @return The current execution status details of the cluster step.
*/
public final StepStatus status() {
return status;
}
@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 + 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 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 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 final String toString() {
return ToString.builder("StepSummary").add("Id", id()).add("Name", name()).add("Config", config())
.add("ActionOnFailure", actionOnFailureAsString()).add("Status", status()).build();
}
public final 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 final List> sdkFields() {
return SDK_FIELDS;
}
private static Function