com.amazonaws.services.batch.model.JobStateTimeLimitAction Maven / Gradle / Ivy
Show all versions of aws-java-sdk-batch 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.batch.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Specifies an action that Batch will take after the job has remained at the head of the queue in the specified state
* for longer than the specified time.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class JobStateTimeLimitAction implements Serializable, Cloneable, StructuredPojo {
/**
*
* The reason to log for the action being taken.
*
*/
private String reason;
/**
*
* The state of the job needed to trigger the action. The only supported value is RUNNABLE
.
*
*/
private String state;
/**
*
* The approximate amount of time, in seconds, that must pass with the job in the specified state before the action
* is taken. The minimum value is 600 (10 minutes) and the maximum value is 86,400 (24 hours).
*
*/
private Integer maxTimeSeconds;
/**
*
* The action to take when a job is at the head of the job queue in the specified state for the specified period of
* time. The only supported value is CANCEL
, which will cancel the job.
*
*/
private String action;
/**
*
* The reason to log for the action being taken.
*
*
* @param reason
* The reason to log for the action being taken.
*/
public void setReason(String reason) {
this.reason = reason;
}
/**
*
* The reason to log for the action being taken.
*
*
* @return The reason to log for the action being taken.
*/
public String getReason() {
return this.reason;
}
/**
*
* The reason to log for the action being taken.
*
*
* @param reason
* The reason to log for the action being taken.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public JobStateTimeLimitAction withReason(String reason) {
setReason(reason);
return this;
}
/**
*
* The state of the job needed to trigger the action. The only supported value is RUNNABLE
.
*
*
* @param state
* The state of the job needed to trigger the action. The only supported value is RUNNABLE
.
* @see JobStateTimeLimitActionsState
*/
public void setState(String state) {
this.state = state;
}
/**
*
* The state of the job needed to trigger the action. The only supported value is RUNNABLE
.
*
*
* @return The state of the job needed to trigger the action. The only supported value is RUNNABLE
.
* @see JobStateTimeLimitActionsState
*/
public String getState() {
return this.state;
}
/**
*
* The state of the job needed to trigger the action. The only supported value is RUNNABLE
.
*
*
* @param state
* The state of the job needed to trigger the action. The only supported value is RUNNABLE
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see JobStateTimeLimitActionsState
*/
public JobStateTimeLimitAction withState(String state) {
setState(state);
return this;
}
/**
*
* The state of the job needed to trigger the action. The only supported value is RUNNABLE
.
*
*
* @param state
* The state of the job needed to trigger the action. The only supported value is RUNNABLE
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see JobStateTimeLimitActionsState
*/
public JobStateTimeLimitAction withState(JobStateTimeLimitActionsState state) {
this.state = state.toString();
return this;
}
/**
*
* The approximate amount of time, in seconds, that must pass with the job in the specified state before the action
* is taken. The minimum value is 600 (10 minutes) and the maximum value is 86,400 (24 hours).
*
*
* @param maxTimeSeconds
* The approximate amount of time, in seconds, that must pass with the job in the specified state before the
* action is taken. The minimum value is 600 (10 minutes) and the maximum value is 86,400 (24 hours).
*/
public void setMaxTimeSeconds(Integer maxTimeSeconds) {
this.maxTimeSeconds = maxTimeSeconds;
}
/**
*
* The approximate amount of time, in seconds, that must pass with the job in the specified state before the action
* is taken. The minimum value is 600 (10 minutes) and the maximum value is 86,400 (24 hours).
*
*
* @return The approximate amount of time, in seconds, that must pass with the job in the specified state before the
* action is taken. The minimum value is 600 (10 minutes) and the maximum value is 86,400 (24 hours).
*/
public Integer getMaxTimeSeconds() {
return this.maxTimeSeconds;
}
/**
*
* The approximate amount of time, in seconds, that must pass with the job in the specified state before the action
* is taken. The minimum value is 600 (10 minutes) and the maximum value is 86,400 (24 hours).
*
*
* @param maxTimeSeconds
* The approximate amount of time, in seconds, that must pass with the job in the specified state before the
* action is taken. The minimum value is 600 (10 minutes) and the maximum value is 86,400 (24 hours).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public JobStateTimeLimitAction withMaxTimeSeconds(Integer maxTimeSeconds) {
setMaxTimeSeconds(maxTimeSeconds);
return this;
}
/**
*
* The action to take when a job is at the head of the job queue in the specified state for the specified period of
* time. The only supported value is CANCEL
, which will cancel the job.
*
*
* @param action
* The action to take when a job is at the head of the job queue in the specified state for the specified
* period of time. The only supported value is CANCEL
, which will cancel the job.
* @see JobStateTimeLimitActionsAction
*/
public void setAction(String action) {
this.action = action;
}
/**
*
* The action to take when a job is at the head of the job queue in the specified state for the specified period of
* time. The only supported value is CANCEL
, which will cancel the job.
*
*
* @return The action to take when a job is at the head of the job queue in the specified state for the specified
* period of time. The only supported value is CANCEL
, which will cancel the job.
* @see JobStateTimeLimitActionsAction
*/
public String getAction() {
return this.action;
}
/**
*
* The action to take when a job is at the head of the job queue in the specified state for the specified period of
* time. The only supported value is CANCEL
, which will cancel the job.
*
*
* @param action
* The action to take when a job is at the head of the job queue in the specified state for the specified
* period of time. The only supported value is CANCEL
, which will cancel the job.
* @return Returns a reference to this object so that method calls can be chained together.
* @see JobStateTimeLimitActionsAction
*/
public JobStateTimeLimitAction withAction(String action) {
setAction(action);
return this;
}
/**
*
* The action to take when a job is at the head of the job queue in the specified state for the specified period of
* time. The only supported value is CANCEL
, which will cancel the job.
*
*
* @param action
* The action to take when a job is at the head of the job queue in the specified state for the specified
* period of time. The only supported value is CANCEL
, which will cancel the job.
* @return Returns a reference to this object so that method calls can be chained together.
* @see JobStateTimeLimitActionsAction
*/
public JobStateTimeLimitAction withAction(JobStateTimeLimitActionsAction action) {
this.action = action.toString();
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 (getReason() != null)
sb.append("Reason: ").append(getReason()).append(",");
if (getState() != null)
sb.append("State: ").append(getState()).append(",");
if (getMaxTimeSeconds() != null)
sb.append("MaxTimeSeconds: ").append(getMaxTimeSeconds()).append(",");
if (getAction() != null)
sb.append("Action: ").append(getAction());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof JobStateTimeLimitAction == false)
return false;
JobStateTimeLimitAction other = (JobStateTimeLimitAction) obj;
if (other.getReason() == null ^ this.getReason() == null)
return false;
if (other.getReason() != null && other.getReason().equals(this.getReason()) == false)
return false;
if (other.getState() == null ^ this.getState() == null)
return false;
if (other.getState() != null && other.getState().equals(this.getState()) == false)
return false;
if (other.getMaxTimeSeconds() == null ^ this.getMaxTimeSeconds() == null)
return false;
if (other.getMaxTimeSeconds() != null && other.getMaxTimeSeconds().equals(this.getMaxTimeSeconds()) == false)
return false;
if (other.getAction() == null ^ this.getAction() == null)
return false;
if (other.getAction() != null && other.getAction().equals(this.getAction()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getReason() == null) ? 0 : getReason().hashCode());
hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode());
hashCode = prime * hashCode + ((getMaxTimeSeconds() == null) ? 0 : getMaxTimeSeconds().hashCode());
hashCode = prime * hashCode + ((getAction() == null) ? 0 : getAction().hashCode());
return hashCode;
}
@Override
public JobStateTimeLimitAction clone() {
try {
return (JobStateTimeLimitAction) 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.batch.model.transform.JobStateTimeLimitActionMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}