com.amazonaws.services.greengrassv2.model.IoTJobAbortCriteria Maven / Gradle / Ivy
Show all versions of aws-java-sdk-greengrassv2 Show documentation
/*
* Copyright 2019-2024 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.greengrassv2.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Contains criteria that define when and how to cancel a job.
*
*
* The deployment stops if the following conditions are true:
*
*
* -
*
* The number of things that receive the deployment exceeds the minNumberOfExecutedThings
.
*
*
* -
*
* The percentage of failures with type failureType
exceeds the thresholdPercentage
.
*
*
*
*
* @see AWS
* API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class IoTJobAbortCriteria implements Serializable, Cloneable, StructuredPojo {
/**
*
* The type of job deployment failure that can cancel a job.
*
*/
private String failureType;
/**
*
* The action to perform when the criteria are met.
*
*/
private String action;
/**
*
* The minimum percentage of failureType
failures that occur before the job can cancel.
*
*
* This parameter supports up to two digits after the decimal (for example, you can specify 10.9
or
* 10.99
, but not 10.999
).
*
*/
private Double thresholdPercentage;
/**
*
* The minimum number of things that receive the configuration before the job can cancel.
*
*/
private Integer minNumberOfExecutedThings;
/**
*
* The type of job deployment failure that can cancel a job.
*
*
* @param failureType
* The type of job deployment failure that can cancel a job.
* @see IoTJobExecutionFailureType
*/
public void setFailureType(String failureType) {
this.failureType = failureType;
}
/**
*
* The type of job deployment failure that can cancel a job.
*
*
* @return The type of job deployment failure that can cancel a job.
* @see IoTJobExecutionFailureType
*/
public String getFailureType() {
return this.failureType;
}
/**
*
* The type of job deployment failure that can cancel a job.
*
*
* @param failureType
* The type of job deployment failure that can cancel a job.
* @return Returns a reference to this object so that method calls can be chained together.
* @see IoTJobExecutionFailureType
*/
public IoTJobAbortCriteria withFailureType(String failureType) {
setFailureType(failureType);
return this;
}
/**
*
* The type of job deployment failure that can cancel a job.
*
*
* @param failureType
* The type of job deployment failure that can cancel a job.
* @return Returns a reference to this object so that method calls can be chained together.
* @see IoTJobExecutionFailureType
*/
public IoTJobAbortCriteria withFailureType(IoTJobExecutionFailureType failureType) {
this.failureType = failureType.toString();
return this;
}
/**
*
* The action to perform when the criteria are met.
*
*
* @param action
* The action to perform when the criteria are met.
* @see IoTJobAbortAction
*/
public void setAction(String action) {
this.action = action;
}
/**
*
* The action to perform when the criteria are met.
*
*
* @return The action to perform when the criteria are met.
* @see IoTJobAbortAction
*/
public String getAction() {
return this.action;
}
/**
*
* The action to perform when the criteria are met.
*
*
* @param action
* The action to perform when the criteria are met.
* @return Returns a reference to this object so that method calls can be chained together.
* @see IoTJobAbortAction
*/
public IoTJobAbortCriteria withAction(String action) {
setAction(action);
return this;
}
/**
*
* The action to perform when the criteria are met.
*
*
* @param action
* The action to perform when the criteria are met.
* @return Returns a reference to this object so that method calls can be chained together.
* @see IoTJobAbortAction
*/
public IoTJobAbortCriteria withAction(IoTJobAbortAction action) {
this.action = action.toString();
return this;
}
/**
*
* The minimum percentage of failureType
failures that occur before the job can cancel.
*
*
* This parameter supports up to two digits after the decimal (for example, you can specify 10.9
or
* 10.99
, but not 10.999
).
*
*
* @param thresholdPercentage
* The minimum percentage of failureType
failures that occur before the job can cancel.
*
* This parameter supports up to two digits after the decimal (for example, you can specify 10.9
* or 10.99
, but not 10.999
).
*/
public void setThresholdPercentage(Double thresholdPercentage) {
this.thresholdPercentage = thresholdPercentage;
}
/**
*
* The minimum percentage of failureType
failures that occur before the job can cancel.
*
*
* This parameter supports up to two digits after the decimal (for example, you can specify 10.9
or
* 10.99
, but not 10.999
).
*
*
* @return The minimum percentage of failureType
failures that occur before the job can cancel.
*
* This parameter supports up to two digits after the decimal (for example, you can specify
* 10.9
or 10.99
, but not 10.999
).
*/
public Double getThresholdPercentage() {
return this.thresholdPercentage;
}
/**
*
* The minimum percentage of failureType
failures that occur before the job can cancel.
*
*
* This parameter supports up to two digits after the decimal (for example, you can specify 10.9
or
* 10.99
, but not 10.999
).
*
*
* @param thresholdPercentage
* The minimum percentage of failureType
failures that occur before the job can cancel.
*
* This parameter supports up to two digits after the decimal (for example, you can specify 10.9
* or 10.99
, but not 10.999
).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public IoTJobAbortCriteria withThresholdPercentage(Double thresholdPercentage) {
setThresholdPercentage(thresholdPercentage);
return this;
}
/**
*
* The minimum number of things that receive the configuration before the job can cancel.
*
*
* @param minNumberOfExecutedThings
* The minimum number of things that receive the configuration before the job can cancel.
*/
public void setMinNumberOfExecutedThings(Integer minNumberOfExecutedThings) {
this.minNumberOfExecutedThings = minNumberOfExecutedThings;
}
/**
*
* The minimum number of things that receive the configuration before the job can cancel.
*
*
* @return The minimum number of things that receive the configuration before the job can cancel.
*/
public Integer getMinNumberOfExecutedThings() {
return this.minNumberOfExecutedThings;
}
/**
*
* The minimum number of things that receive the configuration before the job can cancel.
*
*
* @param minNumberOfExecutedThings
* The minimum number of things that receive the configuration before the job can cancel.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public IoTJobAbortCriteria withMinNumberOfExecutedThings(Integer minNumberOfExecutedThings) {
setMinNumberOfExecutedThings(minNumberOfExecutedThings);
return this;
}
/**
* 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.
*
* @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: ").append(getFailureType()).append(",");
if (getAction() != null)
sb.append("Action: ").append(getAction()).append(",");
if (getThresholdPercentage() != null)
sb.append("ThresholdPercentage: ").append(getThresholdPercentage()).append(",");
if (getMinNumberOfExecutedThings() != null)
sb.append("MinNumberOfExecutedThings: ").append(getMinNumberOfExecutedThings());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof IoTJobAbortCriteria == false)
return false;
IoTJobAbortCriteria other = (IoTJobAbortCriteria) 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;
}
@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 IoTJobAbortCriteria clone() {
try {
return (IoTJobAbortCriteria) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.greengrassv2.model.transform.IoTJobAbortCriteriaMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}