-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathtemplate.local.yml
More file actions
214 lines (214 loc) · 6.17 KB
/
Copy pathtemplate.local.yml
File metadata and controls
214 lines (214 loc) · 6.17 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
Transform: "AWS::Serverless-2016-10-31"
Metadata:
AWS::ServerlessRepo::Application:
Name: serverless-iiif
Description: IIIF Image API 2.1 and 3.0 Service Lambda Function
Author: Samvera
SpdxLicenseId: Apache-2.0
LicenseUrl: ./LICENSE.txt
ReadmeUrl: ./README.md
Labels: [ "iiif", "image-processing" ]
HomePageUrl: https://samvera.github.io/serverless-iiif
SemanticVersion: 6.0.4
SourceCodeUrl: https://github.com/samvera/serverless-iiif
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: "General Configuration"
Parameters:
- SourceBucket
- IiifLambdaMemory
- IiifLambdaTimeout
- PixelDensity
- PyramidLimit
- ResolverTemplate
- Label:
default: "CORS Configuration"
Parameters:
- CorsAllowCredentials
- CorsAllowHeaders
- CorsAllowOrigin
- CorsExposeHeaders
- CorsMaxAge
- Label:
default: "Advanced Options"
Parameters:
- ForceHost
- Preflight
Parameters:
CorsAllowCredentials:
Type: String
Description: >
Value of the CORS `Access-Control-Allow-Credentials` response header. Must
be `true` to allow requests with `Authorization` and/or `Cookie` headers.
AllowedValues:
- false
- true
Default: false
CorsAllowHeaders:
Type: String
Description: Value of the CORS `Access-Control-Allow-Headers` response header
Default: "*"
CorsAllowOrigin:
Type: String
Description: >
Value of the CORS `Access-Control-Allow-Origin` response header. Use the
special value `REFLECT_ORIGIN` to copy the value from the `Origin` request
header (required to emulate `*` for XHR requests using `Authorization`
and/or `Cookie` headers).
Default: "*"
CorsExposeHeaders:
Type: String
Description: Value of the CORS `Access-Control-Expose-Headers` response header
Default: cache-control,content-language,content-length,content-type,date,expires,last-modified,pragma
CorsMaxAge:
Type: Number
Description: Value of the CORS `Access-Control-MaxAge` response header
Default: 3600
ForceHost:
Type: String
Description: Forced hostname to use in responses
Default: ""
IiifLambdaMemory:
Type: Number
Description: The memory provisioned for the lambda.
MinValue: 128
MaxValue: 10240
Default: 3008
IiifLambdaTimeout:
Type: Number
Description: The timeout for the lambda.
Default: 10
PixelDensity:
Type: Number
Description: Hardcoded DPI/Pixel Density/Resolution to encode in output images
Default: 0
MinValue: 0
Preflight:
Type: String
Description: Indicates whether the function should expect preflight headers
AllowedValues:
- false
- true
Default: false
PyramidLimit:
Type: Number
Description: Smallest pyramid image dimension. Set to `0` to prevent server from
auto-calculating pyramid page sizes.
MinValue: 0
Default: 256
ResolverTemplate:
Type: String
Description: A printf-style format string that determines the location of source
image within the bucket given the image ID
Default: "%s.tif"
SourceBucket:
Type: String
Description: Name of bucket containing source images
Conditions:
UseForceHost:
Fn::Not:
- Fn::Equals: [ !Ref ForceHost, "" ]
UsePixelDensity:
Fn::Not:
- Fn::Equals: [ !Ref PixelDensity, 0 ]
UsePyramidLimit:
Fn::Not:
- Fn::Equals: [ !Ref PyramidLimit, 0 ]
Resources:
IiifFunction:
Type: "AWS::Serverless::Function"
Properties:
Runtime: nodejs24.x
Handler: dist/index.handler
MemorySize:
Ref: IiifLambdaMemory
Timeout:
Ref: IiifLambdaTimeout
CodeUri: .
Policies:
- AWSLambdaExecute
- Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- s3:ListAllMyBuckets
Resource: "*"
- Effect: Allow
Action:
- s3:GetObject
- s3:GetObjectACL
Resource:
Fn::Sub: "arn:aws:s3:::${SourceBucket}/*"
- Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- s3:ListBucket
- s3:GetBucketLocation
Resource:
Fn::Sub: "arn:aws:s3:::${SourceBucket}"
Environment:
Variables:
DEBUG: ""
STREAMIFY_DISABLED: "true"
corsAllowCredentials: !Ref CorsAllowCredentials
corsAllowOrigin: !Ref CorsAllowOrigin
corsAllowHeaders: !Ref CorsAllowHeaders
corsExposeHeaders: !Ref CorsExposeHeaders
corsMaxAge: !Ref CorsMaxAge
density:
Fn::If:
- UsePixelDensity
- !Ref PixelDensity
- !Ref AWS::NoValue
forceHost:
Fn::If:
- UseForceHost
- !Ref ForceHost
- !Ref AWS::NoValue
preflight: !Ref Preflight
pyramidLimit:
Fn::If:
- UsePyramidLimit
- !Ref PyramidLimit
- !Ref AWS::NoValue
resolverTemplate: !Ref ResolverTemplate
sourceBucket: !Ref SourceBucket
Events:
HttpGet:
Type: HttpApi
Properties:
Path: /{proxy+}
Method: GET
Metadata:
BuildMethod: esbuild
BuildProperties:
EntryPoints:
- index.ts
Minify: false
SourceMap: false
Target: es2022
External:
- sharp
Outputs:
EndpointV2:
Description: IIIF Image API v2 Endpoint
Value:
Fn::Sub: "${IiifFunctionUrl.FunctionUrl}iiif/2"
EndpointV3:
Description: IIIF Image API v3 Endpoint
Value:
Fn::Sub: "${IiifFunctionUrl.FunctionUrl}iiif/3"
FunctionDomain:
Description: IIIF Function Domain Name
Value:
Fn::Select:
- 2
- Fn::Split:
- "/"
- Fn::GetAtt: IiifFunctionUrl.FunctionUrl
FunctionUrl:
Description: IIIF Function URL
Value:
Fn::GetAtt: IiifFunctionUrl.FunctionUrl