/* * 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; import com.amazonaws.AmazonWebServiceRequest; /** *
* Cancels the execution of a job for a given thing. *
** Requires permission to access the CancelJobExecution action. *
*/ public class CancelJobExecutionRequest extends AmazonWebServiceRequest implements Serializable { /** ** The ID of the job to be canceled. *
*
* Constraints:
* Length: 1 - 64
* Pattern: [a-zA-Z0-9_-]+
*/
private String jobId;
/**
*
* The name of the thing whose execution of the job will be canceled. *
*
* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9:_-]+
*/
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* The ID of the job to be canceled. *
*
* Constraints:
* Length: 1 - 64
* Pattern: [a-zA-Z0-9_-]+
*
* @return
* The ID of the job to be canceled. *
*/ public String getJobId() { return jobId; } /** ** The ID of the job to be canceled. *
*
* Constraints:
* Length: 1 - 64
* Pattern: [a-zA-Z0-9_-]+
*
* @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. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 64
* Pattern: [a-zA-Z0-9_-]+
*
* @param jobId
* The ID of the job to be canceled. *
* @return A reference to this updated object so that method calls can be * chained together. */ public CancelJobExecutionRequest withJobId(String jobId) { this.jobId = jobId; return this; } /** ** The name of the thing whose execution of the job will be canceled. *
*
* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9:_-]+
*
* @return
* The name of the thing whose execution of the job will be * canceled. *
*/ public String getThingName() { return thingName; } /** ** The name of the thing whose execution of the job will be canceled. *
*
* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9:_-]+
*
* @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. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9:_-]+
*
* @param thingName
* The name of the thing whose execution of the job will be * canceled. *
* @return A reference to this updated object so that method calls can be * chained together. */ public CancelJobExecutionRequest withThingName(String thingName) { this.thingName = 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. *
* * @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 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 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. *
*/ 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. *
** Returns a reference to this object so that method calls can be chained * together. * * @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 A reference to this updated object so that method calls can be * chained together. */ public CancelJobExecutionRequest withForce(Boolean force) { this.force = force; return this; } /** ** (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 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.) *
*/ 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.) *
** Returns a reference to this object so that method calls can be chained * together. * * @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 A reference to this updated object so that method calls can be * chained together. */ public CancelJobExecutionRequest withExpectedVersion(Long expectedVersion) { this.expectedVersion = 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* 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* 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. *
** Returns a reference to this object so that method calls can be chained * together. * * @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 A reference to this updated object so that method calls can be * chained together. */ public CancelJobExecutionRequest withStatusDetails(java.util.Map* 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. *
*
* The method adds a new key-value pair into statusDetails parameter, and
* returns a reference to this object so that method calls can be chained
* together.
*
* @param key The key of the entry to be added into statusDetails.
* @param value The corresponding value of the entry to be added into
* statusDetails.
* @return A reference to this updated 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
* 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; 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 (getJobId() != null)
sb.append("jobId: " + getJobId() + ",");
if (getThingName() != null)
sb.append("thingName: " + getThingName() + ",");
if (getForce() != null)
sb.append("force: " + getForce() + ",");
if (getExpectedVersion() != null)
sb.append("expectedVersion: " + getExpectedVersion() + ",");
if (getStatusDetails() != null)
sb.append("statusDetails: " + getStatusDetails());
sb.append("}");
return sb.toString();
}
@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 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;
}
}