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

software.amazon.awssdk.services.m2.model.StartBatchJobRequest 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.m2.model;

import java.util.Arrays;
import java.util.Collections;
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.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 StartBatchJobRequest extends M2Request implements
        ToCopyableBuilder {
    private static final SdkField APPLICATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("applicationId").getter(getter(StartBatchJobRequest::applicationId))
            .setter(setter(Builder::applicationId))
            .traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("applicationId").build()).build();

    private static final SdkField BATCH_JOB_IDENTIFIER_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("batchJobIdentifier")
            .getter(getter(StartBatchJobRequest::batchJobIdentifier)).setter(setter(Builder::batchJobIdentifier))
            .constructor(BatchJobIdentifier::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("batchJobIdentifier").build())
            .build();

    private static final SdkField> JOB_PARAMS_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .memberName("jobParams")
            .getter(getter(StartBatchJobRequest::jobParams))
            .setter(setter(Builder::jobParams))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("jobParams").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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(APPLICATION_ID_FIELD,
            BATCH_JOB_IDENTIFIER_FIELD, JOB_PARAMS_FIELD));

    private final String applicationId;

    private final BatchJobIdentifier batchJobIdentifier;

    private final Map jobParams;

    private StartBatchJobRequest(BuilderImpl builder) {
        super(builder);
        this.applicationId = builder.applicationId;
        this.batchJobIdentifier = builder.batchJobIdentifier;
        this.jobParams = builder.jobParams;
    }

    /**
     * 

* The unique identifier of the application associated with this batch job. *

* * @return The unique identifier of the application associated with this batch job. */ public final String applicationId() { return applicationId; } /** *

* The unique identifier of the batch job. *

* * @return The unique identifier of the batch job. */ public final BatchJobIdentifier batchJobIdentifier() { return batchJobIdentifier; } /** * For responses, this returns true if the service returned a value for the JobParams 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 hasJobParams() { return jobParams != null && !(jobParams instanceof SdkAutoConstructMap); } /** *

* The collection of batch job parameters. For details about limits for keys and values, see Coding variables * in JCL. *

*

* 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 #hasJobParams} method. *

* * @return The collection of batch job parameters. For details about limits for keys and values, see Coding * variables in JCL. */ public final Map jobParams() { return jobParams; } @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(batchJobIdentifier()); hashCode = 31 * hashCode + Objects.hashCode(hasJobParams() ? jobParams() : null); 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 StartBatchJobRequest)) { return false; } StartBatchJobRequest other = (StartBatchJobRequest) obj; return Objects.equals(applicationId(), other.applicationId()) && Objects.equals(batchJobIdentifier(), other.batchJobIdentifier()) && hasJobParams() == other.hasJobParams() && Objects.equals(jobParams(), other.jobParams()); } /** * 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("StartBatchJobRequest").add("ApplicationId", applicationId()) .add("BatchJobIdentifier", batchJobIdentifier()).add("JobParams", hasJobParams() ? jobParams() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "applicationId": return Optional.ofNullable(clazz.cast(applicationId())); case "batchJobIdentifier": return Optional.ofNullable(clazz.cast(batchJobIdentifier())); case "jobParams": return Optional.ofNullable(clazz.cast(jobParams())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((StartBatchJobRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends M2Request.Builder, SdkPojo, CopyableBuilder { /** *

* The unique identifier of the application associated with this batch job. *

* * @param applicationId * The unique identifier of the application associated with this batch job. * @return Returns a reference to this object so that method calls can be chained together. */ Builder applicationId(String applicationId); /** *

* The unique identifier of the batch job. *

* * @param batchJobIdentifier * The unique identifier of the batch job. * @return Returns a reference to this object so that method calls can be chained together. */ Builder batchJobIdentifier(BatchJobIdentifier batchJobIdentifier); /** *

* The unique identifier of the batch job. *

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

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

* The collection of batch job parameters. For details about limits for keys and values, see Coding * variables in JCL. *

* * @param jobParams * The collection of batch job parameters. For details about limits for keys and values, see Coding * variables in JCL. * @return Returns a reference to this object so that method calls can be chained together. */ Builder jobParams(Map jobParams); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends M2Request.BuilderImpl implements Builder { private String applicationId; private BatchJobIdentifier batchJobIdentifier; private Map jobParams = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(StartBatchJobRequest model) { super(model); applicationId(model.applicationId); batchJobIdentifier(model.batchJobIdentifier); jobParams(model.jobParams); } 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 BatchJobIdentifier.Builder getBatchJobIdentifier() { return batchJobIdentifier != null ? batchJobIdentifier.toBuilder() : null; } public final void setBatchJobIdentifier(BatchJobIdentifier.BuilderImpl batchJobIdentifier) { this.batchJobIdentifier = batchJobIdentifier != null ? batchJobIdentifier.build() : null; } @Override public final Builder batchJobIdentifier(BatchJobIdentifier batchJobIdentifier) { this.batchJobIdentifier = batchJobIdentifier; return this; } public final Map getJobParams() { if (jobParams instanceof SdkAutoConstructMap) { return null; } return jobParams; } public final void setJobParams(Map jobParams) { this.jobParams = BatchJobParametersMapCopier.copy(jobParams); } @Override public final Builder jobParams(Map jobParams) { this.jobParams = BatchJobParametersMapCopier.copy(jobParams); 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 StartBatchJobRequest build() { return new StartBatchJobRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy