forked from ucldc/rikolti
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
81 lines (79 loc) · 2.74 KB
/
template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
SAM Template for Rikolti metadata_fetcher and metadata_mapper
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 900
Parameters:
NuxeoApiToken:
Description: Token for Nuxeo API
Type: String
Default: '{{resolve:secretsmanager:rikolti/nuxeo_auth:SecretString:token}}'
Resources:
MetadataFetcherFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
FunctionName: fetch_metadata
CodeUri: metadata_fetcher/
Handler: lambda_function.fetch_collection
Runtime: python3.9
Architectures:
- x86_64
Environment:
Variables:
NUXEO: !Ref NuxeoApiToken
S3_BUCKET: rikolti
Role: !GetAtt MetadataFetcherFunctionRole.Arn
MetadataMapperShepherdFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
FunctionName: shepherd_mappers
CodeUri: metadata_mapper/
Handler: lambda_shepherd.map_collection
Runtime: python3.9
Architectures:
- x86_64
Environment:
Variables:
SKIP_UNDEFINED_ENRICHMENTS: True
MetadataMapperMapPageFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
FunctionName: map_metadata
CodeUri: metadata_mapper/
Handler: lambda_function.map_page
Runtime: python3.9
Architectures:
- x86_64
Environment:
Variables:
SKIP_UNDEFINED_ENRICHMENTS: True
MetadataFetcherFunctionRole:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- 'sts:AssumeRole'
Policies:
- PolicyName: sam-metadata-fetcher-policy
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action: [
's3:PutObject',
's3:GetObject',
'lambda:InvokeFunction',
'logs:*',
's3:ListBucket',
's3:PutObjectAcl'
]
Resource: '*'