/* * Copyright 2018-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; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; @Generated("com.amazonaws:aws-java-sdk-code-generator") public class CancelJobExecutionRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** *

* The ID of the job to be canceled. *

*/ private String jobId; /** *

* The name of the thing whose execution of the job will be canceled. *

*/ private String thingName; /** *

* (Optional) If true the job execution will be canceled if it has status IN_PROGRESS or QUEUED, * otherwise the job execution will be canceled only if it has status QUEUED. If you attempt to cancel a job * execution that is IN_PROGRESS, and you do not set force to true, then an * InvalidStateTransitionException will be thrown. The default is false. *

*

* Canceling a job execution which is "IN_PROGRESS", will cause the device to be unable to update the job execution * status. Use caution and ensure that the device is able to recover to a valid state. *

*/ private Boolean force; /** *

* (Optional) The expected current version of the job execution. Each time you update the job execution, its version * is incremented. If the version of the job execution stored in Jobs does not match, the update is rejected with a * VersionMismatch error, and an ErrorResponse that contains the current job execution status data is returned. * (This makes it unnecessary to perform a separate DescribeJobExecution request in order to obtain the job * execution status data.) *

*/ private Long expectedVersion; /** *

* A collection of name/value pairs that describe the status of the job execution. If not specified, the * statusDetails are unchanged. You can specify at most 10 name/value pairs. *

*/ private java.util.Map statusDetails; /** *

* The ID of the job to be canceled. *

* * @param jobId * The ID of the job to be canceled. */ public void setJobId(String jobId) { this.jobId = jobId; } /** *

* The ID of the job to be canceled. *

* * @return The ID of the job to be canceled. */ public String getJobId() { return this.jobId; } /** *

* The ID of the job to be canceled. *

* * @param jobId * The ID of the job to be canceled. * @return Returns a reference to this object so that method calls can be chained together. */ public CancelJobExecutionRequest withJobId(String jobId) { setJobId(jobId); return this; } /** *

* The name of the thing whose execution of the job will be canceled. *

* * @param thingName * The name of the thing whose execution of the job will be canceled. */ public void setThingName(String thingName) { this.thingName = thingName; } /** *

* The name of the thing whose execution of the job will be canceled. *

* * @return The name of the thing whose execution of the job will be canceled. */ public String getThingName() { return this.thingName; } /** *

* The name of the thing whose execution of the job will be canceled. *

* * @param thingName * The name of the thing whose execution of the job will be canceled. * @return Returns a reference to this object so that method calls can be chained together. */ public CancelJobExecutionRequest withThingName(String thingName) { setThingName(thingName); return this; } /** *

* (Optional) If true the job execution will be canceled if it has status IN_PROGRESS or QUEUED, * otherwise the job execution will be canceled only if it has status QUEUED. If you attempt to cancel a job * execution that is IN_PROGRESS, and you do not set force to true, then an * InvalidStateTransitionException will be thrown. The default is false. *

*

* Canceling a job execution which is "IN_PROGRESS", will cause the device to be unable to update the job execution * status. Use caution and ensure that the device is able to recover to a valid state. *

* * @param force * (Optional) If true the job execution will be canceled if it has status IN_PROGRESS or QUEUED, * otherwise the job execution will be canceled only if it has status QUEUED. If you attempt to cancel a job * execution that is IN_PROGRESS, and you do not set force to true, then an * InvalidStateTransitionException will be thrown. The default is false.

*

* Canceling a job execution which is "IN_PROGRESS", will cause the device to be unable to update the job * execution status. Use caution and ensure that the device is able to recover to a valid state. */ public void setForce(Boolean force) { this.force = force; } /** *

* (Optional) If true the job execution will be canceled if it has status IN_PROGRESS or QUEUED, * otherwise the job execution will be canceled only if it has status QUEUED. If you attempt to cancel a job * execution that is IN_PROGRESS, and you do not set force to true, then an * InvalidStateTransitionException will be thrown. The default is false. *

*

* Canceling a job execution which is "IN_PROGRESS", will cause the device to be unable to update the job execution * status. Use caution and ensure that the device is able to recover to a valid state. *

* * @return (Optional) If true the job execution will be canceled if it has status IN_PROGRESS or * QUEUED, otherwise the job execution will be canceled only if it has status QUEUED. If you attempt to * cancel a job execution that is IN_PROGRESS, and you do not set force to true, * then an InvalidStateTransitionException will be thrown. The default is false * .

*

* Canceling a job execution which is "IN_PROGRESS", will cause the device to be unable to update the job * execution status. Use caution and ensure that the device is able to recover to a valid state. */ public Boolean getForce() { return this.force; } /** *

* (Optional) If true the job execution will be canceled if it has status IN_PROGRESS or QUEUED, * otherwise the job execution will be canceled only if it has status QUEUED. If you attempt to cancel a job * execution that is IN_PROGRESS, and you do not set force to true, then an * InvalidStateTransitionException will be thrown. The default is false. *

*

* Canceling a job execution which is "IN_PROGRESS", will cause the device to be unable to update the job execution * status. Use caution and ensure that the device is able to recover to a valid state. *

* * @param force * (Optional) If true the job execution will be canceled if it has status IN_PROGRESS or QUEUED, * otherwise the job execution will be canceled only if it has status QUEUED. If you attempt to cancel a job * execution that is IN_PROGRESS, and you do not set force to true, then an * InvalidStateTransitionException will be thrown. The default is false.

*

* Canceling a job execution which is "IN_PROGRESS", will cause the device to be unable to update the job * execution status. Use caution and ensure that the device is able to recover to a valid state. * @return Returns a reference to this object so that method calls can be chained together. */ public CancelJobExecutionRequest withForce(Boolean force) { setForce(force); return this; } /** *

* (Optional) If true the job execution will be canceled if it has status IN_PROGRESS or QUEUED, * otherwise the job execution will be canceled only if it has status QUEUED. If you attempt to cancel a job * execution that is IN_PROGRESS, and you do not set force to true, then an * InvalidStateTransitionException will be thrown. The default is false. *

*

* Canceling a job execution which is "IN_PROGRESS", will cause the device to be unable to update the job execution * status. Use caution and ensure that the device is able to recover to a valid state. *

* * @return (Optional) If true the job execution will be canceled if it has status IN_PROGRESS or * QUEUED, otherwise the job execution will be canceled only if it has status QUEUED. If you attempt to * cancel a job execution that is IN_PROGRESS, and you do not set force to true, * then an InvalidStateTransitionException will be thrown. The default is false * .

*

* Canceling a job execution which is "IN_PROGRESS", will cause the device to be unable to update the job * execution status. Use caution and ensure that the device is able to recover to a valid state. */ public Boolean isForce() { return this.force; } /** *

* (Optional) The expected current version of the job execution. Each time you update the job execution, its version * is incremented. If the version of the job execution stored in Jobs does not match, the update is rejected with a * VersionMismatch error, and an ErrorResponse that contains the current job execution status data is returned. * (This makes it unnecessary to perform a separate DescribeJobExecution request in order to obtain the job * execution status data.) *

* * @param expectedVersion * (Optional) The expected current version of the job execution. Each time you update the job execution, its * version is incremented. If the version of the job execution stored in Jobs does not match, the update is * rejected with a VersionMismatch error, and an ErrorResponse that contains the current job execution status * data is returned. (This makes it unnecessary to perform a separate DescribeJobExecution request in order * to obtain the job execution status data.) */ public void setExpectedVersion(Long expectedVersion) { this.expectedVersion = expectedVersion; } /** *

* (Optional) The expected current version of the job execution. Each time you update the job execution, its version * is incremented. If the version of the job execution stored in Jobs does not match, the update is rejected with a * VersionMismatch error, and an ErrorResponse that contains the current job execution status data is returned. * (This makes it unnecessary to perform a separate DescribeJobExecution request in order to obtain the job * execution status data.) *

* * @return (Optional) The expected current version of the job execution. Each time you update the job execution, its * version is incremented. If the version of the job execution stored in Jobs does not match, the update is * rejected with a VersionMismatch error, and an ErrorResponse that contains the current job execution * status data is returned. (This makes it unnecessary to perform a separate DescribeJobExecution request in * order to obtain the job execution status data.) */ public Long getExpectedVersion() { return this.expectedVersion; } /** *

* (Optional) The expected current version of the job execution. Each time you update the job execution, its version * is incremented. If the version of the job execution stored in Jobs does not match, the update is rejected with a * VersionMismatch error, and an ErrorResponse that contains the current job execution status data is returned. * (This makes it unnecessary to perform a separate DescribeJobExecution request in order to obtain the job * execution status data.) *

* * @param expectedVersion * (Optional) The expected current version of the job execution. Each time you update the job execution, its * version is incremented. If the version of the job execution stored in Jobs does not match, the update is * rejected with a VersionMismatch error, and an ErrorResponse that contains the current job execution status * data is returned. (This makes it unnecessary to perform a separate DescribeJobExecution request in order * to obtain the job execution status data.) * @return Returns a reference to this object so that method calls can be chained together. */ public CancelJobExecutionRequest withExpectedVersion(Long expectedVersion) { setExpectedVersion(expectedVersion); return this; } /** *

* A collection of name/value pairs that describe the status of the job execution. If not specified, the * statusDetails are unchanged. You can specify at most 10 name/value pairs. *

* * @return A collection of name/value pairs that describe the status of the job execution. If not specified, the * statusDetails are unchanged. You can specify at most 10 name/value pairs. */ public java.util.Map getStatusDetails() { return statusDetails; } /** *

* A collection of name/value pairs that describe the status of the job execution. If not specified, the * statusDetails are unchanged. You can specify at most 10 name/value pairs. *

* * @param statusDetails * A collection of name/value pairs that describe the status of the job execution. If not specified, the * statusDetails are unchanged. You can specify at most 10 name/value pairs. */ public void setStatusDetails(java.util.Map statusDetails) { this.statusDetails = statusDetails; } /** *

* A collection of name/value pairs that describe the status of the job execution. If not specified, the * statusDetails are unchanged. You can specify at most 10 name/value pairs. *

* * @param statusDetails * A collection of name/value pairs that describe the status of the job execution. If not specified, the * statusDetails are unchanged. You can specify at most 10 name/value pairs. * @return Returns a reference to this object so that method calls can be chained together. */ public CancelJobExecutionRequest withStatusDetails(java.util.Map statusDetails) { setStatusDetails(statusDetails); return this; } /** * Add a single StatusDetails entry * * @see CancelJobExecutionRequest#withStatusDetails * @returns a reference to this object so that method calls can be chained together. */ public CancelJobExecutionRequest addStatusDetailsEntry(String key, String value) { if (null == this.statusDetails) { this.statusDetails = new java.util.HashMap(); } if (this.statusDetails.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.statusDetails.put(key, value); return this; } /** * Removes all the entries added into StatusDetails. * * @return Returns a reference to this object so that method calls can be chained together. */ public CancelJobExecutionRequest clearStatusDetailsEntries() { this.statusDetails = null; 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 (getJobId() != null) sb.append("JobId: ").append(getJobId()).append(","); if (getThingName() != null) sb.append("ThingName: ").append(getThingName()).append(","); if (getForce() != null) sb.append("Force: ").append(getForce()).append(","); if (getExpectedVersion() != null) sb.append("ExpectedVersion: ").append(getExpectedVersion()).append(","); if (getStatusDetails() != null) sb.append("StatusDetails: ").append(getStatusDetails()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CancelJobExecutionRequest == false) return false; CancelJobExecutionRequest other = (CancelJobExecutionRequest) obj; if (other.getJobId() == null ^ this.getJobId() == null) return false; if (other.getJobId() != null && other.getJobId().equals(this.getJobId()) == false) return false; if (other.getThingName() == null ^ this.getThingName() == null) return false; if (other.getThingName() != null && other.getThingName().equals(this.getThingName()) == false) return false; if (other.getForce() == null ^ this.getForce() == null) return false; if (other.getForce() != null && other.getForce().equals(this.getForce()) == false) return false; if (other.getExpectedVersion() == null ^ this.getExpectedVersion() == null) return false; if (other.getExpectedVersion() != null && other.getExpectedVersion().equals(this.getExpectedVersion()) == false) return false; if (other.getStatusDetails() == null ^ this.getStatusDetails() == null) return false; if (other.getStatusDetails() != null && other.getStatusDetails().equals(this.getStatusDetails()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getJobId() == null) ? 0 : getJobId().hashCode()); hashCode = prime * hashCode + ((getThingName() == null) ? 0 : getThingName().hashCode()); hashCode = prime * hashCode + ((getForce() == null) ? 0 : getForce().hashCode()); hashCode = prime * hashCode + ((getExpectedVersion() == null) ? 0 : getExpectedVersion().hashCode()); hashCode = prime * hashCode + ((getStatusDetails() == null) ? 0 : getStatusDetails().hashCode()); return hashCode; } @Override public CancelJobExecutionRequest clone() { return (CancelJobExecutionRequest) super.clone(); } }