test_invoke_authorizer

APIGateway.Client.test_invoke_authorizer(**kwargs)

Simulate the execution of an Authorizer in your RestApi with headers, parameters, and an incoming request body.

See also: AWS API Documentation

Request Syntax

response = client.test_invoke_authorizer(
    restApiId='string',
    authorizerId='string',
    headers={
        'string': 'string'
    },
    multiValueHeaders={
        'string': [
            'string',
        ]
    },
    pathWithQueryString='string',
    body='string',
    stageVariables={
        'string': 'string'
    },
    additionalContext={
        'string': 'string'
    }
)
Parameters
  • restApiId (string) --

    [REQUIRED]

    The string identifier of the associated RestApi.

  • authorizerId (string) --

    [REQUIRED]

    Specifies a test invoke authorizer request's Authorizer ID.

  • headers (dict) --

    A key-value map of headers to simulate an incoming invocation request. This is where the incoming authorization token, or identity source, should be specified.

    • (string) --
      • (string) --
  • multiValueHeaders (dict) --

    The headers as a map from string to list of values to simulate an incoming invocation request. This is where the incoming authorization token, or identity source, may be specified.

    • (string) --
      • (list) --
        • (string) --
  • pathWithQueryString (string) -- The URI path, including query string, of the simulated invocation request. Use this to specify path parameters and query string parameters.
  • body (string) -- The simulated request body of an incoming invocation request.
  • stageVariables (dict) --

    A key-value map of stage variables to simulate an invocation on a deployed Stage.

    • (string) --
      • (string) --
  • additionalContext (dict) --

    A key-value map of additional context variables.

    • (string) --
      • (string) --
Return type

dict

Returns

Response Syntax

{
    'clientStatus': 123,
    'log': 'string',
    'latency': 123,
    'principalId': 'string',
    'policy': 'string',
    'authorization': {
        'string': [
            'string',
        ]
    },
    'claims': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --

    Represents the response of the test invoke request for a custom Authorizer

    • clientStatus (integer) --

      The HTTP status code that the client would have received. Value is 0 if the authorizer succeeded.

    • log (string) --

      The API Gateway execution log for the test authorizer request.

    • latency (integer) --

      The execution latency of the test authorizer request.

    • principalId (string) --

      The principal identity returned by the Authorizer

    • policy (string) --

      The JSON policy document returned by the Authorizer

    • authorization (dict) --

      The authorization response.

      • (string) --
        • (list) --
          • (string) --
    • claims (dict) --

      The open identity claims, with any supported custom attributes, returned from the Cognito Your User Pool configured for the API.

      • (string) --
        • (string) --

Exceptions

  • APIGateway.Client.exceptions.BadRequestException
  • APIGateway.Client.exceptions.UnauthorizedException
  • APIGateway.Client.exceptions.NotFoundException
  • APIGateway.Client.exceptions.TooManyRequestsException