|
| 1 | +/** |
| 2 | + * Configure what must be included in the `requestContext` |
| 3 | + * |
| 4 | + * More details can be found at mapping templates documentation. |
| 5 | + * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html |
| 6 | + */ |
| 7 | +export interface RequestContext { |
| 8 | + /** |
| 9 | + * Represents the information of $context.identity.accountId |
| 10 | + * |
| 11 | + * Whether the AWS account of the API owner should be included in the request context |
| 12 | + * @default false |
| 13 | + */ |
| 14 | + readonly accountId?: boolean; |
| 15 | + |
| 16 | + /** |
| 17 | + * Represents the information of $context.apiId |
| 18 | + * |
| 19 | + * Whether the identifier API Gateway assigns to your API should be included in the request context. |
| 20 | + * @default false |
| 21 | + */ |
| 22 | + readonly apiId?: boolean; |
| 23 | + |
| 24 | + /** |
| 25 | + * Represents the information of $context.identity.apiKey |
| 26 | + * |
| 27 | + * Whether the API key associated with the request should be included in request context. |
| 28 | + * @default false |
| 29 | + */ |
| 30 | + readonly apiKey?: boolean; |
| 31 | + |
| 32 | + /** |
| 33 | + * Represents the information of $context.authorizer.principalId |
| 34 | + * |
| 35 | + * Whether the principal user identifier associated with the token sent by the client and returned |
| 36 | + * from an API Gateway Lambda authorizer should be included in the request context. |
| 37 | + * @default false |
| 38 | + */ |
| 39 | + readonly authorizerPrincipalId?: boolean; |
| 40 | + |
| 41 | + /** |
| 42 | + * Represents the information of $context.identity.caller |
| 43 | + * |
| 44 | + * Whether the principal identifier of the caller that signed the request should be included in the request context. |
| 45 | + * Supported for resources that use IAM authorization. |
| 46 | + * @default false |
| 47 | + */ |
| 48 | + readonly caller?: boolean; |
| 49 | + |
| 50 | + /** |
| 51 | + * Represents the information of $context.identity.cognitoAuthenticationProvider |
| 52 | + * |
| 53 | + * Whether the list of the Amazon Cognito authentication providers used by the caller making the request should be included in the request context. |
| 54 | + * Available only if the request was signed with Amazon Cognito credentials. |
| 55 | + * @default false |
| 56 | + */ |
| 57 | + readonly cognitoAuthenticationProvider?: boolean; |
| 58 | + |
| 59 | + /** |
| 60 | + * Represents the information of $context.identity.cognitoAuthenticationType |
| 61 | + * |
| 62 | + * Whether the Amazon Cognito authentication type of the caller making the request should be included in the request context. |
| 63 | + * Available only if the request was signed with Amazon Cognito credentials. |
| 64 | + * Possible values include authenticated for authenticated identities and unauthenticated for unauthenticated identities. |
| 65 | + * @default false |
| 66 | + */ |
| 67 | + readonly cognitoAuthenticationType?: boolean; |
| 68 | + |
| 69 | + /** |
| 70 | + * Represents the information of $context.identity.cognitoIdentityId |
| 71 | + * |
| 72 | + * Whether the Amazon Cognito identity ID of the caller making the request should be included in the request context. |
| 73 | + * Available only if the request was signed with Amazon Cognito credentials. |
| 74 | + * @default false |
| 75 | + */ |
| 76 | + readonly cognitoIdentityId?: boolean; |
| 77 | + |
| 78 | + /** |
| 79 | + * Represents the information of $context.identity.cognitoIdentityPoolId |
| 80 | + * |
| 81 | + * Whether the Amazon Cognito identity pool ID of the caller making the request should be included in the request context. |
| 82 | + * Available only if the request was signed with Amazon Cognito credentials. |
| 83 | + * @default false |
| 84 | + */ |
| 85 | + readonly cognitoIdentityPoolId?: boolean; |
| 86 | + |
| 87 | + /** |
| 88 | + * Represents the information of $context.httpMethod |
| 89 | + * |
| 90 | + * Whether the HTTP method used should be included in the request context. |
| 91 | + * Valid values include: DELETE, GET, HEAD, OPTIONS, PATCH, POST, and PUT. |
| 92 | + * @default false |
| 93 | + */ |
| 94 | + readonly httpMethod?: boolean; |
| 95 | + |
| 96 | + /** |
| 97 | + * Represents the information of $context.stage |
| 98 | + * |
| 99 | + * Whether the deployment stage of the API request should be included in the request context. |
| 100 | + * @default false |
| 101 | + */ |
| 102 | + readonly stage?: boolean; |
| 103 | + |
| 104 | + /** |
| 105 | + * Represents the information of $context.identity.sourceIp |
| 106 | + * |
| 107 | + * Whether the source IP address of the immediate TCP connection making the request |
| 108 | + * to API Gateway endpoint should be included in the request context. |
| 109 | + * @default false |
| 110 | + */ |
| 111 | + readonly sourceIp?: boolean; |
| 112 | + |
| 113 | + /** |
| 114 | + * Represents the information of $context.identity.user |
| 115 | + * |
| 116 | + * Whether the principal identifier of the user that will be authorized should be included in the request context. |
| 117 | + * Supported for resources that use IAM authorization. |
| 118 | + * @default false |
| 119 | + */ |
| 120 | + readonly user?: boolean; |
| 121 | + |
| 122 | + /** |
| 123 | + * Represents the information of $context.identity.userAgent |
| 124 | + * |
| 125 | + * Whether the User-Agent header of the API caller should be included in the request context. |
| 126 | + * @default false |
| 127 | + */ |
| 128 | + readonly userAgent?: boolean; |
| 129 | + |
| 130 | + /** |
| 131 | + * Represents the information of $context.identity.userArn |
| 132 | + * |
| 133 | + * Whether the Amazon Resource Name (ARN) of the effective user identified after authentication should be included in the request context. |
| 134 | + * @default false |
| 135 | + */ |
| 136 | + readonly userArn?: boolean; |
| 137 | + |
| 138 | + /** |
| 139 | + * Represents the information of $context.requestId |
| 140 | + * |
| 141 | + * Whether the ID for the request should be included in the request context. |
| 142 | + * @default false |
| 143 | + */ |
| 144 | + readonly requestId?: boolean; |
| 145 | + |
| 146 | + /** |
| 147 | + * Represents the information of $context.resourceId |
| 148 | + * |
| 149 | + * Whether the identifier that API Gateway assigns to your resource should be included in the request context. |
| 150 | + * @default false |
| 151 | + */ |
| 152 | + readonly resourceId?: boolean; |
| 153 | + |
| 154 | + /** |
| 155 | + * Represents the information of $context.resourcePath |
| 156 | + * |
| 157 | + * Whether the path to the resource should be included in the request context. |
| 158 | + * @default false |
| 159 | + */ |
| 160 | + readonly resourcePath?: boolean; |
| 161 | +} |
0 commit comments