/* * Copyright 2010-2023 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 com.amazonaws.services.iot.model; import java.io.Serializable; /** *
* The criteria that determine when and how a job abort takes place. *
*/ public class AwsJobAbortCriteria implements Serializable { /** ** The type of job execution failures that can initiate a job abort. *
*
* Constraints:
* Allowed Values: FAILED, REJECTED, TIMED_OUT, ALL
*/
private String failureType;
/**
*
* The type of job action to take to initiate the job abort. *
*
* Constraints:
* Allowed Values: CANCEL
*/
private String action;
/**
*
* The minimum percentage of job execution failures that must occur to * initiate the job abort. *
** Amazon Web Services IoT Core supports up to two digits after the decimal * (for example, 10.9 and 10.99, but not 10.999). *
*
* Constraints:
* Range: - 100.0
*/
private Double thresholdPercentage;
/**
*
* The minimum number of things which must receive job execution * notifications before the job can be aborted. *
*
* Constraints:
* Range: 1 -
*/
private Integer minNumberOfExecutedThings;
/**
*
* The type of job execution failures that can initiate a job abort. *
*
* Constraints:
* Allowed Values: FAILED, REJECTED, TIMED_OUT, ALL
*
* @return
* The type of job execution failures that can initiate a job abort. *
* @see AwsJobAbortCriteriaFailureType */ public String getFailureType() { return failureType; } /** ** The type of job execution failures that can initiate a job abort. *
*
* Constraints:
* Allowed Values: FAILED, REJECTED, TIMED_OUT, ALL
*
* @param failureType
* The type of job execution failures that can initiate a job * abort. *
* @see AwsJobAbortCriteriaFailureType */ public void setFailureType(String failureType) { this.failureType = failureType; } /** ** The type of job execution failures that can initiate a job abort. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: FAILED, REJECTED, TIMED_OUT, ALL
*
* @param failureType
* The type of job execution failures that can initiate a job * abort. *
* @return A reference to this updated object so that method calls can be * chained together. * @see AwsJobAbortCriteriaFailureType */ public AwsJobAbortCriteria withFailureType(String failureType) { this.failureType = failureType; return this; } /** ** The type of job execution failures that can initiate a job abort. *
*
* Constraints:
* Allowed Values: FAILED, REJECTED, TIMED_OUT, ALL
*
* @param failureType
* The type of job execution failures that can initiate a job * abort. *
* @see AwsJobAbortCriteriaFailureType */ public void setFailureType(AwsJobAbortCriteriaFailureType failureType) { this.failureType = failureType.toString(); } /** ** The type of job execution failures that can initiate a job abort. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: FAILED, REJECTED, TIMED_OUT, ALL
*
* @param failureType
* The type of job execution failures that can initiate a job * abort. *
* @return A reference to this updated object so that method calls can be * chained together. * @see AwsJobAbortCriteriaFailureType */ public AwsJobAbortCriteria withFailureType(AwsJobAbortCriteriaFailureType failureType) { this.failureType = failureType.toString(); return this; } /** ** The type of job action to take to initiate the job abort. *
*
* Constraints:
* Allowed Values: CANCEL
*
* @return
* The type of job action to take to initiate the job abort. *
* @see AwsJobAbortCriteriaAbortAction */ public String getAction() { return action; } /** ** The type of job action to take to initiate the job abort. *
*
* Constraints:
* Allowed Values: CANCEL
*
* @param action
* The type of job action to take to initiate the job abort. *
* @see AwsJobAbortCriteriaAbortAction */ public void setAction(String action) { this.action = action; } /** ** The type of job action to take to initiate the job abort. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: CANCEL
*
* @param action
* The type of job action to take to initiate the job abort. *
* @return A reference to this updated object so that method calls can be * chained together. * @see AwsJobAbortCriteriaAbortAction */ public AwsJobAbortCriteria withAction(String action) { this.action = action; return this; } /** ** The type of job action to take to initiate the job abort. *
*
* Constraints:
* Allowed Values: CANCEL
*
* @param action
* The type of job action to take to initiate the job abort. *
* @see AwsJobAbortCriteriaAbortAction */ public void setAction(AwsJobAbortCriteriaAbortAction action) { this.action = action.toString(); } /** ** The type of job action to take to initiate the job abort. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: CANCEL
*
* @param action
* The type of job action to take to initiate the job abort. *
* @return A reference to this updated object so that method calls can be * chained together. * @see AwsJobAbortCriteriaAbortAction */ public AwsJobAbortCriteria withAction(AwsJobAbortCriteriaAbortAction action) { this.action = action.toString(); return this; } /** ** The minimum percentage of job execution failures that must occur to * initiate the job abort. *
** Amazon Web Services IoT Core supports up to two digits after the decimal * (for example, 10.9 and 10.99, but not 10.999). *
*
* Constraints:
* Range: - 100.0
*
* @return
* The minimum percentage of job execution failures that must occur * to initiate the job abort. *
** Amazon Web Services IoT Core supports up to two digits after the * decimal (for example, 10.9 and 10.99, but not 10.999). *
*/ public Double getThresholdPercentage() { return thresholdPercentage; } /** ** The minimum percentage of job execution failures that must occur to * initiate the job abort. *
** Amazon Web Services IoT Core supports up to two digits after the decimal * (for example, 10.9 and 10.99, but not 10.999). *
*
* Constraints:
* Range: - 100.0
*
* @param thresholdPercentage
* The minimum percentage of job execution failures that must * occur to initiate the job abort. *
** Amazon Web Services IoT Core supports up to two digits after * the decimal (for example, 10.9 and 10.99, but not 10.999). *
*/ public void setThresholdPercentage(Double thresholdPercentage) { this.thresholdPercentage = thresholdPercentage; } /** ** The minimum percentage of job execution failures that must occur to * initiate the job abort. *
** Amazon Web Services IoT Core supports up to two digits after the decimal * (for example, 10.9 and 10.99, but not 10.999). *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Range: - 100.0
*
* @param thresholdPercentage
* The minimum percentage of job execution failures that must * occur to initiate the job abort. *
** Amazon Web Services IoT Core supports up to two digits after * the decimal (for example, 10.9 and 10.99, but not 10.999). *
* @return A reference to this updated object so that method calls can be * chained together. */ public AwsJobAbortCriteria withThresholdPercentage(Double thresholdPercentage) { this.thresholdPercentage = thresholdPercentage; return this; } /** ** The minimum number of things which must receive job execution * notifications before the job can be aborted. *
*
* Constraints:
* Range: 1 -
*
* @return
* The minimum number of things which must receive job execution * notifications before the job can be aborted. *
*/ public Integer getMinNumberOfExecutedThings() { return minNumberOfExecutedThings; } /** ** The minimum number of things which must receive job execution * notifications before the job can be aborted. *
*
* Constraints:
* Range: 1 -
*
* @param minNumberOfExecutedThings
* The minimum number of things which must receive job execution * notifications before the job can be aborted. *
*/ public void setMinNumberOfExecutedThings(Integer minNumberOfExecutedThings) { this.minNumberOfExecutedThings = minNumberOfExecutedThings; } /** ** The minimum number of things which must receive job execution * notifications before the job can be aborted. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Range: 1 -
*
* @param minNumberOfExecutedThings
* The minimum number of things which must receive job execution * notifications before the job can be aborted. *
* @return A reference to this updated object so that method calls can be * chained together. */ public AwsJobAbortCriteria withMinNumberOfExecutedThings(Integer minNumberOfExecutedThings) { this.minNumberOfExecutedThings = minNumberOfExecutedThings; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getFailureType() != null) sb.append("failureType: " + getFailureType() + ","); if (getAction() != null) sb.append("action: " + getAction() + ","); if (getThresholdPercentage() != null) sb.append("thresholdPercentage: " + getThresholdPercentage() + ","); if (getMinNumberOfExecutedThings() != null) sb.append("minNumberOfExecutedThings: " + getMinNumberOfExecutedThings()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getFailureType() == null) ? 0 : getFailureType().hashCode()); hashCode = prime * hashCode + ((getAction() == null) ? 0 : getAction().hashCode()); hashCode = prime * hashCode + ((getThresholdPercentage() == null) ? 0 : getThresholdPercentage().hashCode()); hashCode = prime * hashCode + ((getMinNumberOfExecutedThings() == null) ? 0 : getMinNumberOfExecutedThings() .hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AwsJobAbortCriteria == false) return false; AwsJobAbortCriteria other = (AwsJobAbortCriteria) obj; if (other.getFailureType() == null ^ this.getFailureType() == null) return false; if (other.getFailureType() != null && other.getFailureType().equals(this.getFailureType()) == false) return false; if (other.getAction() == null ^ this.getAction() == null) return false; if (other.getAction() != null && other.getAction().equals(this.getAction()) == false) return false; if (other.getThresholdPercentage() == null ^ this.getThresholdPercentage() == null) return false; if (other.getThresholdPercentage() != null && other.getThresholdPercentage().equals(this.getThresholdPercentage()) == false) return false; if (other.getMinNumberOfExecutedThings() == null ^ this.getMinNumberOfExecutedThings() == null) return false; if (other.getMinNumberOfExecutedThings() != null && other.getMinNumberOfExecutedThings().equals(this.getMinNumberOfExecutedThings()) == false) return false; return true; } }