@@ -54,6 +54,14 @@ Parameters:
5454 Type : String
5555 Default : none
5656
57+ NHSNotifyUpdateCallbackFunctionName :
58+ Type : String
59+ Default : none
60+
61+ NHSNotifyUpdateCallbackFunctionArn :
62+ Type : String
63+ Default : none
64+
5765 LogRetentionInDays :
5866 Type : Number
5967
@@ -427,6 +435,32 @@ Resources:
427435 - StatusCode : " 400"
428436 - StatusCode : " 500"
429437
438+ NotificationDeliveryStatusCallbackMethod :
439+ Type : AWS::ApiGateway::Method
440+ Properties :
441+ RestApiId : !Ref RestApiGateway
442+ ResourceId : !Ref NotificationDeliveryStatusCallbackResource
443+ HttpMethod : POST
444+ AuthorizationType : NONE # TODO: They authenticate with a JWT header
445+ Integration :
446+ Type : AWS_PROXY
447+ Credentials : !GetAtt RestApiGatewayResources.Outputs.ApiGwRoleArn
448+ IntegrationHttpMethod : POST
449+ Uri : !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${NHSNotifyUpdateCallbackFunctionArn}/invocations
450+ MethodResponses :
451+ - StatusCode : " 202"
452+ - StatusCode : " 401"
453+ - StatusCode : " 403"
454+ - StatusCode : " 429"
455+ - StatusCode : " 500"
456+
457+ NotificationDeliveryStatusCallbackResource :
458+ Type : AWS::ApiGateway::Resource
459+ Properties :
460+ RestApiId : !Ref RestApiGateway
461+ ParentId : !GetAtt RestApiGateway.RootResourceId
462+ PathPart : notification-delivery-status-callback
463+
430464 StatusLambdaMethodResource :
431465 Type : AWS::ApiGateway::Resource
432466 Properties :
@@ -516,7 +550,7 @@ Resources:
516550 # if you add a new endpoint, then change the name of this resource
517551 # also need to change it in RestApiGatewayStage.Properties.DeploymentId
518552 # *********************************************************************
519- RestApiGatewayDeploymentV1f :
553+ RestApiGatewayDeploymentV2f :
520554 Type : AWS::ApiGateway::Deployment
521555 DependsOn :
522556 # see note above if you add something in here when you add a new endpoint
@@ -525,6 +559,7 @@ Resources:
525559 - CapabilityStatementMethod
526560 - Format1UpdatePrescriptionStatusMethod
527561 - CheckPrescriptionStatusUpdatesWaitCondition
562+ - NotificationDeliveryStatusCallbackMethod
528563 # see note above if you add something in here when you add a new endpoint
529564 Properties :
530565 RestApiId : !Ref RestApiGateway
@@ -533,7 +568,7 @@ Resources:
533568 Type : AWS::ApiGateway::Stage
534569 Properties :
535570 RestApiId : !Ref RestApiGateway
536- DeploymentId : !Ref RestApiGatewayDeploymentV1f
571+ DeploymentId : !Ref RestApiGatewayDeploymentV2f
537572 StageName : prod
538573 TracingEnabled : true
539574 AccessLogSetting :
@@ -557,6 +592,7 @@ Resources:
557592 - - Fn::ImportValue : !Sub ${StackName}:state-machines:${UpdatePrescriptionStatusStateMachineName}:ExecuteStateMachinePolicy
558593 - Fn::ImportValue : !Sub ${StackName}:functions:${StatusFunctionName}:ExecuteLambdaPolicyArn
559594 - Fn::ImportValue : !Sub ${StackName}:functions:${CapabilityStatementFunctionName}:ExecuteLambdaPolicyArn
595+ - Fn::ImportValue : !Sub ${StackName}:functions:${NHSNotifyUpdateCallbackFunctionName}:ExecuteLambdaPolicyArn
560596 - Fn::ImportValue : !Sub ${StackName}:state-machines:${Format1UpdatePrescriptionsStatusStateMachineName}:ExecuteStateMachinePolicy
561597 - !If
562598 - ShouldDeployCheckPrescriptionStatusUpdate
0 commit comments