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

* Creates an authorizer. *

*

* Requires permission to access the CreateAuthorizer action. *

*/ public class CreateAuthorizerRequest extends AmazonWebServiceRequest implements Serializable { /** *

* The authorizer name. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [\w=,@-]+
*/ private String authorizerName; /** *

* The ARN of the authorizer's Lambda function. *

*

* Constraints:
* Length: - 2048
* Pattern: [\s\S]*
*/ private String authorizerFunctionArn; /** *

* The name of the token key used to extract the token from the HTTP * headers. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9_-]+
*/ private String tokenKeyName; /** *

* The public keys used to verify the digital signature returned by your * custom authentication service. *

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

* The status of the create authorizer request. *

*

* Constraints:
* Allowed Values: ACTIVE, INACTIVE */ private String status; /** *

* Metadata which can be used to manage the custom authorizer. *

* *

* For URI Request parameters use format: ...key1=value1&key2=value2... *

*

* For the CLI command-line parameter use format: &&tags * "key1=value1&key2=value2..." *

*

* For the cli-input-json file use format: "tags": * "key1=value1&key2=value2..." *

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

* Specifies whether IoT validates the token signature in an authorization * request. *

*/ private Boolean signingDisabled; /** *

* When true, the result from the authorizer’s Lambda function * is cached for clients that use persistent HTTP connections. The results * are cached for the time specified by the Lambda function in * refreshAfterInSeconds. This value does not affect * authorization of clients that use MQTT connections. *

*

* The default value is false. *

*/ private Boolean enableCachingForHttp; /** *

* The authorizer name. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [\w=,@-]+
* * @return

* The authorizer name. *

*/ public String getAuthorizerName() { return authorizerName; } /** *

* The authorizer name. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [\w=,@-]+
* * @param authorizerName

* The authorizer name. *

*/ public void setAuthorizerName(String authorizerName) { this.authorizerName = authorizerName; } /** *

* The 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 authorizer name. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateAuthorizerRequest withAuthorizerName(String authorizerName) { this.authorizerName = authorizerName; return this; } /** *

* The ARN of the authorizer's Lambda function. *

*

* Constraints:
* Length: - 2048
* Pattern: [\s\S]*
* * @return

* The ARN of the authorizer's Lambda function. *

*/ public String getAuthorizerFunctionArn() { return authorizerFunctionArn; } /** *

* The ARN of the authorizer's Lambda function. *

*

* Constraints:
* Length: - 2048
* Pattern: [\s\S]*
* * @param authorizerFunctionArn

* The ARN of the authorizer's Lambda function. *

*/ public void setAuthorizerFunctionArn(String authorizerFunctionArn) { this.authorizerFunctionArn = authorizerFunctionArn; } /** *

* The ARN of the authorizer's Lambda function. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: - 2048
* Pattern: [\s\S]*
* * @param authorizerFunctionArn

* The ARN of the authorizer's Lambda function. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateAuthorizerRequest withAuthorizerFunctionArn(String authorizerFunctionArn) { this.authorizerFunctionArn = authorizerFunctionArn; return this; } /** *

* The name of the token key used to extract the token from the HTTP * headers. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9_-]+
* * @return

* The name of the token key used to extract the token from the HTTP * headers. *

*/ public String getTokenKeyName() { return tokenKeyName; } /** *

* The name of the token key used to extract the token from the HTTP * headers. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9_-]+
* * @param tokenKeyName

* The name of the token key used to extract the token from the * HTTP headers. *

*/ public void setTokenKeyName(String tokenKeyName) { this.tokenKeyName = tokenKeyName; } /** *

* The name of the token key used to extract the token from the HTTP * headers. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9_-]+
* * @param tokenKeyName

* The name of the token key used to extract the token from the * HTTP headers. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateAuthorizerRequest withTokenKeyName(String tokenKeyName) { this.tokenKeyName = tokenKeyName; return this; } /** *

* The public keys used to verify the digital signature returned by your * custom authentication service. *

* * @return

* The public keys used to verify the digital signature returned by * your custom authentication service. *

*/ public java.util.Map getTokenSigningPublicKeys() { return tokenSigningPublicKeys; } /** *

* The public keys used to verify the digital signature returned by your * custom authentication service. *

* * @param tokenSigningPublicKeys

* The public keys used to verify the digital signature returned * by your custom authentication service. *

*/ public void setTokenSigningPublicKeys(java.util.Map tokenSigningPublicKeys) { this.tokenSigningPublicKeys = tokenSigningPublicKeys; } /** *

* The public keys used to verify the digital signature returned by your * custom authentication service. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param tokenSigningPublicKeys

* The public keys used to verify the digital signature returned * by your custom authentication service. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateAuthorizerRequest withTokenSigningPublicKeys( java.util.Map tokenSigningPublicKeys) { this.tokenSigningPublicKeys = tokenSigningPublicKeys; return this; } /** *

* The public keys used to verify the digital signature returned by your * custom authentication service. *

*

* The method adds a new key-value pair into tokenSigningPublicKeys * parameter, and returns a reference to this object so that method calls * can be chained together. * * @param key The key of the entry to be added into tokenSigningPublicKeys. * @param value The corresponding value of the entry to be added into * tokenSigningPublicKeys. * @return A reference to this updated object so that method calls can be * chained together. */ public CreateAuthorizerRequest addtokenSigningPublicKeysEntry(String key, String value) { if (null == this.tokenSigningPublicKeys) { this.tokenSigningPublicKeys = new java.util.HashMap(); } if (this.tokenSigningPublicKeys.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.tokenSigningPublicKeys.put(key, value); return this; } /** * Removes all the entries added into tokenSigningPublicKeys. *

* Returns a reference to this object so that method calls can be chained * together. */ public CreateAuthorizerRequest cleartokenSigningPublicKeysEntries() { this.tokenSigningPublicKeys = null; return this; } /** *

* The status of the create authorizer request. *

*

* Constraints:
* Allowed Values: ACTIVE, INACTIVE * * @return

* The status of the create authorizer request. *

* @see AuthorizerStatus */ public String getStatus() { return status; } /** *

* The status of the create authorizer request. *

*

* Constraints:
* Allowed Values: ACTIVE, INACTIVE * * @param status

* The status of the create authorizer request. *

* @see AuthorizerStatus */ public void setStatus(String status) { this.status = status; } /** *

* The status of the create authorizer request. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Allowed Values: ACTIVE, INACTIVE * * @param status

* The status of the create authorizer request. *

* @return A reference to this updated object so that method calls can be * chained together. * @see AuthorizerStatus */ public CreateAuthorizerRequest withStatus(String status) { this.status = status; return this; } /** *

* The status of the create authorizer request. *

*

* Constraints:
* Allowed Values: ACTIVE, INACTIVE * * @param status

* The status of the create authorizer request. *

* @see AuthorizerStatus */ public void setStatus(AuthorizerStatus status) { this.status = status.toString(); } /** *

* The status of the create authorizer request. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Allowed Values: ACTIVE, INACTIVE * * @param status

* The status of the create authorizer request. *

* @return A reference to this updated object so that method calls can be * chained together. * @see AuthorizerStatus */ public CreateAuthorizerRequest withStatus(AuthorizerStatus status) { this.status = status.toString(); return this; } /** *

* Metadata which can be used to manage the custom authorizer. *

* *

* For URI Request parameters use format: ...key1=value1&key2=value2... *

*

* For the CLI command-line parameter use format: &&tags * "key1=value1&key2=value2..." *

*

* For the cli-input-json file use format: "tags": * "key1=value1&key2=value2..." *

*
* * @return

* Metadata which can be used to manage the custom authorizer. *

* *

* For URI Request parameters use format: * ...key1=value1&key2=value2... *

*

* For the CLI command-line parameter use format: &&tags * "key1=value1&key2=value2..." *

*

* For the cli-input-json file use format: "tags": * "key1=value1&key2=value2..." *

*
*/ public java.util.List getTags() { return tags; } /** *

* Metadata which can be used to manage the custom authorizer. *

* *

* For URI Request parameters use format: ...key1=value1&key2=value2... *

*

* For the CLI command-line parameter use format: &&tags * "key1=value1&key2=value2..." *

*

* For the cli-input-json file use format: "tags": * "key1=value1&key2=value2..." *

*
* * @param tags

* Metadata which can be used to manage the custom authorizer. *

* *

* For URI Request parameters use format: * ...key1=value1&key2=value2... *

*

* For the CLI command-line parameter use format: &&tags * "key1=value1&key2=value2..." *

*

* For the cli-input-json file use format: "tags": * "key1=value1&key2=value2..." *

*
*/ public void setTags(java.util.Collection tags) { if (tags == null) { this.tags = null; return; } this.tags = new java.util.ArrayList(tags); } /** *

* Metadata which can be used to manage the custom authorizer. *

* *

* For URI Request parameters use format: ...key1=value1&key2=value2... *

*

* For the CLI command-line parameter use format: &&tags * "key1=value1&key2=value2..." *

*

* For the cli-input-json file use format: "tags": * "key1=value1&key2=value2..." *

*
*

* Returns a reference to this object so that method calls can be chained * together. * * @param tags

* Metadata which can be used to manage the custom authorizer. *

* *

* For URI Request parameters use format: * ...key1=value1&key2=value2... *

*

* For the CLI command-line parameter use format: &&tags * "key1=value1&key2=value2..." *

*

* For the cli-input-json file use format: "tags": * "key1=value1&key2=value2..." *

*
* @return A reference to this updated object so that method calls can be * chained together. */ public CreateAuthorizerRequest withTags(Tag... tags) { if (getTags() == null) { this.tags = new java.util.ArrayList(tags.length); } for (Tag value : tags) { this.tags.add(value); } return this; } /** *

* Metadata which can be used to manage the custom authorizer. *

* *

* For URI Request parameters use format: ...key1=value1&key2=value2... *

*

* For the CLI command-line parameter use format: &&tags * "key1=value1&key2=value2..." *

*

* For the cli-input-json file use format: "tags": * "key1=value1&key2=value2..." *

*
*

* Returns a reference to this object so that method calls can be chained * together. * * @param tags

* Metadata which can be used to manage the custom authorizer. *

* *

* For URI Request parameters use format: * ...key1=value1&key2=value2... *

*

* For the CLI command-line parameter use format: &&tags * "key1=value1&key2=value2..." *

*

* For the cli-input-json file use format: "tags": * "key1=value1&key2=value2..." *

*
* @return A reference to this updated object so that method calls can be * chained together. */ public CreateAuthorizerRequest withTags(java.util.Collection tags) { setTags(tags); return this; } /** *

* Specifies whether IoT validates the token signature in an authorization * request. *

* * @return

* Specifies whether IoT validates the token signature in an * authorization request. *

*/ public Boolean isSigningDisabled() { return signingDisabled; } /** *

* Specifies whether IoT validates the token signature in an authorization * request. *

* * @return

* Specifies whether IoT validates the token signature in an * authorization request. *

*/ public Boolean getSigningDisabled() { return signingDisabled; } /** *

* Specifies whether IoT validates the token signature in an authorization * request. *

* * @param signingDisabled

* Specifies whether IoT validates the token signature in an * authorization request. *

*/ public void setSigningDisabled(Boolean signingDisabled) { this.signingDisabled = signingDisabled; } /** *

* Specifies whether IoT validates the token signature in an authorization * request. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param signingDisabled

* Specifies whether IoT validates the token signature in an * authorization request. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateAuthorizerRequest withSigningDisabled(Boolean signingDisabled) { this.signingDisabled = signingDisabled; return this; } /** *

* When true, the result from the authorizer’s Lambda function * is cached for clients that use persistent HTTP connections. The results * are cached for the time specified by the Lambda function in * refreshAfterInSeconds. This value does not affect * authorization of clients that use MQTT connections. *

*

* The default value is false. *

* * @return

* When true, the result from the authorizer’s Lambda * function is cached for clients that use persistent HTTP * connections. The results are cached for the time specified by the * Lambda function in refreshAfterInSeconds. This value * does not affect authorization of clients that use MQTT * connections. *

*

* The default value is false. *

*/ public Boolean isEnableCachingForHttp() { return enableCachingForHttp; } /** *

* When true, the result from the authorizer’s Lambda function * is cached for clients that use persistent HTTP connections. The results * are cached for the time specified by the Lambda function in * refreshAfterInSeconds. This value does not affect * authorization of clients that use MQTT connections. *

*

* The default value is false. *

* * @return

* When true, the result from the authorizer’s Lambda * function is cached for clients that use persistent HTTP * connections. The results are cached for the time specified by the * Lambda function in refreshAfterInSeconds. This value * does not affect authorization of clients that use MQTT * connections. *

*

* The default value is false. *

*/ public Boolean getEnableCachingForHttp() { return enableCachingForHttp; } /** *

* When true, the result from the authorizer’s Lambda function * is cached for clients that use persistent HTTP connections. The results * are cached for the time specified by the Lambda function in * refreshAfterInSeconds. This value does not affect * authorization of clients that use MQTT connections. *

*

* The default value is false. *

* * @param enableCachingForHttp

* When true, the result from the authorizer’s * Lambda function is cached for clients that use persistent HTTP * connections. The results are cached for the time specified by * the Lambda function in refreshAfterInSeconds. * This value does not affect authorization of clients that use * MQTT connections. *

*

* The default value is false. *

*/ public void setEnableCachingForHttp(Boolean enableCachingForHttp) { this.enableCachingForHttp = enableCachingForHttp; } /** *

* When true, the result from the authorizer’s Lambda function * is cached for clients that use persistent HTTP connections. The results * are cached for the time specified by the Lambda function in * refreshAfterInSeconds. This value does not affect * authorization of clients that use MQTT connections. *

*

* The default value is false. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param enableCachingForHttp

* When true, the result from the authorizer’s * Lambda function is cached for clients that use persistent HTTP * connections. The results are cached for the time specified by * the Lambda function in refreshAfterInSeconds. * This value does not affect authorization of clients that use * MQTT connections. *

*

* The default value is false. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateAuthorizerRequest withEnableCachingForHttp(Boolean enableCachingForHttp) { this.enableCachingForHttp = enableCachingForHttp; 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 (getAuthorizerFunctionArn() != null) sb.append("authorizerFunctionArn: " + getAuthorizerFunctionArn() + ","); if (getTokenKeyName() != null) sb.append("tokenKeyName: " + getTokenKeyName() + ","); if (getTokenSigningPublicKeys() != null) sb.append("tokenSigningPublicKeys: " + getTokenSigningPublicKeys() + ","); if (getStatus() != null) sb.append("status: " + getStatus() + ","); if (getTags() != null) sb.append("tags: " + getTags() + ","); if (getSigningDisabled() != null) sb.append("signingDisabled: " + getSigningDisabled() + ","); if (getEnableCachingForHttp() != null) sb.append("enableCachingForHttp: " + getEnableCachingForHttp()); 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 + ((getAuthorizerFunctionArn() == null) ? 0 : getAuthorizerFunctionArn().hashCode()); hashCode = prime * hashCode + ((getTokenKeyName() == null) ? 0 : getTokenKeyName().hashCode()); hashCode = prime * hashCode + ((getTokenSigningPublicKeys() == null) ? 0 : getTokenSigningPublicKeys() .hashCode()); hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); hashCode = prime * hashCode + ((getSigningDisabled() == null) ? 0 : getSigningDisabled().hashCode()); hashCode = prime * hashCode + ((getEnableCachingForHttp() == null) ? 0 : getEnableCachingForHttp().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateAuthorizerRequest == false) return false; CreateAuthorizerRequest other = (CreateAuthorizerRequest) obj; if (other.getAuthorizerName() == null ^ this.getAuthorizerName() == null) return false; if (other.getAuthorizerName() != null && other.getAuthorizerName().equals(this.getAuthorizerName()) == false) return false; if (other.getAuthorizerFunctionArn() == null ^ this.getAuthorizerFunctionArn() == null) return false; if (other.getAuthorizerFunctionArn() != null && other.getAuthorizerFunctionArn().equals(this.getAuthorizerFunctionArn()) == false) return false; if (other.getTokenKeyName() == null ^ this.getTokenKeyName() == null) return false; if (other.getTokenKeyName() != null && other.getTokenKeyName().equals(this.getTokenKeyName()) == false) return false; if (other.getTokenSigningPublicKeys() == null ^ this.getTokenSigningPublicKeys() == null) return false; if (other.getTokenSigningPublicKeys() != null && other.getTokenSigningPublicKeys().equals(this.getTokenSigningPublicKeys()) == false) return false; if (other.getStatus() == null ^ this.getStatus() == null) return false; if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false) return false; if (other.getTags() == null ^ this.getTags() == null) return false; if (other.getTags() != null && other.getTags().equals(this.getTags()) == false) return false; if (other.getSigningDisabled() == null ^ this.getSigningDisabled() == null) return false; if (other.getSigningDisabled() != null && other.getSigningDisabled().equals(this.getSigningDisabled()) == false) return false; if (other.getEnableCachingForHttp() == null ^ this.getEnableCachingForHttp() == null) return false; if (other.getEnableCachingForHttp() != null && other.getEnableCachingForHttp().equals(this.getEnableCachingForHttp()) == false) return false; return true; } }