/* * 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; /** *

* The authorizer result. *

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

* Authorization information. *

*/ private AuthInfo authInfo; /** *

* The policies and statements that allowed the specified action. *

*/ private Allowed allowed; /** *

* The policies and statements that denied the specified action. *

*/ private Denied denied; /** *

* The final authorization decision of this scenario. Multiple statements are taken into account when determining * the authorization decision. An explicit deny statement can override multiple allow statements. *

*/ private String authDecision; /** *

* Contains any missing context values found while evaluating policy. *

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

* Authorization information. *

* * @param authInfo * Authorization information. */ public void setAuthInfo(AuthInfo authInfo) { this.authInfo = authInfo; } /** *

* Authorization information. *

* * @return Authorization information. */ public AuthInfo getAuthInfo() { return this.authInfo; } /** *

* Authorization information. *

* * @param authInfo * Authorization information. * @return Returns a reference to this object so that method calls can be chained together. */ public AuthResult withAuthInfo(AuthInfo authInfo) { setAuthInfo(authInfo); return this; } /** *

* The policies and statements that allowed the specified action. *

* * @param allowed * The policies and statements that allowed the specified action. */ public void setAllowed(Allowed allowed) { this.allowed = allowed; } /** *

* The policies and statements that allowed the specified action. *

* * @return The policies and statements that allowed the specified action. */ public Allowed getAllowed() { return this.allowed; } /** *

* The policies and statements that allowed the specified action. *

* * @param allowed * The policies and statements that allowed the specified action. * @return Returns a reference to this object so that method calls can be chained together. */ public AuthResult withAllowed(Allowed allowed) { setAllowed(allowed); return this; } /** *

* The policies and statements that denied the specified action. *

* * @param denied * The policies and statements that denied the specified action. */ public void setDenied(Denied denied) { this.denied = denied; } /** *

* The policies and statements that denied the specified action. *

* * @return The policies and statements that denied the specified action. */ public Denied getDenied() { return this.denied; } /** *

* The policies and statements that denied the specified action. *

* * @param denied * The policies and statements that denied the specified action. * @return Returns a reference to this object so that method calls can be chained together. */ public AuthResult withDenied(Denied denied) { setDenied(denied); return this; } /** *

* The final authorization decision of this scenario. Multiple statements are taken into account when determining * the authorization decision. An explicit deny statement can override multiple allow statements. *

* * @param authDecision * The final authorization decision of this scenario. Multiple statements are taken into account when * determining the authorization decision. An explicit deny statement can override multiple allow statements. * @see AuthDecision */ public void setAuthDecision(String authDecision) { this.authDecision = authDecision; } /** *

* The final authorization decision of this scenario. Multiple statements are taken into account when determining * the authorization decision. An explicit deny statement can override multiple allow statements. *

* * @return The final authorization decision of this scenario. Multiple statements are taken into account when * determining the authorization decision. An explicit deny statement can override multiple allow * statements. * @see AuthDecision */ public String getAuthDecision() { return this.authDecision; } /** *

* The final authorization decision of this scenario. Multiple statements are taken into account when determining * the authorization decision. An explicit deny statement can override multiple allow statements. *

* * @param authDecision * The final authorization decision of this scenario. Multiple statements are taken into account when * determining the authorization decision. An explicit deny statement can override multiple allow statements. * @return Returns a reference to this object so that method calls can be chained together. * @see AuthDecision */ public AuthResult withAuthDecision(String authDecision) { setAuthDecision(authDecision); return this; } /** *

* The final authorization decision of this scenario. Multiple statements are taken into account when determining * the authorization decision. An explicit deny statement can override multiple allow statements. *

* * @param authDecision * The final authorization decision of this scenario. Multiple statements are taken into account when * determining the authorization decision. An explicit deny statement can override multiple allow statements. * @return Returns a reference to this object so that method calls can be chained together. * @see AuthDecision */ public AuthResult withAuthDecision(AuthDecision authDecision) { this.authDecision = authDecision.toString(); return this; } /** *

* Contains any missing context values found while evaluating policy. *

* * @return Contains any missing context values found while evaluating policy. */ public java.util.List getMissingContextValues() { return missingContextValues; } /** *

* Contains any missing context values found while evaluating policy. *

* * @param missingContextValues * Contains any missing context values found while evaluating policy. */ public void setMissingContextValues(java.util.Collection missingContextValues) { if (missingContextValues == null) { this.missingContextValues = null; return; } this.missingContextValues = new java.util.ArrayList(missingContextValues); } /** *

* Contains any missing context values found while evaluating policy. *

*

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

* * @param missingContextValues * Contains any missing context values found while evaluating policy. * @return Returns a reference to this object so that method calls can be chained together. */ public AuthResult withMissingContextValues(String... missingContextValues) { if (this.missingContextValues == null) { setMissingContextValues(new java.util.ArrayList(missingContextValues.length)); } for (String ele : missingContextValues) { this.missingContextValues.add(ele); } return this; } /** *

* Contains any missing context values found while evaluating policy. *

* * @param missingContextValues * Contains any missing context values found while evaluating policy. * @return Returns a reference to this object so that method calls can be chained together. */ public AuthResult withMissingContextValues(java.util.Collection missingContextValues) { setMissingContextValues(missingContextValues); 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 (getAuthInfo() != null) sb.append("AuthInfo: ").append(getAuthInfo()).append(","); if (getAllowed() != null) sb.append("Allowed: ").append(getAllowed()).append(","); if (getDenied() != null) sb.append("Denied: ").append(getDenied()).append(","); if (getAuthDecision() != null) sb.append("AuthDecision: ").append(getAuthDecision()).append(","); if (getMissingContextValues() != null) sb.append("MissingContextValues: ").append(getMissingContextValues()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AuthResult == false) return false; AuthResult other = (AuthResult) obj; if (other.getAuthInfo() == null ^ this.getAuthInfo() == null) return false; if (other.getAuthInfo() != null && other.getAuthInfo().equals(this.getAuthInfo()) == false) return false; if (other.getAllowed() == null ^ this.getAllowed() == null) return false; if (other.getAllowed() != null && other.getAllowed().equals(this.getAllowed()) == false) return false; if (other.getDenied() == null ^ this.getDenied() == null) return false; if (other.getDenied() != null && other.getDenied().equals(this.getDenied()) == false) return false; if (other.getAuthDecision() == null ^ this.getAuthDecision() == null) return false; if (other.getAuthDecision() != null && other.getAuthDecision().equals(this.getAuthDecision()) == false) return false; if (other.getMissingContextValues() == null ^ this.getMissingContextValues() == null) return false; if (other.getMissingContextValues() != null && other.getMissingContextValues().equals(this.getMissingContextValues()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAuthInfo() == null) ? 0 : getAuthInfo().hashCode()); hashCode = prime * hashCode + ((getAllowed() == null) ? 0 : getAllowed().hashCode()); hashCode = prime * hashCode + ((getDenied() == null) ? 0 : getDenied().hashCode()); hashCode = prime * hashCode + ((getAuthDecision() == null) ? 0 : getAuthDecision().hashCode()); hashCode = prime * hashCode + ((getMissingContextValues() == null) ? 0 : getMissingContextValues().hashCode()); return hashCode; } @Override public AuthResult clone() { try { return (AuthResult) 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.AuthResultMarshaller.getInstance().marshall(this, protocolMarshaller); } }