/* * 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.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Describes a rule. *

*/ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class TopicRulePayload implements Serializable, Cloneable, StructuredPojo { /** *

* The SQL statement used to query the topic. For more information, see IoT SQL Reference in the * IoT Developer Guide. *

*/ private String sql; /** *

* The description of the rule. *

*/ private String description; /** *

* The actions associated with the rule. *

*/ private java.util.List actions; /** *

* Specifies whether the rule is disabled. *

*/ private Boolean ruleDisabled; /** *

* The version of the SQL rules engine to use when evaluating the rule. *

*/ private String awsIotSqlVersion; /** *

* The action to take when an error occurs. *

*/ private Action errorAction; /** *

* The SQL statement used to query the topic. For more information, see IoT SQL Reference in the * IoT Developer Guide. *

* * @param sql * The SQL statement used to query the topic. For more information, see IoT SQL Reference * in the IoT Developer Guide. */ public void setSql(String sql) { this.sql = sql; } /** *

* The SQL statement used to query the topic. For more information, see IoT SQL Reference in the * IoT Developer Guide. *

* * @return The SQL statement used to query the topic. For more information, see IoT SQL Reference * in the IoT Developer Guide. */ public String getSql() { return this.sql; } /** *

* The SQL statement used to query the topic. For more information, see IoT SQL Reference in the * IoT Developer Guide. *

* * @param sql * The SQL statement used to query the topic. For more information, see IoT SQL Reference * in the IoT Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ public TopicRulePayload withSql(String sql) { setSql(sql); return this; } /** *

* The description of the rule. *

* * @param description * The description of the rule. */ public void setDescription(String description) { this.description = description; } /** *

* The description of the rule. *

* * @return The description of the rule. */ public String getDescription() { return this.description; } /** *

* The description of the rule. *

* * @param description * The description of the rule. * @return Returns a reference to this object so that method calls can be chained together. */ public TopicRulePayload withDescription(String description) { setDescription(description); return this; } /** *

* The actions associated with the rule. *

* * @return The actions associated with the rule. */ public java.util.List getActions() { return actions; } /** *

* The actions associated with the rule. *

* * @param actions * The actions associated with the rule. */ public void setActions(java.util.Collection actions) { if (actions == null) { this.actions = null; return; } this.actions = new java.util.ArrayList(actions); } /** *

* The actions associated with the rule. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setActions(java.util.Collection)} or {@link #withActions(java.util.Collection)} if you want to override * the existing values. *

* * @param actions * The actions associated with the rule. * @return Returns a reference to this object so that method calls can be chained together. */ public TopicRulePayload withActions(Action... actions) { if (this.actions == null) { setActions(new java.util.ArrayList(actions.length)); } for (Action ele : actions) { this.actions.add(ele); } return this; } /** *

* The actions associated with the rule. *

* * @param actions * The actions associated with the rule. * @return Returns a reference to this object so that method calls can be chained together. */ public TopicRulePayload withActions(java.util.Collection actions) { setActions(actions); return this; } /** *

* Specifies whether the rule is disabled. *

* * @param ruleDisabled * Specifies whether the rule is disabled. */ public void setRuleDisabled(Boolean ruleDisabled) { this.ruleDisabled = ruleDisabled; } /** *

* Specifies whether the rule is disabled. *

* * @return Specifies whether the rule is disabled. */ public Boolean getRuleDisabled() { return this.ruleDisabled; } /** *

* Specifies whether the rule is disabled. *

* * @param ruleDisabled * Specifies whether the rule is disabled. * @return Returns a reference to this object so that method calls can be chained together. */ public TopicRulePayload withRuleDisabled(Boolean ruleDisabled) { setRuleDisabled(ruleDisabled); return this; } /** *

* Specifies whether the rule is disabled. *

* * @return Specifies whether the rule is disabled. */ public Boolean isRuleDisabled() { return this.ruleDisabled; } /** *

* The version of the SQL rules engine to use when evaluating the rule. *

* * @param awsIotSqlVersion * The version of the SQL rules engine to use when evaluating the rule. */ public void setAwsIotSqlVersion(String awsIotSqlVersion) { this.awsIotSqlVersion = awsIotSqlVersion; } /** *

* The version of the SQL rules engine to use when evaluating the rule. *

* * @return The version of the SQL rules engine to use when evaluating the rule. */ public String getAwsIotSqlVersion() { return this.awsIotSqlVersion; } /** *

* The version of the SQL rules engine to use when evaluating the rule. *

* * @param awsIotSqlVersion * The version of the SQL rules engine to use when evaluating the rule. * @return Returns a reference to this object so that method calls can be chained together. */ public TopicRulePayload withAwsIotSqlVersion(String awsIotSqlVersion) { setAwsIotSqlVersion(awsIotSqlVersion); return this; } /** *

* The action to take when an error occurs. *

* * @param errorAction * The action to take when an error occurs. */ public void setErrorAction(Action errorAction) { this.errorAction = errorAction; } /** *

* The action to take when an error occurs. *

* * @return The action to take when an error occurs. */ public Action getErrorAction() { return this.errorAction; } /** *

* The action to take when an error occurs. *

* * @param errorAction * The action to take when an error occurs. * @return Returns a reference to this object so that method calls can be chained together. */ public TopicRulePayload withErrorAction(Action errorAction) { setErrorAction(errorAction); 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 (getSql() != null) sb.append("Sql: ").append(getSql()).append(","); if (getDescription() != null) sb.append("Description: ").append(getDescription()).append(","); if (getActions() != null) sb.append("Actions: ").append(getActions()).append(","); if (getRuleDisabled() != null) sb.append("RuleDisabled: ").append(getRuleDisabled()).append(","); if (getAwsIotSqlVersion() != null) sb.append("AwsIotSqlVersion: ").append(getAwsIotSqlVersion()).append(","); if (getErrorAction() != null) sb.append("ErrorAction: ").append(getErrorAction()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof TopicRulePayload == false) return false; TopicRulePayload other = (TopicRulePayload) obj; if (other.getSql() == null ^ this.getSql() == null) return false; if (other.getSql() != null && other.getSql().equals(this.getSql()) == false) return false; if (other.getDescription() == null ^ this.getDescription() == null) return false; if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false) return false; if (other.getActions() == null ^ this.getActions() == null) return false; if (other.getActions() != null && other.getActions().equals(this.getActions()) == false) return false; if (other.getRuleDisabled() == null ^ this.getRuleDisabled() == null) return false; if (other.getRuleDisabled() != null && other.getRuleDisabled().equals(this.getRuleDisabled()) == false) return false; if (other.getAwsIotSqlVersion() == null ^ this.getAwsIotSqlVersion() == null) return false; if (other.getAwsIotSqlVersion() != null && other.getAwsIotSqlVersion().equals(this.getAwsIotSqlVersion()) == false) return false; if (other.getErrorAction() == null ^ this.getErrorAction() == null) return false; if (other.getErrorAction() != null && other.getErrorAction().equals(this.getErrorAction()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getSql() == null) ? 0 : getSql().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getActions() == null) ? 0 : getActions().hashCode()); hashCode = prime * hashCode + ((getRuleDisabled() == null) ? 0 : getRuleDisabled().hashCode()); hashCode = prime * hashCode + ((getAwsIotSqlVersion() == null) ? 0 : getAwsIotSqlVersion().hashCode()); hashCode = prime * hashCode + ((getErrorAction() == null) ? 0 : getErrorAction().hashCode()); return hashCode; } @Override public TopicRulePayload clone() { try { return (TopicRulePayload) 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.iot.model.transform.TopicRulePayloadMarshaller.getInstance().marshall(this, protocolMarshaller); } }