Skip to content

Commit

Permalink
Try to deploy the AV Download function
Browse files Browse the repository at this point in the history
  • Loading branch information
mbklein committed Oct 11, 2023
1 parent 8b33559 commit e75ffdf
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 208 deletions.
8 changes: 0 additions & 8 deletions lambdas/assets/av-download-template.txt

This file was deleted.

184 changes: 0 additions & 184 deletions lambdas/assets/email.html

This file was deleted.

5 changes: 0 additions & 5 deletions lambdas/assets/email.txt

This file was deleted.

6 changes: 3 additions & 3 deletions src/handlers/get-file-set-download.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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.`,
}),
};
}
Expand Down
19 changes: 11 additions & 8 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -308,6 +305,12 @@ Resources:
Action:
- es:ESHttp*
Resource: "*"
- Sid: ExecuteAVDownloadStepFunction
Effect: Allow
Action:
- states:StartExecution
Resource:
- !Ref avDownloadStateMachine
Events:
ApiGet:
Type: HttpApi
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit e75ffdf

Please sign in to comment.