Skip to content

create_authorizer async

create_authorizer(
    authorizer_name: AuthorizerName,
    authorizer_function_arn: AuthorizerFunctionArn,
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    token_key_name: Optional[TokenKeyName] = None,
    token_signing_public_keys: Optional[PublicKeyMap] = None,
    status: Optional[AuthorizerStatus] = None,
    tags: Optional[TagList] = None,
    signing_disabled: Optional[BooleanKey] = None,
    enable_caching_for_http: Optional[EnableCachingForHttp] = None,
) -> CreateAuthorizerResponse

Creates an authorizer.

Requires permission to access the CreateAuthorizer action.

Parameters:

  • authorizer_name (AuthorizerName) –

    The authorizer name.

  • authorizer_function_arn (AuthorizerFunctionArn) –

    The ARN of the authorizer's Lambda function.

  • token_key_name (Optional[TokenKeyName], default: None ) –

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

  • token_signing_public_keys (Optional[PublicKeyMap], default: None ) –

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

  • status (Optional[AuthorizerStatus], default: None ) –

    The status of the create authorizer request.

  • tags (Optional[TagList], default: None ) –

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

  • signing_disabled (Optional[BooleanKey], default: None ) –

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

  • enable_caching_for_http (Optional[EnableCachingForHttp], default: None ) –

    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.

Raises:

Source code in docs_src/capo_iot/_services/async_io_t.py
async def create_authorizer(
    self,
    authorizer_name: "capo_iot.types.authorizer_name.AuthorizerName",
    authorizer_function_arn: "capo_iot.types.authorizer_function_arn.AuthorizerFunctionArn",
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    token_key_name: Optional["capo_iot.types.token_key_name.TokenKeyName"] = None,
    token_signing_public_keys: Optional[
        "capo_iot.types.public_key_map.PublicKeyMap"
    ] = None,
    status: Optional["capo_iot.types.authorizer_status.AuthorizerStatus"] = None,
    tags: Optional["capo_iot.types.tag_list.TagList"] = None,
    signing_disabled: Optional["capo_iot.types.boolean_key.BooleanKey"] = None,
    enable_caching_for_http: Optional[
        "capo_iot.types.enable_caching_for_http.EnableCachingForHttp"
    ] = None,
) -> "capo_iot.types.create_authorizer_response.CreateAuthorizerResponse":
    """<p>Creates an authorizer.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">CreateAuthorizer</a> action.</p>

    Args:
        authorizer_name: <p>The authorizer name.</p>
        authorizer_function_arn: <p>The ARN of the authorizer's Lambda function.</p>
        token_key_name: <p>The name of the token key used to extract the token from the HTTP headers.</p>
        token_signing_public_keys: <p>The public keys used to verify the digital signature returned by your custom authentication service.</p>
        status: <p>The status of the create authorizer request.</p>
        tags: <p>Metadata which can be used to manage the custom authorizer.</p> <note> <p>For URI Request parameters use format: ...key1=value1&key2=value2...</p> <p>For the CLI command-line parameter use format: &&tags "key1=value1&key2=value2..."</p> <p>For the cli-input-json file use format: "tags": "key1=value1&key2=value2..."</p> </note>
        signing_disabled: <p>Specifies whether IoT validates the token signature in an authorization request.</p>
        enable_caching_for_http: <p>When <code>true</code>, 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 <code>refreshAfterInSeconds</code>. This value does not affect authorization of clients that use MQTT connections.</p> <p>The default value is <code>false</code>.</p>

    Raises:
        capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.limit_exceeded_exception.LimitExceededException: <p>A limit has been exceeded.</p>
        capo_iot.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The resource already exists.</p>
        capo_iot.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iot.types.create_authorizer_request.CreateAuthorizerRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot.types.create_authorizer_response.CreateAuthorizerResponse"
    ]:
        import capo_iot._operations.aws_iot_service.create_authorizer

        (
            output,
            http_response,
        ) = await capo_iot._operations.aws_iot_service.create_authorizer.async_create_authorizer(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateAuthorizer")
    )
    input_: capo_iot.types.create_authorizer_request.CreateAuthorizerRequest = {
        "authorizer_name": authorizer_name,
        "authorizer_function_arn": authorizer_function_arn,
    }
    if token_key_name is not None:
        input_["token_key_name"] = token_key_name
    if token_signing_public_keys is not None:
        input_["token_signing_public_keys"] = token_signing_public_keys
    if status is not None:
        input_["status"] = status
    if tags is not None:
        input_["tags"] = tags
    if signing_disabled is not None:
        input_["signing_disabled"] = signing_disabled
    if enable_caching_for_http is not None:
        input_["enable_caching_for_http"] = enable_caching_for_http

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output