software.amazon.awssdk.services.eventbridge.model.BatchParameters Maven / Gradle / Ivy
Show all versions of eventbridge 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.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 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)
.memberName("JobDefinition").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)
.memberName("JobName").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).memberName("ArrayProperties")
.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).memberName("RetryStrategy")
.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 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 Batch job. This job definition
* must already exist.
*/
public final String jobDefinition() {
return jobDefinition;
}
/**
*
* The name to use for this execution of the job, if the target is an Batch job.
*
*
* @return The name to use for this execution of the job, if the target is an Batch job.
*/
public final 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 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 Batch job.
*/
public final BatchArrayProperties arrayProperties() {
return arrayProperties;
}
/**
*
* The retry strategy to use for failed jobs, if the target is an 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 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 final BatchRetryStrategy retryStrategy() {
return retryStrategy;
}
@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(jobDefinition());
hashCode = 31 * hashCode + Objects.hashCode(jobName());
hashCode = 31 * hashCode + Objects.hashCode(arrayProperties());
hashCode = 31 * hashCode + Objects.hashCode(retryStrategy());
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 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 final String toString() {
return ToString.builder("BatchParameters").add("JobDefinition", jobDefinition()).add("JobName", jobName())
.add("ArrayProperties", arrayProperties()).add("RetryStrategy", retryStrategy()).build();
}
public final 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 final List> sdkFields() {
return SDK_FIELDS;
}
private static Function