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

software.amazon.awssdk.services.eventbridge.model.BatchParameters 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.eventbridge.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 custom parameters to be used when the target is an AWS Batch job. *

*/ @Generated("software.amazon.awssdk:codegen") public final class BatchParameters implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField JOB_DEFINITION_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(BatchParameters::jobDefinition)).setter(setter(Builder::jobDefinition)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("JobDefinition").build()).build(); private static final SdkField JOB_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(BatchParameters::jobName)).setter(setter(Builder::jobName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("JobName").build()).build(); private static final SdkField ARRAY_PROPERTIES_FIELD = SdkField . builder(MarshallingType.SDK_POJO).getter(getter(BatchParameters::arrayProperties)) .setter(setter(Builder::arrayProperties)).constructor(BatchArrayProperties::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ArrayProperties").build()).build(); private static final SdkField RETRY_STRATEGY_FIELD = SdkField . builder(MarshallingType.SDK_POJO).getter(getter(BatchParameters::retryStrategy)) .setter(setter(Builder::retryStrategy)).constructor(BatchRetryStrategy::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RetryStrategy").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(JOB_DEFINITION_FIELD, JOB_NAME_FIELD, ARRAY_PROPERTIES_FIELD, RETRY_STRATEGY_FIELD)); private static final long serialVersionUID = 1L; private final String jobDefinition; private final String jobName; private final BatchArrayProperties arrayProperties; private final BatchRetryStrategy retryStrategy; private BatchParameters(BuilderImpl builder) { this.jobDefinition = builder.jobDefinition; this.jobName = builder.jobName; this.arrayProperties = builder.arrayProperties; this.retryStrategy = builder.retryStrategy; } /** *

* The ARN or name of the job definition to use if the event target is an AWS Batch job. This job definition must * already exist. *

* * @return The ARN or name of the job definition to use if the event target is an AWS Batch job. This job definition * must already exist. */ public String jobDefinition() { return jobDefinition; } /** *

* The name to use for this execution of the job, if the target is an AWS Batch job. *

* * @return The name to use for this execution of the job, if the target is an AWS Batch job. */ public String jobName() { return jobName; } /** *

* The array properties for the submitted job, such as the size of the array. The array size can be between 2 and * 10,000. If you specify array properties for a job, it becomes an array job. This parameter is used only if the * target is an AWS Batch job. *

* * @return The array properties for the submitted job, such as the size of the array. The array size can be between * 2 and 10,000. If you specify array properties for a job, it becomes an array job. This parameter is used * only if the target is an AWS Batch job. */ public BatchArrayProperties arrayProperties() { return arrayProperties; } /** *

* The retry strategy to use for failed jobs, if the target is an AWS Batch job. The retry strategy is the number of * times to retry the failed job execution. Valid values are 1–10. When you specify a retry strategy here, it * overrides the retry strategy defined in the job definition. *

* * @return The retry strategy to use for failed jobs, if the target is an AWS Batch job. The retry strategy is the * number of times to retry the failed job execution. Valid values are 1–10. When you specify a retry * strategy here, it overrides the retry strategy defined in the job definition. */ public BatchRetryStrategy retryStrategy() { return retryStrategy; } @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(jobDefinition()); hashCode = 31 * hashCode + Objects.hashCode(jobName()); hashCode = 31 * hashCode + Objects.hashCode(arrayProperties()); hashCode = 31 * hashCode + Objects.hashCode(retryStrategy()); 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 BatchParameters)) { return false; } BatchParameters other = (BatchParameters) obj; return Objects.equals(jobDefinition(), other.jobDefinition()) && Objects.equals(jobName(), other.jobName()) && Objects.equals(arrayProperties(), other.arrayProperties()) && Objects.equals(retryStrategy(), other.retryStrategy()); } /** * 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("BatchParameters").add("JobDefinition", jobDefinition()).add("JobName", jobName()) .add("ArrayProperties", arrayProperties()).add("RetryStrategy", retryStrategy()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "JobDefinition": return Optional.ofNullable(clazz.cast(jobDefinition())); case "JobName": return Optional.ofNullable(clazz.cast(jobName())); case "ArrayProperties": return Optional.ofNullable(clazz.cast(arrayProperties())); case "RetryStrategy": return Optional.ofNullable(clazz.cast(retryStrategy())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((BatchParameters) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ARN or name of the job definition to use if the event target is an AWS Batch job. This job definition * must already exist. *

* * @param jobDefinition * The ARN or name of the job definition to use if the event target is an AWS Batch job. This job * definition must already exist. * @return Returns a reference to this object so that method calls can be chained together. */ Builder jobDefinition(String jobDefinition); /** *

* The name to use for this execution of the job, if the target is an AWS Batch job. *

* * @param jobName * The name to use for this execution of the job, if the target is an AWS Batch job. * @return Returns a reference to this object so that method calls can be chained together. */ Builder jobName(String jobName); /** *

* The array properties for the submitted job, such as the size of the array. The array size can be between 2 * and 10,000. If you specify array properties for a job, it becomes an array job. This parameter is used only * if the target is an AWS Batch job. *

* * @param arrayProperties * The array properties for the submitted job, such as the size of the array. The array size can be * between 2 and 10,000. If you specify array properties for a job, it becomes an array job. This * parameter is used only if the target is an AWS Batch job. * @return Returns a reference to this object so that method calls can be chained together. */ Builder arrayProperties(BatchArrayProperties arrayProperties); /** *

* The array properties for the submitted job, such as the size of the array. The array size can be between 2 * and 10,000. If you specify array properties for a job, it becomes an array job. This parameter is used only * if the target is an AWS Batch job. *

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

* The retry strategy to use for failed jobs, if the target is an AWS Batch job. The retry strategy is the * number of times to retry the failed job execution. Valid values are 1–10. When you specify a retry strategy * here, it overrides the retry strategy defined in the job definition. *

* * @param retryStrategy * The retry strategy to use for failed jobs, if the target is an AWS Batch job. The retry strategy is * the number of times to retry the failed job execution. Valid values are 1–10. When you specify a retry * strategy here, it overrides the retry strategy defined in the job definition. * @return Returns a reference to this object so that method calls can be chained together. */ Builder retryStrategy(BatchRetryStrategy retryStrategy); /** *

* The retry strategy to use for failed jobs, if the target is an AWS Batch job. The retry strategy is the * number of times to retry the failed job execution. Valid values are 1–10. When you specify a retry strategy * here, it overrides the retry strategy defined in the job definition. *

* This is a convenience that creates an instance of the {@link BatchRetryStrategy.Builder} avoiding the need to * create one manually via {@link BatchRetryStrategy#builder()}. * * When the {@link Consumer} completes, {@link BatchRetryStrategy.Builder#build()} is called immediately and its * result is passed to {@link #retryStrategy(BatchRetryStrategy)}. * * @param retryStrategy * a consumer that will call methods on {@link BatchRetryStrategy.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #retryStrategy(BatchRetryStrategy) */ default Builder retryStrategy(Consumer retryStrategy) { return retryStrategy(BatchRetryStrategy.builder().applyMutation(retryStrategy).build()); } } static final class BuilderImpl implements Builder { private String jobDefinition; private String jobName; private BatchArrayProperties arrayProperties; private BatchRetryStrategy retryStrategy; private BuilderImpl() { } private BuilderImpl(BatchParameters model) { jobDefinition(model.jobDefinition); jobName(model.jobName); arrayProperties(model.arrayProperties); retryStrategy(model.retryStrategy); } public final String getJobDefinition() { return jobDefinition; } @Override public final Builder jobDefinition(String jobDefinition) { this.jobDefinition = jobDefinition; return this; } public final void setJobDefinition(String jobDefinition) { this.jobDefinition = jobDefinition; } public final String getJobName() { return jobName; } @Override public final Builder jobName(String jobName) { this.jobName = jobName; return this; } public final void setJobName(String jobName) { this.jobName = jobName; } public final BatchArrayProperties.Builder getArrayProperties() { return arrayProperties != null ? arrayProperties.toBuilder() : null; } @Override public final Builder arrayProperties(BatchArrayProperties arrayProperties) { this.arrayProperties = arrayProperties; return this; } public final void setArrayProperties(BatchArrayProperties.BuilderImpl arrayProperties) { this.arrayProperties = arrayProperties != null ? arrayProperties.build() : null; } public final BatchRetryStrategy.Builder getRetryStrategy() { return retryStrategy != null ? retryStrategy.toBuilder() : null; } @Override public final Builder retryStrategy(BatchRetryStrategy retryStrategy) { this.retryStrategy = retryStrategy; return this; } public final void setRetryStrategy(BatchRetryStrategy.BuilderImpl retryStrategy) { this.retryStrategy = retryStrategy != null ? retryStrategy.build() : null; } @Override public BatchParameters build() { return new BatchParameters(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy