Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: [AEA-4134] - issues with psu sandbox #496

Merged
merged 28 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c83800d
Add an initial comment
kris-szlapa Jul 9, 2024
dab9eff
Add logic to remove the target attribute if the environment is sandbox
kris-szlapa Jul 10, 2024
ae42535
Merge branch 'main' of https://github.com/NHSDigital/eps-prescription…
kris-szlapa Jul 10, 2024
62f8c9b
Amend logic to remove target attribute
kris-szlapa Jul 10, 2024
9191dd4
Use APIGEE_ENVIRONMENT in the logic
kris-szlapa Jul 10, 2024
4d854d0
Amend the delete path
kris-szlapa Jul 10, 2024
b1def64
Amend the SPEC_PATH
kris-szlapa Jul 10, 2024
19cceaa
Amend the delete attribute script
kris-szlapa Jul 10, 2024
ea748d3
Delete target-attributes if sandbox env
kris-szlapa Jul 10, 2024
bcc9994
Remove the initial comment
kris-szlapa Jul 11, 2024
0ec0d49
Remove target-attributes for sandbox environment
kris-szlapa Jul 11, 2024
897a96c
Remove target and target-attributes for sandbox environment
kris-szlapa Jul 11, 2024
442ed6f
Restore target-attributes removal
kris-szlapa Jul 11, 2024
78c6fe8
Add status resources to the sandbox template
kris-szlapa Jul 12, 2024
f5addcf
Amend paths in status resources
kris-szlapa Jul 12, 2024
f15de31
Comment out changes
kris-szlapa Jul 12, 2024
330735e
Merge branch 'main' of https://github.com/NHSDigital/eps-prescription…
kris-szlapa Jul 12, 2024
67912ae
Merge branch 'main' of https://github.com/NHSDigital/eps-prescription…
kris-szlapa Jul 12, 2024
051a051
Add status type HttpApi
kris-szlapa Jul 12, 2024
7fb78e5
Amend the status FunctionName
kris-szlapa Jul 12, 2024
bb6c401
Amend status StackName and LambdaName
kris-szlapa Jul 12, 2024
7c89180
Merge branch 'main' of https://github.com/NHSDigital/eps-prescription…
kris-szlapa Jul 12, 2024
f97e0ec
Amend status LambdaArn
kris-szlapa Jul 12, 2024
7f9c6f1
Merge branch 'main' of https://github.com/NHSDigital/eps-prescription…
kris-szlapa Jul 15, 2024
4ea5864
Add the environment variables to the sandbox template
kris-szlapa Jul 15, 2024
b49de44
Add VersionNumber and CommitId parameters
kris-szlapa Jul 15, 2024
5d76269
Merge branch 'main' of https://github.com/NHSDigital/eps-prescription…
kris-szlapa Jul 15, 2024
019d633
Merge branch 'main' of https://github.com/NHSDigital/eps-prescription…
kris-szlapa Jul 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/scripts/deploy_api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ else
jq '.components.securitySchemes."app-level0" = {"$ref": "https://proxygen.ptl.api.platform.nhs.uk/components/securitySchemes/app-level0"}' "${SPEC_PATH}" > temp.json && mv temp.json "${SPEC_PATH}"
fi
fi
# remove checkprescriptionstatusupdates if its not needed

# Remove target attributes if the environment is sandbox
if [[ "${APIGEE_ENVIRONMENT}" == *"sandbox"* ]]; then
echo "Removing target attributes for sandbox environment"
jq 'del(."x-nhsd-apim"."target-attributes")' "$SPEC_PATH" > temp.json && mv temp.json "$SPEC_PATH"
fi

# Remove checkprescriptionstatusupdates if its not needed
if [[ "${DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE}" == "false" ]]; then
if [[ "${API_TYPE}" == "standard" ]]; then
echo "Removing checkprescriptionstatusupdates endpoint"
Expand Down
53 changes: 53 additions & 0 deletions SAMtemplates/sandbox_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ Parameters:
Default: false
AllowedValues: [true, false]

VersionNumber:
Type: String

CommitId:
Type: String

LogLevel:
Type: String
Default: INFO
Expand Down Expand Up @@ -85,6 +91,53 @@ Resources:
EntryPoints:
- sandbox/src/sandbox.ts

Status:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Sub ${AWS::StackName}-status
CodeUri: ../packages
Handler: statusLambda.handler
Role: !GetAtt StatusResources.Outputs.LambdaRoleArn
Environment:
Variables:
VERSION_NUMBER: !Ref VersionNumber
COMMIT_ID: !Ref CommitId
Events:
status:
Type: HttpApi
Properties:
ApiId: !Ref HttpApiGateway
Path: /_status
Method: get
Metadata:
BuildMethod: esbuild
BuildProperties:
Minify: true
Target: es2020
Sourcemap: true
tsconfig: statusLambda/tsconfig.json
packages: bundle
EntryPoints:
- statusLambda/src/statusLambda.ts

StatusResources:
Type: AWS::Serverless::Application
Properties:
Location: functions/lambda_resources.yaml
Parameters:
StackName: AWS::StackName
LambdaName: !Sub ${AWS::StackName}-status
LambdaArn: !Sub arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${AWS::StackName}-status
IncludeAdditionalPolicies: true
AdditionalPolicies: !Join
- ","
- - !ImportValue account-resources:LambdaAccessSecretsPolicy
LogRetentionInDays: !Ref LogRetentionInDays
CloudWatchKMSKeyId: !ImportValue account-resources:CloudwatchLogsKmsKeyArn
EnableSplunk: !Ref EnableSplunk
SplunkSubscriptionFilterRole: !ImportValue lambda-resources:SplunkSubscriptionFilterRole
SplunkDeliveryStreamArn: !ImportValue lambda-resources:SplunkDeliveryStream

CapabilityStatement:
Type: AWS::Serverless::Function
Properties:
Expand Down