diff --git a/lambdas/assets/av-download-template.txt b/lambdas/assets/av-download-template.txt
deleted file mode 100644
index c25cdc47..00000000
--- a/lambdas/assets/av-download-template.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "TemplateName": "av-download-template",
- "TemplateContent": {
- "Subject": "Your {{fileType}} download from Meadow is ready",
- "Text": "Hello,\nYour request for {{fileType}} download of {{fileSetLabel}} (file set id: {{fileSetId}}) has been fulfilled. Your download will be available for 24 hours.\n\nThe {{fileType}} file can be downloaded from {{downloadLink}}\n",
- "Html": "\n\n
\n \n NUL Meadow Download\n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n | \n \n \n | \n \n \n \n | \n
\n \n \n \n \n \n \n \n Hello,\n \n \n Your request for {{fileType}} download of {{fileSetLabel}} (file set id: {{fileSetId}}) has been\n fulfilled. Click below to download your file:\n \n \n \n \n \n \n \n \n (Your download will be available for 24 hours)\n \n | \n \n \n \n | \n
\n \n \n \n \n | \n
\n \n
\n \n \n\n"
- }
-}
\ No newline at end of file
diff --git a/lambdas/assets/email.html b/lambdas/assets/email.html
deleted file mode 100644
index daa58502..00000000
--- a/lambdas/assets/email.html
+++ /dev/null
@@ -1,184 +0,0 @@
-
-
-
-
- NUL Meadow AV Download
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
- |
-
-
-
- |
-
-
-
-
-
-
-
-
- Hello,
-
-
- Your request for {{fileType}} download of {{fileSetLabel}} (file set id: {{fileSetId}}) has been
- fulfilled. Click below to download your file:
-
-
-
-
-
-
-
-
- (Your download will be available for 24 hours)
-
- |
-
-
-
- |
-
-
-
-
-
- |
-
-
-
-
-
-
diff --git a/lambdas/assets/email.txt b/lambdas/assets/email.txt
deleted file mode 100644
index fbad8b63..00000000
--- a/lambdas/assets/email.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-Hello,
-
-Your request for {{fileType}} download of {{fileSetLabel}} (file set id: {{fileSetId}}) has been fulfilled. Your download will be available for 24 hours.
-
-The zip file can be downloaded from {{downloadLink}}
diff --git a/src/handlers/get-file-set-download.js b/src/handlers/get-file-set-download.js
index 0db0bac8..5761fc14 100644
--- a/src/handlers/get-file-set-download.js
+++ b/src/handlers/get-file-set-download.js
@@ -72,8 +72,8 @@ function processDownload(doc, email) {
const fileSetLabel = fileSet.label
const workId = fileSet.work_id
const fileType = fileSet.mime_type.split("/")[0]
- const destinationKey = `downloads/${fileSetId}.mp4`; //TODO - here?
- const destinationLocation = `s3://${destinationBucket}/downloads/${fileSetId}`; // TODO - here?
+ const destinationKey = `av-downloads/${fileSetId}.mp4`; //TODO - here?
+ const destinationLocation = `s3://${destinationBucket}/av-downloads/${fileSetId}`; // TODO - here?
const settings = transcodeSettings(sourceLocation, destinationLocation);
var params = {
@@ -123,7 +123,7 @@ function processDownload(doc, email) {
statusCode: 200,
headers: { "content-type": "text/plain" },
body: JSON.stringify({
- message: `Creating download for file set (id: ${fileSet.id}. Check your email for a link.`,
+ message: `Creating download for file set (id: ${fileSet.id}). Check your email for a link.`,
}),
};
}
diff --git a/template.yaml b/template.yaml
index fda27603..7060a368 100644
--- a/template.yaml
+++ b/template.yaml
@@ -32,9 +32,6 @@ Parameters:
ApiTokenSecret:
Type: String
Description: Secret Key for Encrypting JWTs (must match IIIF server)
- AvDownloadStateMachineArn:
- Type: String
- Description: Arn for AV Download state machine
CustomDomainCertificateArn:
Type: String
Description: SSL Certificate for the Custom Domain Name
@@ -308,6 +305,12 @@ Resources:
Action:
- es:ESHttp*
Resource: "*"
+ - Sid: ExecuteAVDownloadStepFunction
+ Effect: Allow
+ Action:
+ - states:StartExecution
+ Resource:
+ - !Ref avDownloadStateMachine
Events:
ApiGet:
Type: HttpApi
@@ -600,7 +603,7 @@ Resources:
Type: AWS::Serverless::StateMachine
Properties:
DefinitionUri: ./state_machines/av_download.json
- Name: "AV Download State Machine"
+ Name: !Sub "${AWS::StackName}-av-download-state-machine"
Policies:
Version: 2012-10-17
Statement:
@@ -609,10 +612,10 @@ Resources:
Action:
- lambda:InvokeFunction
Resource:
- - !Ref startTranscodeFunction
- - !Ref transcodeStatusFunction
- - !Ref getDownloadLinkFunction
- - !Ref sendTemplatedEmailFunction
+ - !GetAtt startTranscodeFunction.Arn
+ - !GetAtt transcodeStatusFunction.Arn
+ - !GetAtt getDownloadLinkFunction.Arn
+ - !GetAtt sendTemplatedEmailFunction.Arn
avDownloadEmailTemplate:
Type: AWS::SES::Template
Properties: