/* * 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.batch.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *
* Specifies an array of up to 5 conditions to be met, and an action to take (RETRY
or EXIT
)
* if all conditions are met. If none of the EvaluateOnExit
conditions in a RetryStrategy
* match, then the job is retried.
*
* Contains a glob pattern to match against the StatusReason
returned for a job. The pattern can
* contain up to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white spaces
* (including spaces or tabs). It can optionally end with an asterisk (*) so that only the start of the string needs
* to be an exact match.
*
* Contains a glob pattern to match against the Reason
returned for a job. The pattern can contain up
* to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white space (including spaces
* and tabs). It can optionally end with an asterisk (*) so that only the start of the string needs to be an exact
* match.
*
* Contains a glob pattern to match against the decimal representation of the ExitCode
returned for a
* job. The pattern can be up to 512 characters long. It can contain only numbers, and can end with an asterisk (*)
* so that only the start of the string needs to be an exact match.
*
* The string can contain up to 512 characters. *
*/ private String onExitCode; /** *
* Specifies the action to take if all of the specified conditions (onStatusReason
,
* onReason
, and onExitCode
) are met. The values aren't case sensitive.
*
* Contains a glob pattern to match against the StatusReason
returned for a job. The pattern can
* contain up to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white spaces
* (including spaces or tabs). It can optionally end with an asterisk (*) so that only the start of the string needs
* to be an exact match.
*
StatusReason
returned for a job. The pattern can
* contain up to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white spaces
* (including spaces or tabs). It can optionally end with an asterisk (*) so that only the start of the
* string needs to be an exact match.
*/
public void setOnStatusReason(String onStatusReason) {
this.onStatusReason = onStatusReason;
}
/**
*
* Contains a glob pattern to match against the StatusReason
returned for a job. The pattern can
* contain up to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white spaces
* (including spaces or tabs). It can optionally end with an asterisk (*) so that only the start of the string needs
* to be an exact match.
*
StatusReason
returned for a job. The pattern
* can contain up to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white
* spaces (including spaces or tabs). It can optionally end with an asterisk (*) so that only the start of
* the string needs to be an exact match.
*/
public String getOnStatusReason() {
return this.onStatusReason;
}
/**
*
* Contains a glob pattern to match against the StatusReason
returned for a job. The pattern can
* contain up to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white spaces
* (including spaces or tabs). It can optionally end with an asterisk (*) so that only the start of the string needs
* to be an exact match.
*
StatusReason
returned for a job. The pattern can
* contain up to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white spaces
* (including spaces or tabs). It can optionally end with an asterisk (*) so that only the start of the
* string needs to be an exact match.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EvaluateOnExit withOnStatusReason(String onStatusReason) {
setOnStatusReason(onStatusReason);
return this;
}
/**
*
* Contains a glob pattern to match against the Reason
returned for a job. The pattern can contain up
* to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white space (including spaces
* and tabs). It can optionally end with an asterisk (*) so that only the start of the string needs to be an exact
* match.
*
Reason
returned for a job. The pattern can
* contain up to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white space
* (including spaces and tabs). It can optionally end with an asterisk (*) so that only the start of the
* string needs to be an exact match.
*/
public void setOnReason(String onReason) {
this.onReason = onReason;
}
/**
*
* Contains a glob pattern to match against the Reason
returned for a job. The pattern can contain up
* to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white space (including spaces
* and tabs). It can optionally end with an asterisk (*) so that only the start of the string needs to be an exact
* match.
*
Reason
returned for a job. The pattern can
* contain up to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white space
* (including spaces and tabs). It can optionally end with an asterisk (*) so that only the start of the
* string needs to be an exact match.
*/
public String getOnReason() {
return this.onReason;
}
/**
*
* Contains a glob pattern to match against the Reason
returned for a job. The pattern can contain up
* to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white space (including spaces
* and tabs). It can optionally end with an asterisk (*) so that only the start of the string needs to be an exact
* match.
*
Reason
returned for a job. The pattern can
* contain up to 512 characters. It can contain letters, numbers, periods (.), colons (:), and white space
* (including spaces and tabs). It can optionally end with an asterisk (*) so that only the start of the
* string needs to be an exact match.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public EvaluateOnExit withOnReason(String onReason) {
setOnReason(onReason);
return this;
}
/**
*
* Contains a glob pattern to match against the decimal representation of the ExitCode
returned for a
* job. The pattern can be up to 512 characters long. It can contain only numbers, and can end with an asterisk (*)
* so that only the start of the string needs to be an exact match.
*
* The string can contain up to 512 characters. *
* * @param onExitCode * Contains a glob pattern to match against the decimal representation of theExitCode
returned
* for a job. The pattern can be up to 512 characters long. It can contain only numbers, and can end with an
* asterisk (*) so that only the start of the string needs to be an exact match.
* * The string can contain up to 512 characters. */ public void setOnExitCode(String onExitCode) { this.onExitCode = onExitCode; } /** *
* Contains a glob pattern to match against the decimal representation of the ExitCode
returned for a
* job. The pattern can be up to 512 characters long. It can contain only numbers, and can end with an asterisk (*)
* so that only the start of the string needs to be an exact match.
*
* The string can contain up to 512 characters. *
* * @return Contains a glob pattern to match against the decimal representation of theExitCode
returned
* for a job. The pattern can be up to 512 characters long. It can contain only numbers, and can end with an
* asterisk (*) so that only the start of the string needs to be an exact match.
* * The string can contain up to 512 characters. */ public String getOnExitCode() { return this.onExitCode; } /** *
* Contains a glob pattern to match against the decimal representation of the ExitCode
returned for a
* job. The pattern can be up to 512 characters long. It can contain only numbers, and can end with an asterisk (*)
* so that only the start of the string needs to be an exact match.
*
* The string can contain up to 512 characters. *
* * @param onExitCode * Contains a glob pattern to match against the decimal representation of theExitCode
returned
* for a job. The pattern can be up to 512 characters long. It can contain only numbers, and can end with an
* asterisk (*) so that only the start of the string needs to be an exact match.
* * The string can contain up to 512 characters. * @return Returns a reference to this object so that method calls can be chained together. */ public EvaluateOnExit withOnExitCode(String onExitCode) { setOnExitCode(onExitCode); return this; } /** *
* Specifies the action to take if all of the specified conditions (onStatusReason
,
* onReason
, and onExitCode
) are met. The values aren't case sensitive.
*
onStatusReason
,
* onReason
, and onExitCode
) are met. The values aren't case sensitive.
* @see RetryAction
*/
public void setAction(String action) {
this.action = action;
}
/**
*
* Specifies the action to take if all of the specified conditions (onStatusReason
,
* onReason
, and onExitCode
) are met. The values aren't case sensitive.
*
onStatusReason
,
* onReason
, and onExitCode
) are met. The values aren't case sensitive.
* @see RetryAction
*/
public String getAction() {
return this.action;
}
/**
*
* Specifies the action to take if all of the specified conditions (onStatusReason
,
* onReason
, and onExitCode
) are met. The values aren't case sensitive.
*
onStatusReason
,
* onReason
, and onExitCode
) are met. The values aren't case sensitive.
* @return Returns a reference to this object so that method calls can be chained together.
* @see RetryAction
*/
public EvaluateOnExit withAction(String action) {
setAction(action);
return this;
}
/**
*
* Specifies the action to take if all of the specified conditions (onStatusReason
,
* onReason
, and onExitCode
) are met. The values aren't case sensitive.
*
onStatusReason
,
* onReason
, and onExitCode
) are met. The values aren't case sensitive.
* @return Returns a reference to this object so that method calls can be chained together.
* @see RetryAction
*/
public EvaluateOnExit withAction(RetryAction 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 (getOnStatusReason() != null)
sb.append("OnStatusReason: ").append(getOnStatusReason()).append(",");
if (getOnReason() != null)
sb.append("OnReason: ").append(getOnReason()).append(",");
if (getOnExitCode() != null)
sb.append("OnExitCode: ").append(getOnExitCode()).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 EvaluateOnExit == false)
return false;
EvaluateOnExit other = (EvaluateOnExit) obj;
if (other.getOnStatusReason() == null ^ this.getOnStatusReason() == null)
return false;
if (other.getOnStatusReason() != null && other.getOnStatusReason().equals(this.getOnStatusReason()) == false)
return false;
if (other.getOnReason() == null ^ this.getOnReason() == null)
return false;
if (other.getOnReason() != null && other.getOnReason().equals(this.getOnReason()) == false)
return false;
if (other.getOnExitCode() == null ^ this.getOnExitCode() == null)
return false;
if (other.getOnExitCode() != null && other.getOnExitCode().equals(this.getOnExitCode()) == 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 + ((getOnStatusReason() == null) ? 0 : getOnStatusReason().hashCode());
hashCode = prime * hashCode + ((getOnReason() == null) ? 0 : getOnReason().hashCode());
hashCode = prime * hashCode + ((getOnExitCode() == null) ? 0 : getOnExitCode().hashCode());
hashCode = prime * hashCode + ((getAction() == null) ? 0 : getAction().hashCode());
return hashCode;
}
@Override
public EvaluateOnExit clone() {
try {
return (EvaluateOnExit) 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.EvaluateOnExitMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}