/* * 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.apigateway.model; import java.io.Serializable; import javax.annotation.Generated; /** *

* Represents the response of the test invoke request for a custom Authorizer *

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

* The HTTP status code that the client would have received. Value is 0 if the authorizer succeeded. *

*/ private Integer clientStatus; /** *

* The API Gateway execution log for the test authorizer request. *

*/ private String log; /** *

* The execution latency of the test authorizer request. *

*/ private Long latency; /** *

* The principal identity returned by the Authorizer *

*/ private String principalId; /** *

* The JSON policy document returned by the Authorizer *

*/ private String policy; /** *

* The authorization response. *

*/ private java.util.Map> authorization; /** *

* The open identity claims, with any supported custom attributes, returned from the Cognito Your User Pool * configured for the API. *

*/ private java.util.Map claims; /** *

* The HTTP status code that the client would have received. Value is 0 if the authorizer succeeded. *

* * @param clientStatus * The HTTP status code that the client would have received. Value is 0 if the authorizer succeeded. */ public void setClientStatus(Integer clientStatus) { this.clientStatus = clientStatus; } /** *

* The HTTP status code that the client would have received. Value is 0 if the authorizer succeeded. *

* * @return The HTTP status code that the client would have received. Value is 0 if the authorizer succeeded. */ public Integer getClientStatus() { return this.clientStatus; } /** *

* The HTTP status code that the client would have received. Value is 0 if the authorizer succeeded. *

* * @param clientStatus * The HTTP status code that the client would have received. Value is 0 if the authorizer succeeded. * @return Returns a reference to this object so that method calls can be chained together. */ public TestInvokeAuthorizerResult withClientStatus(Integer clientStatus) { setClientStatus(clientStatus); return this; } /** *

* The API Gateway execution log for the test authorizer request. *

* * @param log * The API Gateway execution log for the test authorizer request. */ public void setLog(String log) { this.log = log; } /** *

* The API Gateway execution log for the test authorizer request. *

* * @return The API Gateway execution log for the test authorizer request. */ public String getLog() { return this.log; } /** *

* The API Gateway execution log for the test authorizer request. *

* * @param log * The API Gateway execution log for the test authorizer request. * @return Returns a reference to this object so that method calls can be chained together. */ public TestInvokeAuthorizerResult withLog(String log) { setLog(log); return this; } /** *

* The execution latency of the test authorizer request. *

* * @param latency * The execution latency of the test authorizer request. */ public void setLatency(Long latency) { this.latency = latency; } /** *

* The execution latency of the test authorizer request. *

* * @return The execution latency of the test authorizer request. */ public Long getLatency() { return this.latency; } /** *

* The execution latency of the test authorizer request. *

* * @param latency * The execution latency of the test authorizer request. * @return Returns a reference to this object so that method calls can be chained together. */ public TestInvokeAuthorizerResult withLatency(Long latency) { setLatency(latency); return this; } /** *

* The principal identity returned by the Authorizer *

* * @param principalId * The principal identity returned by the Authorizer */ public void setPrincipalId(String principalId) { this.principalId = principalId; } /** *

* The principal identity returned by the Authorizer *

* * @return The principal identity returned by the Authorizer */ public String getPrincipalId() { return this.principalId; } /** *

* The principal identity returned by the Authorizer *

* * @param principalId * The principal identity returned by the Authorizer * @return Returns a reference to this object so that method calls can be chained together. */ public TestInvokeAuthorizerResult withPrincipalId(String principalId) { setPrincipalId(principalId); return this; } /** *

* The JSON policy document returned by the Authorizer *

* * @param policy * The JSON policy document returned by the Authorizer */ public void setPolicy(String policy) { this.policy = policy; } /** *

* The JSON policy document returned by the Authorizer *

* * @return The JSON policy document returned by the Authorizer */ public String getPolicy() { return this.policy; } /** *

* The JSON policy document returned by the Authorizer *

* * @param policy * The JSON policy document returned by the Authorizer * @return Returns a reference to this object so that method calls can be chained together. */ public TestInvokeAuthorizerResult withPolicy(String policy) { setPolicy(policy); return this; } /** *

* The authorization response. *

* * @return The authorization response. */ public java.util.Map> getAuthorization() { return authorization; } /** *

* The authorization response. *

* * @param authorization * The authorization response. */ public void setAuthorization(java.util.Map> authorization) { this.authorization = authorization; } /** *

* The authorization response. *

* * @param authorization * The authorization response. * @return Returns a reference to this object so that method calls can be chained together. */ public TestInvokeAuthorizerResult withAuthorization(java.util.Map> authorization) { setAuthorization(authorization); return this; } /** * Add a single Authorization entry * * @see TestInvokeAuthorizerResult#withAuthorization * @returns a reference to this object so that method calls can be chained together. */ public TestInvokeAuthorizerResult addAuthorizationEntry(String key, java.util.List value) { if (null == this.authorization) { this.authorization = new java.util.HashMap>(); } if (this.authorization.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.authorization.put(key, value); return this; } /** * Removes all the entries added into Authorization. * * @return Returns a reference to this object so that method calls can be chained together. */ public TestInvokeAuthorizerResult clearAuthorizationEntries() { this.authorization = null; return this; } /** *

* The open identity claims, with any supported custom attributes, returned from the Cognito Your User Pool * configured for the API. *

* * @return The open identity claims, with any supported custom attributes, returned from the Cognito Your User Pool * configured for the API. */ public java.util.Map getClaims() { return claims; } /** *

* The open identity claims, with any supported custom attributes, returned from the Cognito Your User Pool * configured for the API. *

* * @param claims * The open identity claims, with any supported custom attributes, returned from the Cognito Your User Pool * configured for the API. */ public void setClaims(java.util.Map claims) { this.claims = claims; } /** *

* The open identity claims, with any supported custom attributes, returned from the Cognito Your User Pool * configured for the API. *

* * @param claims * The open identity claims, with any supported custom attributes, returned from the Cognito Your User Pool * configured for the API. * @return Returns a reference to this object so that method calls can be chained together. */ public TestInvokeAuthorizerResult withClaims(java.util.Map claims) { setClaims(claims); return this; } /** * Add a single Claims entry * * @see TestInvokeAuthorizerResult#withClaims * @returns a reference to this object so that method calls can be chained together. */ public TestInvokeAuthorizerResult addClaimsEntry(String key, String value) { if (null == this.claims) { this.claims = new java.util.HashMap(); } if (this.claims.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.claims.put(key, value); return this; } /** * Removes all the entries added into Claims. * * @return Returns a reference to this object so that method calls can be chained together. */ public TestInvokeAuthorizerResult clearClaimsEntries() { this.claims = null; 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 (getClientStatus() != null) sb.append("ClientStatus: ").append(getClientStatus()).append(","); if (getLog() != null) sb.append("Log: ").append(getLog()).append(","); if (getLatency() != null) sb.append("Latency: ").append(getLatency()).append(","); if (getPrincipalId() != null) sb.append("PrincipalId: ").append(getPrincipalId()).append(","); if (getPolicy() != null) sb.append("Policy: ").append(getPolicy()).append(","); if (getAuthorization() != null) sb.append("Authorization: ").append(getAuthorization()).append(","); if (getClaims() != null) sb.append("Claims: ").append(getClaims()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof TestInvokeAuthorizerResult == false) return false; TestInvokeAuthorizerResult other = (TestInvokeAuthorizerResult) obj; if (other.getClientStatus() == null ^ this.getClientStatus() == null) return false; if (other.getClientStatus() != null && other.getClientStatus().equals(this.getClientStatus()) == false) return false; if (other.getLog() == null ^ this.getLog() == null) return false; if (other.getLog() != null && other.getLog().equals(this.getLog()) == false) return false; if (other.getLatency() == null ^ this.getLatency() == null) return false; if (other.getLatency() != null && other.getLatency().equals(this.getLatency()) == false) return false; if (other.getPrincipalId() == null ^ this.getPrincipalId() == null) return false; if (other.getPrincipalId() != null && other.getPrincipalId().equals(this.getPrincipalId()) == false) return false; if (other.getPolicy() == null ^ this.getPolicy() == null) return false; if (other.getPolicy() != null && other.getPolicy().equals(this.getPolicy()) == false) return false; if (other.getAuthorization() == null ^ this.getAuthorization() == null) return false; if (other.getAuthorization() != null && other.getAuthorization().equals(this.getAuthorization()) == false) return false; if (other.getClaims() == null ^ this.getClaims() == null) return false; if (other.getClaims() != null && other.getClaims().equals(this.getClaims()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getClientStatus() == null) ? 0 : getClientStatus().hashCode()); hashCode = prime * hashCode + ((getLog() == null) ? 0 : getLog().hashCode()); hashCode = prime * hashCode + ((getLatency() == null) ? 0 : getLatency().hashCode()); hashCode = prime * hashCode + ((getPrincipalId() == null) ? 0 : getPrincipalId().hashCode()); hashCode = prime * hashCode + ((getPolicy() == null) ? 0 : getPolicy().hashCode()); hashCode = prime * hashCode + ((getAuthorization() == null) ? 0 : getAuthorization().hashCode()); hashCode = prime * hashCode + ((getClaims() == null) ? 0 : getClaims().hashCode()); return hashCode; } @Override public TestInvokeAuthorizerResult clone() { try { return (TestInvokeAuthorizerResult) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }