/* * Copyright 2010-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 com.amazonaws.AmazonWebServiceRequest; /** *
* Tests a custom authorization behavior by invoking a specified custom * authorizer. Use this to test and debug the custom authorization behavior of * devices that connect to the IoT device gateway. *
** Requires permission to access the TestInvokeAuthorizer action. *
*/ public class TestInvokeAuthorizerRequest extends AmazonWebServiceRequest implements Serializable { /** ** The custom authorizer name. *
*
* Constraints:
* Length: 1 - 128
* Pattern: [\w=,@-]+
*/
private String authorizerName;
/**
*
* The token returned by your custom authentication service. *
*
* Constraints:
* Length: 1 - 6144
* Pattern: [\s\S]*
*/
private String token;
/**
*
* The signature made with the token and your custom authentication * service's private key. This value must be Base-64-encoded. *
*
* Constraints:
* Length: 1 - 2560
* Pattern: [A-Za-z0-9+/]+={0,2}
*/
private String tokenSignature;
/**
*
* Specifies a test HTTP authorization request. *
*/ private HttpContext httpContext; /** ** Specifies a test MQTT authorization request. *
*/ private MqttContext mqttContext; /** ** Specifies a test TLS authorization request. *
*/ private TlsContext tlsContext; /** ** The custom authorizer name. *
*
* Constraints:
* Length: 1 - 128
* Pattern: [\w=,@-]+
*
* @return
* The custom authorizer name. *
*/ public String getAuthorizerName() { return authorizerName; } /** ** The custom authorizer name. *
*
* Constraints:
* Length: 1 - 128
* Pattern: [\w=,@-]+
*
* @param authorizerName
* The custom authorizer name. *
*/ public void setAuthorizerName(String authorizerName) { this.authorizerName = authorizerName; } /** ** The custom authorizer name. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 128
* Pattern: [\w=,@-]+
*
* @param authorizerName
* The custom authorizer name. *
* @return A reference to this updated object so that method calls can be * chained together. */ public TestInvokeAuthorizerRequest withAuthorizerName(String authorizerName) { this.authorizerName = authorizerName; return this; } /** ** The token returned by your custom authentication service. *
*
* Constraints:
* Length: 1 - 6144
* Pattern: [\s\S]*
*
* @return
* The token returned by your custom authentication service. *
*/ public String getToken() { return token; } /** ** The token returned by your custom authentication service. *
*
* Constraints:
* Length: 1 - 6144
* Pattern: [\s\S]*
*
* @param token
* The token returned by your custom authentication service. *
*/ public void setToken(String token) { this.token = token; } /** ** The token returned by your custom authentication service. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 6144
* Pattern: [\s\S]*
*
* @param token
* The token returned by your custom authentication service. *
* @return A reference to this updated object so that method calls can be * chained together. */ public TestInvokeAuthorizerRequest withToken(String token) { this.token = token; return this; } /** ** The signature made with the token and your custom authentication * service's private key. This value must be Base-64-encoded. *
*
* Constraints:
* Length: 1 - 2560
* Pattern: [A-Za-z0-9+/]+={0,2}
*
* @return
* The signature made with the token and your custom authentication * service's private key. This value must be Base-64-encoded. *
*/ public String getTokenSignature() { return tokenSignature; } /** ** The signature made with the token and your custom authentication * service's private key. This value must be Base-64-encoded. *
*
* Constraints:
* Length: 1 - 2560
* Pattern: [A-Za-z0-9+/]+={0,2}
*
* @param tokenSignature
* The signature made with the token and your custom * authentication service's private key. This value must be * Base-64-encoded. *
*/ public void setTokenSignature(String tokenSignature) { this.tokenSignature = tokenSignature; } /** ** The signature made with the token and your custom authentication * service's private key. This value must be Base-64-encoded. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 2560
* Pattern: [A-Za-z0-9+/]+={0,2}
*
* @param tokenSignature
* The signature made with the token and your custom * authentication service's private key. This value must be * Base-64-encoded. *
* @return A reference to this updated object so that method calls can be * chained together. */ public TestInvokeAuthorizerRequest withTokenSignature(String tokenSignature) { this.tokenSignature = tokenSignature; return this; } /** ** Specifies a test HTTP authorization request. *
* * @return* Specifies a test HTTP authorization request. *
*/ public HttpContext getHttpContext() { return httpContext; } /** ** Specifies a test HTTP authorization request. *
* * @param httpContext* Specifies a test HTTP authorization request. *
*/ public void setHttpContext(HttpContext httpContext) { this.httpContext = httpContext; } /** ** Specifies a test HTTP authorization request. *
** Returns a reference to this object so that method calls can be chained * together. * * @param httpContext
* Specifies a test HTTP authorization request. *
* @return A reference to this updated object so that method calls can be * chained together. */ public TestInvokeAuthorizerRequest withHttpContext(HttpContext httpContext) { this.httpContext = httpContext; return this; } /** ** Specifies a test MQTT authorization request. *
* * @return* Specifies a test MQTT authorization request. *
*/ public MqttContext getMqttContext() { return mqttContext; } /** ** Specifies a test MQTT authorization request. *
* * @param mqttContext* Specifies a test MQTT authorization request. *
*/ public void setMqttContext(MqttContext mqttContext) { this.mqttContext = mqttContext; } /** ** Specifies a test MQTT authorization request. *
** Returns a reference to this object so that method calls can be chained * together. * * @param mqttContext
* Specifies a test MQTT authorization request. *
* @return A reference to this updated object so that method calls can be * chained together. */ public TestInvokeAuthorizerRequest withMqttContext(MqttContext mqttContext) { this.mqttContext = mqttContext; return this; } /** ** Specifies a test TLS authorization request. *
* * @return* Specifies a test TLS authorization request. *
*/ public TlsContext getTlsContext() { return tlsContext; } /** ** Specifies a test TLS authorization request. *
* * @param tlsContext* Specifies a test TLS authorization request. *
*/ public void setTlsContext(TlsContext tlsContext) { this.tlsContext = tlsContext; } /** ** Specifies a test TLS authorization request. *
** Returns a reference to this object so that method calls can be chained * together. * * @param tlsContext
* Specifies a test TLS authorization request. *
* @return A reference to this updated object so that method calls can be * chained together. */ public TestInvokeAuthorizerRequest withTlsContext(TlsContext tlsContext) { this.tlsContext = tlsContext; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getAuthorizerName() != null) sb.append("authorizerName: " + getAuthorizerName() + ","); if (getToken() != null) sb.append("token: " + getToken() + ","); if (getTokenSignature() != null) sb.append("tokenSignature: " + getTokenSignature() + ","); if (getHttpContext() != null) sb.append("httpContext: " + getHttpContext() + ","); if (getMqttContext() != null) sb.append("mqttContext: " + getMqttContext() + ","); if (getTlsContext() != null) sb.append("tlsContext: " + getTlsContext()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAuthorizerName() == null) ? 0 : getAuthorizerName().hashCode()); hashCode = prime * hashCode + ((getToken() == null) ? 0 : getToken().hashCode()); hashCode = prime * hashCode + ((getTokenSignature() == null) ? 0 : getTokenSignature().hashCode()); hashCode = prime * hashCode + ((getHttpContext() == null) ? 0 : getHttpContext().hashCode()); hashCode = prime * hashCode + ((getMqttContext() == null) ? 0 : getMqttContext().hashCode()); hashCode = prime * hashCode + ((getTlsContext() == null) ? 0 : getTlsContext().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof TestInvokeAuthorizerRequest == false) return false; TestInvokeAuthorizerRequest other = (TestInvokeAuthorizerRequest) obj; if (other.getAuthorizerName() == null ^ this.getAuthorizerName() == null) return false; if (other.getAuthorizerName() != null && other.getAuthorizerName().equals(this.getAuthorizerName()) == false) return false; if (other.getToken() == null ^ this.getToken() == null) return false; if (other.getToken() != null && other.getToken().equals(this.getToken()) == false) return false; if (other.getTokenSignature() == null ^ this.getTokenSignature() == null) return false; if (other.getTokenSignature() != null && other.getTokenSignature().equals(this.getTokenSignature()) == false) return false; if (other.getHttpContext() == null ^ this.getHttpContext() == null) return false; if (other.getHttpContext() != null && other.getHttpContext().equals(this.getHttpContext()) == false) return false; if (other.getMqttContext() == null ^ this.getMqttContext() == null) return false; if (other.getMqttContext() != null && other.getMqttContext().equals(this.getMqttContext()) == false) return false; if (other.getTlsContext() == null ^ this.getTlsContext() == null) return false; if (other.getTlsContext() != null && other.getTlsContext().equals(this.getTlsContext()) == false) return false; return true; } }