Skip to content

test_invoke_authorizer async

test_invoke_authorizer(
    authorizer_name: AuthorizerName,
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    token: Optional[Token] = None,
    token_signature: Optional[TokenSignature] = None,
    http_context: Optional[HttpContext] = None,
    mqtt_context: Optional[MqttContext] = None,
    tls_context: Optional[TlsContext] = None,
) -> TestInvokeAuthorizerResponse

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.

Parameters:

  • authorizer_name (AuthorizerName) –

    The custom authorizer name.

  • token (Optional[Token], default: None ) –

    The token returned by your custom authentication service.

  • token_signature (Optional[TokenSignature], default: None ) –

    The signature made with the token and your custom authentication service's private key. This value must be Base-64-encoded.

  • http_context (Optional[HttpContext], default: None ) –

    Specifies a test HTTP authorization request.

  • mqtt_context (Optional[MqttContext], default: None ) –

    Specifies a test MQTT authorization request.

  • tls_context (Optional[TlsContext], default: None ) –

    Specifies a test TLS authorization request.

Raises:

Source code in docs_src/capo_iot/_services/async_io_t.py
async def test_invoke_authorizer(
    self,
    authorizer_name: "capo_iot.types.authorizer_name.AuthorizerName",
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    token: Optional["capo_iot.types.token.Token"] = None,
    token_signature: Optional[
        "capo_iot.types.token_signature.TokenSignature"
    ] = None,
    http_context: Optional["capo_iot.types.http_context.HttpContext"] = None,
    mqtt_context: Optional["capo_iot.types.mqtt_context.MqttContext"] = None,
    tls_context: Optional["capo_iot.types.tls_context.TlsContext"] = None,
) -> "capo_iot.types.test_invoke_authorizer_response.TestInvokeAuthorizerResponse":
    """<p>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.</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">TestInvokeAuthorizer</a> action.</p>

    Args:
        authorizer_name: <p>The custom authorizer name.</p>
        token: <p>The token returned by your custom authentication service.</p>
        token_signature: <p>The signature made with the token and your custom authentication service's private key. This value must be Base-64-encoded.</p>
        http_context: <p>Specifies a test HTTP authorization request.</p>
        mqtt_context: <p>Specifies a test MQTT authorization request.</p>
        tls_context: <p>Specifies a test TLS authorization request.</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.invalid_response_exception.InvalidResponseException: <p>The response is invalid.</p>
        capo_iot.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</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.test_invoke_authorizer_request.TestInvokeAuthorizerRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot.types.test_invoke_authorizer_response.TestInvokeAuthorizerResponse"
    ]:
        import capo_iot._operations.aws_iot_service.test_invoke_authorizer

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("TestInvokeAuthorizer")
    )
    input_: capo_iot.types.test_invoke_authorizer_request.TestInvokeAuthorizerRequest = {
        "authorizer_name": authorizer_name
    }
    if token is not None:
        input_["token"] = token
    if token_signature is not None:
        input_["token_signature"] = token_signature
    if http_context is not None:
        input_["http_context"] = http_context
    if mqtt_context is not None:
        input_["mqtt_context"] = mqtt_context
    if tls_context is not None:
        input_["tls_context"] = tls_context

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