diff --git a/.gitignore b/.gitignore index bb7ec9b9..266ec088 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,4 @@ lambda.zip output.json .aws-sam -build \ No newline at end of file +build diff --git a/lambda-http/src/request.rs b/lambda-http/src/request.rs index 4b230e51..fd509412 100644 --- a/lambda-http/src/request.rs +++ b/lambda-http/src/request.rs @@ -87,6 +87,8 @@ pub enum LambdaRequest<'a> { #[serde(default)] is_base64_encoded: bool, request_context: ApiGatewayRequestContext, + #[serde(default, deserialize_with = "nullable_default")] + resource: Option, }, } @@ -154,10 +156,22 @@ pub struct ApiGatewayRequestContext { pub resource_id: String, /// The deployment stage of the API request (for example, Beta or Prod). pub stage: String, + /// The full domain name used to invoke the API. This should be the same as the incoming Host header. + pub domain_name: Option, + /// The first label of the $context.domainName. This is often used as a caller/customer identifier. + pub domain_prefix: Option, /// The ID that API Gateway assigns to the API request. pub request_id: String, /// The path to your resource. For example, for the non-proxy request URI of `https://{rest-api-id.execute-api.{region}.amazonaws.com/{stage}/root/child`, The $context.resourcePath value is /root/child. pub resource_path: String, + /// The request protocol, for example, HTTP/1.1. + pub protocol: Option, + /// The CLF-formatted request time (dd/MMM/yyyy:HH:mm:ss +-hhmm). + pub request_time: Option, + /// The Epoch-formatted request time, in milliseconds. + pub request_time_epoch: i64, + /// The identifier API Gateway assigns to your API. + pub apiid: Option, /// The HTTP method used. Valid values include: DELETE, GET, HEAD, OPTIONS, PATCH, POST, and PUT. pub http_method: String, /// The stringified value of the specified key-value pair of the context map returned from an API Gateway Lambda authorizer function. @@ -166,6 +180,7 @@ pub struct ApiGatewayRequestContext { /// The identifier API Gateway assigns to your API. pub api_id: String, /// Cofnito identity information + #[serde(default)] pub identity: Identity, } @@ -436,6 +451,7 @@ impl<'a> From> for http::Request { body, is_base64_encoded, request_context, + resource: _, } => { let builder = http::Request::builder() .method(http_method) diff --git a/lambda-http/tests/data/apigw_multi_value_proxy_request.json b/lambda-http/tests/data/apigw_multi_value_proxy_request.json index 90f784e2..5b254c8b 100644 --- a/lambda-http/tests/data/apigw_multi_value_proxy_request.json +++ b/lambda-http/tests/data/apigw_multi_value_proxy_request.json @@ -109,6 +109,7 @@ "resourceId": "roq9wj", "stage": "testStage", "requestId": "deef4878-7910-11e6-8f14-25afc3e9ae33", + "requestTimeEpoch": 1583798639428, "identity": { "cognitoIdentityPoolId": null, "accountId": null, diff --git a/lambda-http/tests/data/apigw_no_host.json b/lambda-http/tests/data/apigw_no_host.json index 369c4870..3143c81b 100644 --- a/lambda-http/tests/data/apigw_no_host.json +++ b/lambda-http/tests/data/apigw_no_host.json @@ -26,6 +26,7 @@ "resourceId": "us4z18", "stage": "test", "requestId": "41b45ea3-70b5-11e6-b7bd-69b5aaebc7d9", + "requestTimeEpoch": 1583798639428, "identity": { "cognitoIdentityPoolId": "", "accountId": "", diff --git a/lambda-http/tests/data/apigw_proxy_request.json b/lambda-http/tests/data/apigw_proxy_request.json index f76d2b8a..3b7cc9d2 100644 --- a/lambda-http/tests/data/apigw_proxy_request.json +++ b/lambda-http/tests/data/apigw_proxy_request.json @@ -27,6 +27,7 @@ "resourceId": "us4z18", "stage": "test", "requestId": "41b45ea3-70b5-11e6-b7bd-69b5aaebc7d9", + "requestTimeEpoch": 1583798639428, "identity": { "cognitoIdentityPoolId": "", "accountId": "",