diff --git a/SAMtemplates/functions/main.yaml b/SAMtemplates/functions/main.yaml index 1e9df35d0..dd322f8a6 100644 --- a/SAMtemplates/functions/main.yaml +++ b/SAMtemplates/functions/main.yaml @@ -1,4 +1,4 @@ -AWSTemplateFormatVersion: '2010-09-09' +AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 Description: | PSU lambda functions and related resources @@ -12,7 +12,7 @@ Globals: Runtime: nodejs20.x Environment: Variables: - NODE_OPTIONS: '--enable-source-maps' + NODE_OPTIONS: "--enable-source-maps" Layers: - !Sub arn:aws:lambda:${AWS::Region}:580247275435:layer:LambdaInsightsExtension:49 @@ -20,17 +20,17 @@ Parameters: StackName: Type: String Default: none - + PrescriptionStatusUpdatesTableName: Type: String Default: none - + LogLevel: Type: String - + LogRetentionInDays: Type: Number - + EnableSplunk: Type: String @@ -55,7 +55,7 @@ Resources: tsconfig: updatePrescriptionStatus/tsconfig.json EntryPoints: - updatePrescriptionStatus/src/updatePrescriptionStatus.ts - + UpdatePrescriptionStatusResources: Type: AWS::Serverless::Application Properties: @@ -66,7 +66,7 @@ Resources: LambdaArn: !Sub arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${StackName}-UpdatePrescriptionStatus IncludeAdditionalPolicies: true AdditionalPolicies: !Join - - ',' + - "," - - Fn::ImportValue: !Sub ${StackName}:tables:${PrescriptionStatusUpdatesTableName}:TableWritePolicyArn LogRetentionInDays: !Ref LogRetentionInDays CloudWatchKMSKeyId: !ImportValue account-resources:CloudwatchLogsKmsKeyArn @@ -74,6 +74,45 @@ Resources: SplunkSubscriptionFilterRole: !ImportValue lambda-resources:SplunkSubscriptionFilterRole SplunkDeliveryStreamArn: !ImportValue lambda-resources:SplunkDeliveryStream + GUSL: + Type: AWS::Serverless::Function + Properties: + FunctionName: !Sub ${StackName}-GetStatusUpdates + CodeUri: ../../packages + Handler: getStatusUpdates.handler + Role: !GetAtt GSULResources.Outputs.LambdaRoleArn + Environment: + Variables: + TABLE_NAME: !Ref PrescriptionStatusUpdatesTableName + LOG_LEVEL: !Ref LogLevel + Metadata: + BuildMethod: esbuild + BuildProperties: + Minify: true + Target: es2020 + Sourcemap: true + tsconfig: gsul/tsconfig.json + EntryPoints: + - gsul/src/getStatusUpdates.ts + + GSULResources: + Type: AWS::Serverless::Application + Properties: + Location: lambda_resources.yaml + Parameters: + StackName: !Ref StackName + LambdaName: !Sub ${StackName}-GetStatusUpdates + LambdaArn: !Sub arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${StackName}-GetStatusUpdates + IncludeAdditionalPolicies: true + AdditionalPolicies: !Join + - "," + - - Fn::ImportValue: !Sub ${StackName}:tables:${PrescriptionStatusUpdatesTableName}:TableReadPolicyArn + LogRetentionInDays: !Ref LogRetentionInDays + CloudWatchKMSKeyId: !ImportValue account-resources:CloudwatchLogsKmsKeyArn + EnableSplunk: !Ref EnableSplunk + SplunkSubscriptionFilterRole: !ImportValue lambda-resources:SplunkSubscriptionFilterRole + SplunkDeliveryStreamArn: !ImportValue lambda-resources:SplunkDeliveryStream + Outputs: UpdatePrescriptionStatusFunctionName: Description: The function name of the UpdatePrescriptionStatus lambda @@ -81,4 +120,4 @@ Outputs: UpdatePrescriptionStatusFunctionArn: Description: The function ARN of the UpdatePrescriptionStatus lambda - Value: !GetAtt UpdatePrescriptionStatus.Arn + Value: !GetAtt UpdatePrescriptionStatus.Arn