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

software.amazon.awssdk.services.iot.model.AwsJobAbortCriteria 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.iot.model;

import java.beans.Transient;
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.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 criteria that determine when and how a job abort takes place. *

*/ @Generated("software.amazon.awssdk:codegen") public final class AwsJobAbortCriteria implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField FAILURE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("failureType").getter(getter(AwsJobAbortCriteria::failureTypeAsString)) .setter(setter(Builder::failureType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("failureType").build()).build(); private static final SdkField ACTION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("action") .getter(getter(AwsJobAbortCriteria::actionAsString)).setter(setter(Builder::action)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("action").build()).build(); private static final SdkField THRESHOLD_PERCENTAGE_FIELD = SdkField. builder(MarshallingType.DOUBLE) .memberName("thresholdPercentage").getter(getter(AwsJobAbortCriteria::thresholdPercentage)) .setter(setter(Builder::thresholdPercentage)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("thresholdPercentage").build()) .build(); private static final SdkField MIN_NUMBER_OF_EXECUTED_THINGS_FIELD = SdkField . builder(MarshallingType.INTEGER).memberName("minNumberOfExecutedThings") .getter(getter(AwsJobAbortCriteria::minNumberOfExecutedThings)).setter(setter(Builder::minNumberOfExecutedThings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("minNumberOfExecutedThings").build()) .build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FAILURE_TYPE_FIELD, ACTION_FIELD, THRESHOLD_PERCENTAGE_FIELD, MIN_NUMBER_OF_EXECUTED_THINGS_FIELD)); private static final long serialVersionUID = 1L; private final String failureType; private final String action; private final Double thresholdPercentage; private final Integer minNumberOfExecutedThings; private AwsJobAbortCriteria(BuilderImpl builder) { this.failureType = builder.failureType; this.action = builder.action; this.thresholdPercentage = builder.thresholdPercentage; this.minNumberOfExecutedThings = builder.minNumberOfExecutedThings; } /** *

* The type of job execution failures that can initiate a job abort. *

*

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

* * @return The type of job execution failures that can initiate a job abort. * @see AwsJobAbortCriteriaFailureType */ public final AwsJobAbortCriteriaFailureType failureType() { return AwsJobAbortCriteriaFailureType.fromValue(failureType); } /** *

* The type of job execution failures that can initiate a job abort. *

*

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

* * @return The type of job execution failures that can initiate a job abort. * @see AwsJobAbortCriteriaFailureType */ public final String failureTypeAsString() { return failureType; } /** *

* The type of job action to take to initiate the job abort. *

*

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

* * @return The type of job action to take to initiate the job abort. * @see AwsJobAbortCriteriaAbortAction */ public final AwsJobAbortCriteriaAbortAction action() { return AwsJobAbortCriteriaAbortAction.fromValue(action); } /** *

* The type of job action to take to initiate the job abort. *

*

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

* * @return The type of job action to take to initiate the job abort. * @see AwsJobAbortCriteriaAbortAction */ public final String actionAsString() { return action; } /** *

* The minimum percentage of job execution failures that must occur to initiate the job abort. *

*

* AWS IoT supports up to two digits after the decimal (for example, 10.9 and 10.99, but not 10.999). *

* * @return The minimum percentage of job execution failures that must occur to initiate the job abort.

*

* AWS IoT supports up to two digits after the decimal (for example, 10.9 and 10.99, but not 10.999). */ public final Double thresholdPercentage() { return thresholdPercentage; } /** *

* The minimum number of things which must receive job execution notifications before the job can be aborted. *

* * @return The minimum number of things which must receive job execution notifications before the job can be * aborted. */ public final Integer minNumberOfExecutedThings() { return minNumberOfExecutedThings; } @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 + Objects.hashCode(failureTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(actionAsString()); hashCode = 31 * hashCode + Objects.hashCode(thresholdPercentage()); hashCode = 31 * hashCode + Objects.hashCode(minNumberOfExecutedThings()); 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 AwsJobAbortCriteria)) { return false; } AwsJobAbortCriteria other = (AwsJobAbortCriteria) obj; return Objects.equals(failureTypeAsString(), other.failureTypeAsString()) && Objects.equals(actionAsString(), other.actionAsString()) && Objects.equals(thresholdPercentage(), other.thresholdPercentage()) && Objects.equals(minNumberOfExecutedThings(), other.minNumberOfExecutedThings()); } /** * 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("AwsJobAbortCriteria").add("FailureType", failureTypeAsString()).add("Action", actionAsString()) .add("ThresholdPercentage", thresholdPercentage()).add("MinNumberOfExecutedThings", minNumberOfExecutedThings()) .build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "failureType": return Optional.ofNullable(clazz.cast(failureTypeAsString())); case "action": return Optional.ofNullable(clazz.cast(actionAsString())); case "thresholdPercentage": return Optional.ofNullable(clazz.cast(thresholdPercentage())); case "minNumberOfExecutedThings": return Optional.ofNullable(clazz.cast(minNumberOfExecutedThings())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((AwsJobAbortCriteria) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The type of job execution failures that can initiate a job abort. *

* * @param failureType * The type of job execution failures that can initiate a job abort. * @see AwsJobAbortCriteriaFailureType * @return Returns a reference to this object so that method calls can be chained together. * @see AwsJobAbortCriteriaFailureType */ Builder failureType(String failureType); /** *

* The type of job execution failures that can initiate a job abort. *

* * @param failureType * The type of job execution failures that can initiate a job abort. * @see AwsJobAbortCriteriaFailureType * @return Returns a reference to this object so that method calls can be chained together. * @see AwsJobAbortCriteriaFailureType */ Builder failureType(AwsJobAbortCriteriaFailureType failureType); /** *

* The type of job action to take to initiate the job abort. *

* * @param action * The type of job action to take to initiate the job abort. * @see AwsJobAbortCriteriaAbortAction * @return Returns a reference to this object so that method calls can be chained together. * @see AwsJobAbortCriteriaAbortAction */ Builder action(String action); /** *

* The type of job action to take to initiate the job abort. *

* * @param action * The type of job action to take to initiate the job abort. * @see AwsJobAbortCriteriaAbortAction * @return Returns a reference to this object so that method calls can be chained together. * @see AwsJobAbortCriteriaAbortAction */ Builder action(AwsJobAbortCriteriaAbortAction action); /** *

* The minimum percentage of job execution failures that must occur to initiate the job abort. *

*

* AWS IoT supports up to two digits after the decimal (for example, 10.9 and 10.99, but not 10.999). *

* * @param thresholdPercentage * The minimum percentage of job execution failures that must occur to initiate the job abort.

*

* AWS IoT supports up to two digits after the decimal (for example, 10.9 and 10.99, but not 10.999). * @return Returns a reference to this object so that method calls can be chained together. */ Builder thresholdPercentage(Double thresholdPercentage); /** *

* The minimum number of things which must receive job execution notifications before the job can be aborted. *

* * @param minNumberOfExecutedThings * The minimum number of things which must receive job execution notifications before the job can be * aborted. * @return Returns a reference to this object so that method calls can be chained together. */ Builder minNumberOfExecutedThings(Integer minNumberOfExecutedThings); } static final class BuilderImpl implements Builder { private String failureType; private String action; private Double thresholdPercentage; private Integer minNumberOfExecutedThings; private BuilderImpl() { } private BuilderImpl(AwsJobAbortCriteria model) { failureType(model.failureType); action(model.action); thresholdPercentage(model.thresholdPercentage); minNumberOfExecutedThings(model.minNumberOfExecutedThings); } public final String getFailureType() { return failureType; } public final void setFailureType(String failureType) { this.failureType = failureType; } @Override @Transient public final Builder failureType(String failureType) { this.failureType = failureType; return this; } @Override @Transient public final Builder failureType(AwsJobAbortCriteriaFailureType failureType) { this.failureType(failureType == null ? null : failureType.toString()); return this; } public final String getAction() { return action; } public final void setAction(String action) { this.action = action; } @Override @Transient public final Builder action(String action) { this.action = action; return this; } @Override @Transient public final Builder action(AwsJobAbortCriteriaAbortAction action) { this.action(action == null ? null : action.toString()); return this; } public final Double getThresholdPercentage() { return thresholdPercentage; } public final void setThresholdPercentage(Double thresholdPercentage) { this.thresholdPercentage = thresholdPercentage; } @Override @Transient public final Builder thresholdPercentage(Double thresholdPercentage) { this.thresholdPercentage = thresholdPercentage; return this; } public final Integer getMinNumberOfExecutedThings() { return minNumberOfExecutedThings; } public final void setMinNumberOfExecutedThings(Integer minNumberOfExecutedThings) { this.minNumberOfExecutedThings = minNumberOfExecutedThings; } @Override @Transient public final Builder minNumberOfExecutedThings(Integer minNumberOfExecutedThings) { this.minNumberOfExecutedThings = minNumberOfExecutedThings; return this; } @Override public AwsJobAbortCriteria build() { return new AwsJobAbortCriteria(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy