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

software.amazon.awssdk.services.emrserverless.model.StartJobRunRequest Maven / Gradle / Ivy

/*
 * 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.emrserverless.model;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.awscore.AwsRequestOverrideConfiguration;
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.DefaultValueTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
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 StartJobRunRequest extends EmrServerlessRequest implements
        ToCopyableBuilder {
    private static final SdkField APPLICATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("applicationId").getter(getter(StartJobRunRequest::applicationId)).setter(setter(Builder::applicationId))
            .traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("applicationId").build()).build();

    private static final SdkField CLIENT_TOKEN_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("clientToken")
            .getter(getter(StartJobRunRequest::clientToken))
            .setter(setter(Builder::clientToken))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clientToken").build(),
                    DefaultValueTrait.idempotencyToken()).build();

    private static final SdkField EXECUTION_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("executionRoleArn").getter(getter(StartJobRunRequest::executionRoleArn))
            .setter(setter(Builder::executionRoleArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("executionRoleArn").build()).build();

    private static final SdkField JOB_DRIVER_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
            .memberName("jobDriver").getter(getter(StartJobRunRequest::jobDriver)).setter(setter(Builder::jobDriver))
            .constructor(JobDriver::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("jobDriver").build()).build();

    private static final SdkField CONFIGURATION_OVERRIDES_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("configurationOverrides")
            .getter(getter(StartJobRunRequest::configurationOverrides)).setter(setter(Builder::configurationOverrides))
            .constructor(ConfigurationOverrides::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("configurationOverrides").build())
            .build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .memberName("tags")
            .getter(getter(StartJobRunRequest::tags))
            .setter(setter(Builder::tags))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
                    MapTrait.builder()
                            .keyLocationName("key")
                            .valueLocationName("value")
                            .valueFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("value").build()).build()).build()).build();

    private static final SdkField EXECUTION_TIMEOUT_MINUTES_FIELD = SdkField. builder(MarshallingType.LONG)
            .memberName("executionTimeoutMinutes").getter(getter(StartJobRunRequest::executionTimeoutMinutes))
            .setter(setter(Builder::executionTimeoutMinutes))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("executionTimeoutMinutes").build())
            .build();

    private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
            .getter(getter(StartJobRunRequest::name)).setter(setter(Builder::name))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();

    private static final SdkField MODE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("mode")
            .getter(getter(StartJobRunRequest::modeAsString)).setter(setter(Builder::mode))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("mode").build()).build();

    private static final SdkField RETRY_POLICY_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
            .memberName("retryPolicy").getter(getter(StartJobRunRequest::retryPolicy)).setter(setter(Builder::retryPolicy))
            .constructor(RetryPolicy::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("retryPolicy").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(APPLICATION_ID_FIELD,
            CLIENT_TOKEN_FIELD, EXECUTION_ROLE_ARN_FIELD, JOB_DRIVER_FIELD, CONFIGURATION_OVERRIDES_FIELD, TAGS_FIELD,
            EXECUTION_TIMEOUT_MINUTES_FIELD, NAME_FIELD, MODE_FIELD, RETRY_POLICY_FIELD));

    private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();

    private final String applicationId;

    private final String clientToken;

    private final String executionRoleArn;

    private final JobDriver jobDriver;

    private final ConfigurationOverrides configurationOverrides;

    private final Map tags;

    private final Long executionTimeoutMinutes;

    private final String name;

    private final String mode;

    private final RetryPolicy retryPolicy;

    private StartJobRunRequest(BuilderImpl builder) {
        super(builder);
        this.applicationId = builder.applicationId;
        this.clientToken = builder.clientToken;
        this.executionRoleArn = builder.executionRoleArn;
        this.jobDriver = builder.jobDriver;
        this.configurationOverrides = builder.configurationOverrides;
        this.tags = builder.tags;
        this.executionTimeoutMinutes = builder.executionTimeoutMinutes;
        this.name = builder.name;
        this.mode = builder.mode;
        this.retryPolicy = builder.retryPolicy;
    }

    /**
     * 

* The ID of the application on which to run the job. *

* * @return The ID of the application on which to run the job. */ public final String applicationId() { return applicationId; } /** *

* The client idempotency token of the job run to start. Its value must be unique for each request. *

* * @return The client idempotency token of the job run to start. Its value must be unique for each request. */ public final String clientToken() { return clientToken; } /** *

* The execution role ARN for the job run. *

* * @return The execution role ARN for the job run. */ public final String executionRoleArn() { return executionRoleArn; } /** *

* The job driver for the job run. *

* * @return The job driver for the job run. */ public final JobDriver jobDriver() { return jobDriver; } /** *

* The configuration overrides for the job run. *

* * @return The configuration overrides for the job run. */ public final ConfigurationOverrides configurationOverrides() { return configurationOverrides; } /** * For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that * the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful * because the SDK will never return a null collection or map, but you may need to differentiate between the service * returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true * if a value for the property was specified in the request builder, and false if a value was not specified. */ public final boolean hasTags() { return tags != null && !(tags instanceof SdkAutoConstructMap); } /** *

* The tags assigned to the job run. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasTags} method. *

* * @return The tags assigned to the job run. */ public final Map tags() { return tags; } /** *

* The maximum duration for the job run to run. If the job run runs beyond this duration, it will be automatically * cancelled. *

* * @return The maximum duration for the job run to run. If the job run runs beyond this duration, it will be * automatically cancelled. */ public final Long executionTimeoutMinutes() { return executionTimeoutMinutes; } /** *

* The optional job run name. This doesn't have to be unique. *

* * @return The optional job run name. This doesn't have to be unique. */ public final String name() { return name; } /** *

* The mode of the job run when it starts. *

*

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

* * @return The mode of the job run when it starts. * @see JobRunMode */ public final JobRunMode mode() { return JobRunMode.fromValue(mode); } /** *

* The mode of the job run when it starts. *

*

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

* * @return The mode of the job run when it starts. * @see JobRunMode */ public final String modeAsString() { return mode; } /** *

* The retry policy when job run starts. *

* * @return The retry policy when job run starts. */ public final RetryPolicy retryPolicy() { return retryPolicy; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(applicationId()); hashCode = 31 * hashCode + Objects.hashCode(clientToken()); hashCode = 31 * hashCode + Objects.hashCode(executionRoleArn()); hashCode = 31 * hashCode + Objects.hashCode(jobDriver()); hashCode = 31 * hashCode + Objects.hashCode(configurationOverrides()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); hashCode = 31 * hashCode + Objects.hashCode(executionTimeoutMinutes()); hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(modeAsString()); hashCode = 31 * hashCode + Objects.hashCode(retryPolicy()); 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 StartJobRunRequest)) { return false; } StartJobRunRequest other = (StartJobRunRequest) obj; return Objects.equals(applicationId(), other.applicationId()) && Objects.equals(clientToken(), other.clientToken()) && Objects.equals(executionRoleArn(), other.executionRoleArn()) && Objects.equals(jobDriver(), other.jobDriver()) && Objects.equals(configurationOverrides(), other.configurationOverrides()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()) && Objects.equals(executionTimeoutMinutes(), other.executionTimeoutMinutes()) && Objects.equals(name(), other.name()) && Objects.equals(modeAsString(), other.modeAsString()) && Objects.equals(retryPolicy(), other.retryPolicy()); } /** * 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("StartJobRunRequest").add("ApplicationId", applicationId()).add("ClientToken", clientToken()) .add("ExecutionRoleArn", executionRoleArn()).add("JobDriver", jobDriver()) .add("ConfigurationOverrides", configurationOverrides()).add("Tags", hasTags() ? tags() : null) .add("ExecutionTimeoutMinutes", executionTimeoutMinutes()).add("Name", name()).add("Mode", modeAsString()) .add("RetryPolicy", retryPolicy()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "applicationId": return Optional.ofNullable(clazz.cast(applicationId())); case "clientToken": return Optional.ofNullable(clazz.cast(clientToken())); case "executionRoleArn": return Optional.ofNullable(clazz.cast(executionRoleArn())); case "jobDriver": return Optional.ofNullable(clazz.cast(jobDriver())); case "configurationOverrides": return Optional.ofNullable(clazz.cast(configurationOverrides())); case "tags": return Optional.ofNullable(clazz.cast(tags())); case "executionTimeoutMinutes": return Optional.ofNullable(clazz.cast(executionTimeoutMinutes())); case "name": return Optional.ofNullable(clazz.cast(name())); case "mode": return Optional.ofNullable(clazz.cast(modeAsString())); case "retryPolicy": return Optional.ofNullable(clazz.cast(retryPolicy())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Map> memberNameToFieldInitializer() { Map> map = new HashMap<>(); map.put("applicationId", APPLICATION_ID_FIELD); map.put("clientToken", CLIENT_TOKEN_FIELD); map.put("executionRoleArn", EXECUTION_ROLE_ARN_FIELD); map.put("jobDriver", JOB_DRIVER_FIELD); map.put("configurationOverrides", CONFIGURATION_OVERRIDES_FIELD); map.put("tags", TAGS_FIELD); map.put("executionTimeoutMinutes", EXECUTION_TIMEOUT_MINUTES_FIELD); map.put("name", NAME_FIELD); map.put("mode", MODE_FIELD); map.put("retryPolicy", RETRY_POLICY_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((StartJobRunRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends EmrServerlessRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The ID of the application on which to run the job. *

* * @param applicationId * The ID of the application on which to run the job. * @return Returns a reference to this object so that method calls can be chained together. */ Builder applicationId(String applicationId); /** *

* The client idempotency token of the job run to start. Its value must be unique for each request. *

* * @param clientToken * The client idempotency token of the job run to start. Its value must be unique for each request. * @return Returns a reference to this object so that method calls can be chained together. */ Builder clientToken(String clientToken); /** *

* The execution role ARN for the job run. *

* * @param executionRoleArn * The execution role ARN for the job run. * @return Returns a reference to this object so that method calls can be chained together. */ Builder executionRoleArn(String executionRoleArn); /** *

* The job driver for the job run. *

* * @param jobDriver * The job driver for the job run. * @return Returns a reference to this object so that method calls can be chained together. */ Builder jobDriver(JobDriver jobDriver); /** *

* The job driver for the job run. *

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

* When the {@link Consumer} completes, {@link JobDriver.Builder#build()} is called immediately and its result * is passed to {@link #jobDriver(JobDriver)}. * * @param jobDriver * a consumer that will call methods on {@link JobDriver.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #jobDriver(JobDriver) */ default Builder jobDriver(Consumer jobDriver) { return jobDriver(JobDriver.builder().applyMutation(jobDriver).build()); } /** *

* The configuration overrides for the job run. *

* * @param configurationOverrides * The configuration overrides for the job run. * @return Returns a reference to this object so that method calls can be chained together. */ Builder configurationOverrides(ConfigurationOverrides configurationOverrides); /** *

* The configuration overrides for the job run. *

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

* When the {@link Consumer} completes, {@link ConfigurationOverrides.Builder#build()} is called immediately and * its result is passed to {@link #configurationOverrides(ConfigurationOverrides)}. * * @param configurationOverrides * a consumer that will call methods on {@link ConfigurationOverrides.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #configurationOverrides(ConfigurationOverrides) */ default Builder configurationOverrides(Consumer configurationOverrides) { return configurationOverrides(ConfigurationOverrides.builder().applyMutation(configurationOverrides).build()); } /** *

* The tags assigned to the job run. *

* * @param tags * The tags assigned to the job run. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Map tags); /** *

* The maximum duration for the job run to run. If the job run runs beyond this duration, it will be * automatically cancelled. *

* * @param executionTimeoutMinutes * The maximum duration for the job run to run. If the job run runs beyond this duration, it will be * automatically cancelled. * @return Returns a reference to this object so that method calls can be chained together. */ Builder executionTimeoutMinutes(Long executionTimeoutMinutes); /** *

* The optional job run name. This doesn't have to be unique. *

* * @param name * The optional job run name. This doesn't have to be unique. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

* The mode of the job run when it starts. *

* * @param mode * The mode of the job run when it starts. * @see JobRunMode * @return Returns a reference to this object so that method calls can be chained together. * @see JobRunMode */ Builder mode(String mode); /** *

* The mode of the job run when it starts. *

* * @param mode * The mode of the job run when it starts. * @see JobRunMode * @return Returns a reference to this object so that method calls can be chained together. * @see JobRunMode */ Builder mode(JobRunMode mode); /** *

* The retry policy when job run starts. *

* * @param retryPolicy * The retry policy when job run starts. * @return Returns a reference to this object so that method calls can be chained together. */ Builder retryPolicy(RetryPolicy retryPolicy); /** *

* The retry policy when job run starts. *

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

* When the {@link Consumer} completes, {@link RetryPolicy.Builder#build()} is called immediately and its result * is passed to {@link #retryPolicy(RetryPolicy)}. * * @param retryPolicy * a consumer that will call methods on {@link RetryPolicy.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #retryPolicy(RetryPolicy) */ default Builder retryPolicy(Consumer retryPolicy) { return retryPolicy(RetryPolicy.builder().applyMutation(retryPolicy).build()); } @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends EmrServerlessRequest.BuilderImpl implements Builder { private String applicationId; private String clientToken; private String executionRoleArn; private JobDriver jobDriver; private ConfigurationOverrides configurationOverrides; private Map tags = DefaultSdkAutoConstructMap.getInstance(); private Long executionTimeoutMinutes; private String name; private String mode; private RetryPolicy retryPolicy; private BuilderImpl() { } private BuilderImpl(StartJobRunRequest model) { super(model); applicationId(model.applicationId); clientToken(model.clientToken); executionRoleArn(model.executionRoleArn); jobDriver(model.jobDriver); configurationOverrides(model.configurationOverrides); tags(model.tags); executionTimeoutMinutes(model.executionTimeoutMinutes); name(model.name); mode(model.mode); retryPolicy(model.retryPolicy); } public final String getApplicationId() { return applicationId; } public final void setApplicationId(String applicationId) { this.applicationId = applicationId; } @Override public final Builder applicationId(String applicationId) { this.applicationId = applicationId; return this; } public final String getClientToken() { return clientToken; } public final void setClientToken(String clientToken) { this.clientToken = clientToken; } @Override public final Builder clientToken(String clientToken) { this.clientToken = clientToken; return this; } public final String getExecutionRoleArn() { return executionRoleArn; } public final void setExecutionRoleArn(String executionRoleArn) { this.executionRoleArn = executionRoleArn; } @Override public final Builder executionRoleArn(String executionRoleArn) { this.executionRoleArn = executionRoleArn; return this; } public final JobDriver.Builder getJobDriver() { return jobDriver != null ? jobDriver.toBuilder() : null; } public final void setJobDriver(JobDriver.BuilderImpl jobDriver) { this.jobDriver = jobDriver != null ? jobDriver.build() : null; } @Override public final Builder jobDriver(JobDriver jobDriver) { this.jobDriver = jobDriver; return this; } public final ConfigurationOverrides.Builder getConfigurationOverrides() { return configurationOverrides != null ? configurationOverrides.toBuilder() : null; } public final void setConfigurationOverrides(ConfigurationOverrides.BuilderImpl configurationOverrides) { this.configurationOverrides = configurationOverrides != null ? configurationOverrides.build() : null; } @Override public final Builder configurationOverrides(ConfigurationOverrides configurationOverrides) { this.configurationOverrides = configurationOverrides; return this; } public final Map getTags() { if (tags instanceof SdkAutoConstructMap) { return null; } return tags; } public final void setTags(Map tags) { this.tags = TagMapCopier.copy(tags); } @Override public final Builder tags(Map tags) { this.tags = TagMapCopier.copy(tags); return this; } public final Long getExecutionTimeoutMinutes() { return executionTimeoutMinutes; } public final void setExecutionTimeoutMinutes(Long executionTimeoutMinutes) { this.executionTimeoutMinutes = executionTimeoutMinutes; } @Override public final Builder executionTimeoutMinutes(Long executionTimeoutMinutes) { this.executionTimeoutMinutes = executionTimeoutMinutes; return this; } 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 getMode() { return mode; } public final void setMode(String mode) { this.mode = mode; } @Override public final Builder mode(String mode) { this.mode = mode; return this; } @Override public final Builder mode(JobRunMode mode) { this.mode(mode == null ? null : mode.toString()); return this; } public final RetryPolicy.Builder getRetryPolicy() { return retryPolicy != null ? retryPolicy.toBuilder() : null; } public final void setRetryPolicy(RetryPolicy.BuilderImpl retryPolicy) { this.retryPolicy = retryPolicy != null ? retryPolicy.build() : null; } @Override public final Builder retryPolicy(RetryPolicy retryPolicy) { this.retryPolicy = retryPolicy; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public StartJobRunRequest build() { return new StartJobRunRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy