Skip to content

APIGatewayClient.create_authorizer

rboto-api-gateway==0.4.0 · Service index · Types

Model summary (excerpt): Adds a new Authorizer resource to an existing RestApi resource.

Install and imports

python -m pip install "rboto[api-gateway]==0.4.0"
from rboto import APIGatewayClient
from collections.abc import Sequence
from rboto_api_gateway.types import (
    AuthorizerType,
    CreateAuthorizerOutput,
    JwtConfigurationInput,
)

Signature

async def create_authorizer(
    *,
    rest_api_id: str,
    name: str,
    type: AuthorizerType,
    provider_arns: Sequence[str] | None = None,
    auth_type: str | None = None,
    authorizer_uri: str | None = None,
    authorizer_credentials: str | None = None,
    identity_source: str | None = None,
    identity_validation_expression: str | None = None,
    authorizer_result_ttl_in_seconds: int | None = None,
    jwt_configuration: JwtConfigurationInput | None = None,
) -> CreateAuthorizerOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
rest_api_id Yes The string identifier of the associated RestApi.
name Yes The name of the authorizer.
type Yes The authorizer type. Valid values are TOKEN for a Lambda function using a single authorization token submitted in a custom header, REQUEST for a Lambda function using incoming request parameters, COGNITO_USER_POOLS for using an Amazon Cognito user pool, and JWT for using a native JWT authorizer with the trusted issuers, audiences, and signing algorithms that you declare.
provider_arns No A list of the Amazon Cognito user pool ARNs for the COGNITO_USER_POOLS authorizer. Each element is of this format: arn:aws:cognito-idp:{region}:{account_id}:userpool/{user_pool_id} . For a TOKEN or REQUEST authorizer, this is not defined. This property is not supported for JWT authorizers.
auth_type No Optional customer-defined field, used in OpenAPI imports and exports without functional impact.
authorizer_uri No Specifies the authorizer's Uniform Resource Identifier (URI). For TOKEN or REQUEST authorizers, this must be a well-formed Lambda function URI, for example, arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:{account_id}:function:{lambda_function_name}/invocations . In general, the URI has this form arn:aws:apigateway:{region}:lambda:path/{service_api} ,...
authorizer_credentials No Specifies the required credentials as an IAM role for API Gateway to invoke the authorizer. To specify an IAM role for API Gateway to assume, use the role's Amazon Resource Name (ARN). To use resource-based permissions on the Lambda function, specify null. This property is not supported for JWT authorizers.
identity_source No The identity source for which authorization is requested. For a TOKEN or COGNITO_USER_POOLS authorizer, this is required and specifies the request header mapping expression for the custom header holding the authorization token submitted by the client. For example, if the token header name is Auth , the header mapping expression is method.request.header.Auth . For the REQUEST authorizer, this...
identity_validation_expression No A validation expression for the incoming identity token. For TOKEN authorizers, this value is a regular expression. For COGNITO_USER_POOLS authorizers, API Gateway will match the aud field of the incoming token from the client against the specified regular expression. It will invoke the authorizer's Lambda function when there is a match. Otherwise, it will return a 401 Unauthorized response...
authorizer_result_ttl_in_seconds No The TTL in seconds of cached authorizer results. If it equals 0, authorization caching is disabled. If it is greater than 0, API Gateway will cache authorizer responses. If this field is not set, the default value is 300. The maximum value is 3600, or 1 hour. This property is not supported for JWT authorizers.
jwt_configuration No The configuration for a JWT authorizer. Required for JWT authorizers.

Output

CreateAuthorizerOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
id str | None Always present —
name str | None Always present —
type AuthorizerTypeOutput | None Always present AuthorizerTypeOutput
provider_arns list[str] | None Always present —
auth_type str | None Always present —
authorizer_uri str | None Always present —
authorizer_credentials str | None Always present —
identity_source str | None Always present —
identity_validation_expression str | None Always present —
authorizer_result_ttl_in_seconds int | None Always present —
jwt_configuration JwtConfigurationOutput | None Always present JwtConfigurationOutput

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

AuthorizerType, CreateAuthorizerOutput, JwtConfigurationInput

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_api_gateway.exceptions:

BadRequestError, ConflictError, LimitExceededError, NotFoundError, TooManyRequestsError, UnauthorizedError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model