RequestContext

class aws_cdk.aws_apigateway.RequestContext(*, account_id=None, api_id=None, api_key=None, authorizer_principal_id=None, caller=None, cognito_authentication_provider=None, cognito_authentication_type=None, cognito_identity_id=None, cognito_identity_pool_id=None, http_method=None, request_id=None, resource_id=None, resource_path=None, source_ip=None, stage=None, user=None, user_agent=None, user_arn=None)

Bases: object

Configure what must be included in the requestContext.

More details can be found at mapping templates documentation.

Parameters:
  • account_id (Optional[bool]) – Represents the information of $context.identity.accountId. Whether the AWS account of the API owner should be included in the request context Default: false

  • api_id (Optional[bool]) – Represents the information of $context.apiId. Whether the identifier API Gateway assigns to your API should be included in the request context. Default: false

  • api_key (Optional[bool]) – Represents the information of $context.identity.apiKey. Whether the API key associated with the request should be included in request context. Default: false

  • authorizer_principal_id (Optional[bool]) – Represents the information of $context.authorizer.principalId. Whether the principal user identifier associated with the token sent by the client and returned from an API Gateway Lambda authorizer should be included in the request context. Default: false

  • caller (Optional[bool]) – Represents the information of $context.identity.caller. Whether the principal identifier of the caller that signed the request should be included in the request context. Supported for resources that use IAM authorization. Default: false

  • cognito_authentication_provider (Optional[bool]) – Represents the information of $context.identity.cognitoAuthenticationProvider. Whether the list of the Amazon Cognito authentication providers used by the caller making the request should be included in the request context. Available only if the request was signed with Amazon Cognito credentials. Default: false

  • cognito_authentication_type (Optional[bool]) – Represents the information of $context.identity.cognitoAuthenticationType. Whether the Amazon Cognito authentication type of the caller making the request should be included in the request context. Available only if the request was signed with Amazon Cognito credentials. Possible values include authenticated for authenticated identities and unauthenticated for unauthenticated identities. Default: false

  • cognito_identity_id (Optional[bool]) – Represents the information of $context.identity.cognitoIdentityId. Whether the Amazon Cognito identity ID of the caller making the request should be included in the request context. Available only if the request was signed with Amazon Cognito credentials. Default: false

  • cognito_identity_pool_id (Optional[bool]) – Represents the information of $context.identity.cognitoIdentityPoolId. Whether the Amazon Cognito identity pool ID of the caller making the request should be included in the request context. Available only if the request was signed with Amazon Cognito credentials. Default: false

  • http_method (Optional[bool]) – Represents the information of $context.httpMethod. Whether the HTTP method used should be included in the request context. Valid values include: DELETE, GET, HEAD, OPTIONS, PATCH, POST, and PUT. Default: false

  • request_id (Optional[bool]) – Represents the information of $context.requestId. Whether the ID for the request should be included in the request context. Default: false

  • resource_id (Optional[bool]) – Represents the information of $context.resourceId. Whether the identifier that API Gateway assigns to your resource should be included in the request context. Default: false

  • resource_path (Optional[bool]) – Represents the information of $context.resourcePath. Whether the path to the resource should be included in the request context. Default: false

  • source_ip (Optional[bool]) – Represents the information of $context.identity.sourceIp. Whether the source IP address of the immediate TCP connection making the request to API Gateway endpoint should be included in the request context. Default: false

  • stage (Optional[bool]) – Represents the information of $context.stage. Whether the deployment stage of the API request should be included in the request context. Default: false

  • user (Optional[bool]) – Represents the information of $context.identity.user. Whether the principal identifier of the user that will be authorized should be included in the request context. Supported for resources that use IAM authorization. Default: false

  • user_agent (Optional[bool]) – Represents the information of $context.identity.userAgent. Whether the User-Agent header of the API caller should be included in the request context. Default: false

  • user_arn (Optional[bool]) – Represents the information of $context.identity.userArn. Whether the Amazon Resource Name (ARN) of the effective user identified after authentication should be included in the request context. Default: false

See:

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html

ExampleMetadata:

fixture=stepfunctions infused

Example:

apigateway.StepFunctionsRestApi(self, "StepFunctionsRestApi",
    state_machine=machine,
    headers=True,
    path=False,
    querystring=False,
    authorizer=False,
    request_context=apigateway.RequestContext(
        caller=True,
        user=True
    )
)

Attributes

account_id

Represents the information of $context.identity.accountId.

Whether the AWS account of the API owner should be included in the request context

Default:

false

api_id

Represents the information of $context.apiId.

Whether the identifier API Gateway assigns to your API should be included in the request context.

Default:

false

api_key

Represents the information of $context.identity.apiKey.

Whether the API key associated with the request should be included in request context.

Default:

false

authorizer_principal_id

Represents the information of $context.authorizer.principalId.

Whether the principal user identifier associated with the token sent by the client and returned from an API Gateway Lambda authorizer should be included in the request context.

Default:

false

caller

Represents the information of $context.identity.caller.

Whether the principal identifier of the caller that signed the request should be included in the request context. Supported for resources that use IAM authorization.

Default:

false

cognito_authentication_provider

Represents the information of $context.identity.cognitoAuthenticationProvider.

Whether the list of the Amazon Cognito authentication providers used by the caller making the request should be included in the request context. Available only if the request was signed with Amazon Cognito credentials.

Default:

false

cognito_authentication_type

Represents the information of $context.identity.cognitoAuthenticationType.

Whether the Amazon Cognito authentication type of the caller making the request should be included in the request context. Available only if the request was signed with Amazon Cognito credentials. Possible values include authenticated for authenticated identities and unauthenticated for unauthenticated identities.

Default:

false

cognito_identity_id

Represents the information of $context.identity.cognitoIdentityId.

Whether the Amazon Cognito identity ID of the caller making the request should be included in the request context. Available only if the request was signed with Amazon Cognito credentials.

Default:

false

cognito_identity_pool_id

Represents the information of $context.identity.cognitoIdentityPoolId.

Whether the Amazon Cognito identity pool ID of the caller making the request should be included in the request context. Available only if the request was signed with Amazon Cognito credentials.

Default:

false

http_method

Represents the information of $context.httpMethod.

Whether the HTTP method used should be included in the request context. Valid values include: DELETE, GET, HEAD, OPTIONS, PATCH, POST, and PUT.

Default:

false

request_id

Represents the information of $context.requestId.

Whether the ID for the request should be included in the request context.

Default:

false

resource_id

Represents the information of $context.resourceId.

Whether the identifier that API Gateway assigns to your resource should be included in the request context.

Default:

false

resource_path

Represents the information of $context.resourcePath.

Whether the path to the resource should be included in the request context.

Default:

false

source_ip

Represents the information of $context.identity.sourceIp.

Whether the source IP address of the immediate TCP connection making the request to API Gateway endpoint should be included in the request context.

Default:

false

stage

Represents the information of $context.stage.

Whether the deployment stage of the API request should be included in the request context.

Default:

false

user

Represents the information of $context.identity.user.

Whether the principal identifier of the user that will be authorized should be included in the request context. Supported for resources that use IAM authorization.

Default:

false

user_agent

Represents the information of $context.identity.userAgent.

Whether the User-Agent header of the API caller should be included in the request context.

Default:

false

user_arn

Represents the information of $context.identity.userArn.

Whether the Amazon Resource Name (ARN) of the effective user identified after authentication should be included in the request context.

Default:

false