createAuthorizer method

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

Creates an authorizer.

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

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

Parameter authorizerName : The authorizer name.

Parameter signingDisabled : Specifies whether AWS 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? signingDisabled,
  AuthorizerStatus? status,
  List<Tag>? tags,
  String? tokenKeyName,
  Map<String, String>? tokenSigningPublicKeys,
}) async {
  ArgumentError.checkNotNull(authorizerFunctionArn, 'authorizerFunctionArn');
  _s.validateStringLength(
    'authorizerFunctionArn',
    authorizerFunctionArn,
    0,
    2048,
    isRequired: true,
  );
  ArgumentError.checkNotNull(authorizerName, 'authorizerName');
  _s.validateStringLength(
    'authorizerName',
    authorizerName,
    1,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'tokenKeyName',
    tokenKeyName,
    1,
    128,
  );
  final $payload = <String, dynamic>{
    'authorizerFunctionArn': authorizerFunctionArn,
    if (signingDisabled != null) 'signingDisabled': signingDisabled,
    if (status != null) 'status': status.toValue(),
    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);
}