createAuthorizer method

Future<CreateAuthorizerResponse> createAuthorizer({
  1. required String authorizerFunctionArn,
  2. required String authorizerName,
  3. bool? enableCachingForHttp,
  4. bool? signingDisabled,
  5. AuthorizerStatus? status,
  6. List<Tag>? tags,
  7. String? tokenKeyName,
  8. Map<String, String>? tokenSigningPublicKeys,
})

Creates an authorizer.

Requires permission to access the CreateAuthorizer action.

May throw InternalFailureException. May throw InvalidRequestException. May throw LimitExceededException. May throw ResourceAlreadyExistsException. May throw ServiceUnavailableException. May throw ThrottlingException. May throw UnauthorizedException.

Parameter authorizerFunctionArn : The ARN of the authorizer's Lambda function.

Parameter authorizerName : The authorizer name.

Parameter 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.

Parameter signingDisabled : Specifies whether IoT validates the token signature in an authorization request.

Parameter status : The status of the create authorizer request.

Parameter tags : Metadata which can be used to manage the custom authorizer.

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..."

Parameter tokenKeyName : The name of the token key used to extract the token from the HTTP headers.

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

Implementation

Future<CreateAuthorizerResponse> createAuthorizer({
  required String authorizerFunctionArn,
  required String authorizerName,
  bool? enableCachingForHttp,
  bool? signingDisabled,
  AuthorizerStatus? status,
  List<Tag>? tags,
  String? tokenKeyName,
  Map<String, String>? tokenSigningPublicKeys,
}) async {
  final $payload = <String, dynamic>{
    'authorizerFunctionArn': authorizerFunctionArn,
    if (enableCachingForHttp != null)
      'enableCachingForHttp': enableCachingForHttp,
    if (signingDisabled != null) 'signingDisabled': signingDisabled,
    if (status != null) 'status': status.value,
    if (tags != null) 'tags': tags,
    if (tokenKeyName != null) 'tokenKeyName': tokenKeyName,
    if (tokenSigningPublicKeys != null)
      'tokenSigningPublicKeys': tokenSigningPublicKeys,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/authorizer/${Uri.encodeComponent(authorizerName)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreateAuthorizerResponse.fromJson(response);
}