Skip to content

Commit

Permalink
Merge pull request #397 from guardian/holiday-stop-api-README
Browse files Browse the repository at this point in the history
README for holiday-stop-api lambda
  • Loading branch information
twrichards committed Sep 2, 2019
2 parents 60a051c + 9a38f00 commit ee3011a
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions handlers/holiday-stop-api/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# holiday-stop-api
# TODO
All endpoints require...

- `x-api-key` header (generated by the `HolidayStopApiKey` in the CloudFormation)
- and either...
- `x-identity-id` header which specifies the identityID of the user to request data for _(sent in the `manage-frontend` use-case)_
- `x-salesforce-contact-id` header which specifies the Salesforce contact ID of the user to request data for _(sent in the CSR UI (in Salesforce) use-case)_

| Method | Endpoint | Description |
| --- | --- | --- |
| GET | `/{STAGE}/potential?startDate={yyyy-MM-dd}&endDate={yyyy-MM-dd}` (with `x-product-name-prefix` header set) | returns an array of dates for each issue impacted between the dates for the given product |
| GET | `/{STAGE}/hsr` | returns all holiday stops (past & present) for the user |
| GET | `/{STAGE}/hsr` (with `x-product-name-prefix` header set) | returns all holiday stops (past & present) but including a calculated 'first available date' based on the type of product |
| GET | `/{STAGE}/hsr /{SUBSCRIPTION_NAME}` (with `x-product-name-prefix` header set) | returns all holiday stops (past & present) for the user filtered on the specified subscription also including a calculated 'first available date' based on the type of product |
| POST | `/{STAGE}/hsr` | creates a new all holiday stop, example body `{ "start": "2023-06-10", "end": "2024-06-14", "subscriptionName": "A-S00071783" }`|
| DELETE | `/{STAGE}/hsr /{SUBSCRIPTION_NAME} /{SF_ID}` | deletes the holiday stop request from SalesForce (with Id matching `{SF_ID}`) |


### Handling Multiple Environments
# TODO
This lambda has a one-to-one relationship between AWS Stack/Stage and Salesforce Environment.
- SF DEV <-> AWS DEV Stack
- SF UAT <-> AWS CODE Stack
- SF PROD <-> AWS PROD Stack


The CSR UI (in Salesforce) is one consumer of this API and so each Salesforce environment is configured to speak the corresponding instance of the lambda.

`manage-frontend` is the main consumer and it supports 'test-users' and calls the correct instance of this lambda accordingly.

| Stage of `manage-frontend` | normal mode | test user mode |
| --- | --- | --- |
| DEV (local machine) | DEV Lambda* (SF Dev) | CODE Lambda (SF UAT) |
| CODE | DEV Lambda* (SF Dev) | CODE Lambda (SF UAT) |
| PROD | PROD Lambda (SF Dev) | CODE Lambda (SF UAT) |

\* Yes indeed there is a DEV Stack for the lambda, which is unusual and currently a bit fiddly to deploy via Riff-Raff (you need to 'Preview' the deploy then change the 'stage' parameter in the URL)

0 comments on commit ee3011a

Please sign in to comment.