Table of Contents

Class RequestContext

Namespace
Amazon.CDK.AWS.APIGateway
Assembly
Amazon.CDK.AWS.APIGateway.dll

Configure what must be included in the requestContext.

public class RequestContext : IRequestContext
Inheritance
RequestContext
Implements
Inherited Members

Examples

new StepFunctionsRestApi(this, "StepFunctionsRestApi", new StepFunctionsRestApiProps {
                 StateMachine = machine,
                 Headers = true,
                 Path = false,
                 Querystring = false,
                 Authorizer = false,
                 RequestContext = new RequestContext {
                     Caller = true,
                     User = true
                 }
             });

Remarks

More details can be found at mapping templates documentation.

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

ExampleMetadata: fixture=stepfunctions infused

Constructors

RequestContext()

public RequestContext()

Properties

AccountId

Represents the information of $context.identity.accountId.

public bool? AccountId { get; set; }

Property Value

bool?

Remarks

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

Default: false

ApiId

Represents the information of $context.apiId.

public bool? ApiId { get; set; }

Property Value

bool?

Remarks

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

Default: false

ApiKey

Represents the information of $context.identity.apiKey.

public bool? ApiKey { get; set; }

Property Value

bool?

Remarks

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

Default: false

AuthorizerPrincipalId

Represents the information of $context.authorizer.principalId.

public bool? AuthorizerPrincipalId { get; set; }

Property Value

bool?

Remarks

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.

public bool? Caller { get; set; }

Property Value

bool?

Remarks

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

CognitoAuthenticationProvider

Represents the information of $context.identity.cognitoAuthenticationProvider.

public bool? CognitoAuthenticationProvider { get; set; }

Property Value

bool?

Remarks

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

CognitoAuthenticationType

Represents the information of $context.identity.cognitoAuthenticationType.

public bool? CognitoAuthenticationType { get; set; }

Property Value

bool?

Remarks

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

CognitoIdentityId

Represents the information of $context.identity.cognitoIdentityId.

public bool? CognitoIdentityId { get; set; }

Property Value

bool?

Remarks

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

CognitoIdentityPoolId

Represents the information of $context.identity.cognitoIdentityPoolId.

public bool? CognitoIdentityPoolId { get; set; }

Property Value

bool?

Remarks

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

HttpMethod

Represents the information of $context.httpMethod.

public bool? HttpMethod { get; set; }

Property Value

bool?

Remarks

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

RequestId

Represents the information of $context.requestId.

public bool? RequestId { get; set; }

Property Value

bool?

Remarks

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

Default: false

ResourceId

Represents the information of $context.resourceId.

public bool? ResourceId { get; set; }

Property Value

bool?

Remarks

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

Default: false

ResourcePath

Represents the information of $context.resourcePath.

public bool? ResourcePath { get; set; }

Property Value

bool?

Remarks

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

Default: false

SourceIp

Represents the information of $context.identity.sourceIp.

public bool? SourceIp { get; set; }

Property Value

bool?

Remarks

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.

public bool? Stage { get; set; }

Property Value

bool?

Remarks

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.

public bool? User { get; set; }

Property Value

bool?

Remarks

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

UserAgent

Represents the information of $context.identity.userAgent.

public bool? UserAgent { get; set; }

Property Value

bool?

Remarks

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

Default: false

UserArn

Represents the information of $context.identity.userArn.

public bool? UserArn { get; set; }

Property Value

bool?

Remarks

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

Default: false