Skip to content

Commit bc9aa0f

Browse files
committed
(ELI-623) adding logging and auditng to lambda and api gateway
1 parent 4e7d2a2 commit bc9aa0f

4 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/eligibility_signposting_api/audit/audit_context.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def add_request_details(request: Request) -> None:
4848
x_correlation_id=request.headers.get("X-Correlation-ID"),
4949
nhsd_end_user_organisation_ods=request.headers.get("NHSD-End-User-Organisation-ODS"),
5050
nhsd_application_id=request.headers.get("nhsd-application-id"),
51+
nhse_product_id=request.headers.get("nhse-product-id"),
5152
)
5253
),
5354
query_params=(

src/eligibility_signposting_api/audit/audit_models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class RequestAuditHeader(CamelCaseBaseModel):
1717
x_correlation_id: str | None = None
1818
nhsd_end_user_organisation_ods: str | None = None
1919
nhsd_application_id: str | None = None
20+
nhse_product_id: str | None = None
2021

2122

2223
class RequestAuditQueryParams(CamelCaseBaseModel):

src/eligibility_signposting_api/logging/logs_helper.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ def wrapper(event: LambdaEvent, context: LambdaContext) -> dict[str, Any] | None
2020
"x_request_id": headers.get("X-Request-ID"),
2121
"x_correlation_id": headers.get("X-Correlation-ID"),
2222
"gateway_request_id": gateway_request_id,
23+
"nhse_product_id": headers.get("nhse-product-id"),
24+
"nhsd_application_id": headers.get("nhsd-application-id"),
2325
},
2426
)
2527
return func(event, context)

tests/integration/lambda/test_app_running_as_lambda.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ def test_given_nhs_number_in_path_matches_with_nhs_number_in_headers_and_check_i
231231
"xCorrelationId": "x_correlation_id",
232232
"nhsdEndUserOrganisationOds": "nhsd_end_user_organisation_ods",
233233
"nhsdApplicationId": "nhsd-application-id",
234+
"nhseProductId": consumer_id,
234235
}
235236
expected_query_params = {"category": None, "conditions": None, "includeActions": "Y"}
236237

@@ -478,6 +479,7 @@ def test_given_person_has_unique_status_for_different_conditions_with_audit( #
478479
"xCorrelationId": "x_correlation_id",
479480
"nhsdEndUserOrganisationOds": "nhsd_end_user_organisation_ods",
480481
"nhsdApplicationId": "nhsd-application-id",
482+
"nhseProductId": consumer_id,
481483
}
482484
expected_query_params = {"category": "VACCINATIONS", "conditions": "COVID,FLU,RSV", "includeActions": "Y"}
483485

0 commit comments

Comments
 (0)