Skip to content

Commit

Permalink
Merge pull request #74 from CDLUC3/augmenters-mods
Browse files Browse the repository at this point in the history
Augmenters mods
  • Loading branch information
briri authored Nov 22, 2023
2 parents b9e42b5 + 86b1195 commit ead1784
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
11 changes: 11 additions & 0 deletions seed_dynamo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ aws dynamodb put-item --table-name $DYNAMO_TABLE \
--item \
"{\"PK\":{\"S\":\"PROVENANCE#$KEY\"},\"SK\":{\"S\":\"PROFILE\"},\"contact\":{\"M\":{\"email\":{\"S\":\"$ADMIN_EMAIL\"},\"name\":{\"S\":\"Administrator\"}}},\"description\":{\"S\":\"The $2 $1 system\"},\"downloadUri\":{\"S\":\"https://$3/api/v2/plans/\"},\"homepage\":{\"S\":\"https://$3\"},\"name\":{\"S\":\"$2\"},\"redirectUri\":{\"S\":\"https://$3/callback\"},\"tokenUri\":{\"S\":\"https://$3/oauth/token\"}}"

# Insert the root AUGMENTERS record
echo "Creating Augmenter records -> { \"PK\": \"AUGMENTERS\", \"SK\": \"LIST\" } and { \"PK\": \"AUGMENTERS#datacite\", \"SK\": \"PROFILE\" }"
aws dynamodb put-item --table-name $DYNAMO_TABLE \
--item \
"{\"PK\":{\"S\":\"AUGMENTERS\"},\"SK\":{\"S\":\"LIST\"},\"related_works\":{\"L\":[{\"M\":{\"PK\":{\"S\":\"AUGMENTERS#datacite\"}}}]}}"

# Insert the DataCite Augmenter record
aws dynamodb put-item --table-name $DYNAMO_TABLE \
--item \
"{\"PK\":{\"S\":\"AUGMENTERS#datacite\"},\"SK\":{\"S\":\"PROFILE\"},\"frequency\":{\"S\":\"daily\"},\"last_run\":{\"S\":\"2023-11-01T00:00:34+00:00\"},\"name\":{\"S\":\"DataCite\"},\"trigger\":{\"M\":{\"detail-type\":{\"S\":\"RelatedWorkScan\"},\"resource\":{\"S\":\"event-bridge\"}}}}"

echo ''
echo 'Done.'
echo ''
Expand Down
32 changes: 16 additions & 16 deletions src/sam/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ Resources:
RetryPolicy:
MaximumEventAgeInSeconds: 180
MaximumRetryAttempts: 3
State: 'ENABLED' # 'DISABLED'
State: 'ENABLED'

AugmentationSchedulerPermission:
Type: 'AWS::Lambda::Permission'
Expand All @@ -1352,22 +1352,22 @@ Resources:

# Scheduled events
# See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-scheduleexpression
AugmentationSchedulerDaily:
Type: 'AWS::Events::Rule'
Properties:
# AWS CRON expressions have some nuances: https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-cron-expressions.html
ScheduleExpression: 'cron(0 0 ? * * *)' # Every night at midnight
Targets:
- Id: !Ref AugmentationSchedulerFunction
Arn: !GetAtt AugmentationSchedulerFunction.Arn
# AugmentationSchedulerDaily:
# Type: 'AWS::Events::Rule'
# Properties:
# # AWS CRON expressions have some nuances: https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-cron-expressions.html
# ScheduleExpression: 'cron(0 0 ? * * *)' # Every night at midnight
# Targets:
# - Id: !Ref AugmentationSchedulerFunction
# Arn: !GetAtt AugmentationSchedulerFunction.Arn

AugmentationSchedulerDailyPermission:
Type: 'AWS::Lambda::Permission'
Properties:
FunctionName: !GetAtt AugmentationSchedulerFunction.Arn
Action: 'lambda:InvokeFunction'
Principal: 'events.amazonaws.com'
SourceArn: !GetAtt AugmentationSchedulerDaily.Arn
# AugmentationSchedulerDailyPermission:
# Type: 'AWS::Lambda::Permission'
# Properties:
# FunctionName: !GetAtt AugmentationSchedulerFunction.Arn
# Action: 'lambda:InvokeFunction'
# Principal: 'events.amazonaws.com'
# SourceArn: !GetAtt AugmentationSchedulerDaily.Arn

# Scheduled events to keep some of the API lambdas warm
# See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-scheduleexpression
Expand Down
2 changes: 1 addition & 1 deletion src/swagger/dmp_schema.json

Large diffs are not rendered by default.

0 comments on commit ead1784

Please sign in to comment.