-
Notifications
You must be signed in to change notification settings - Fork 12
/
template-local.yaml
89 lines (86 loc) · 2.66 KB
/
template-local.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
81
82
83
84
85
86
87
88
89
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
Nearspark
Globals:
Function:
Timeout: 15
Resources:
ThumbnailApi:
Type: AWS::Serverless::Api
Properties:
StageName: prod
DefinitionBody:
swagger: 2.0
paths:
"/thumbnail/{url}":
get:
consumes:
- "application/json"
parameters:
- name: url
in: path
required: true
type: string
- name: width
in: query
required: true
type: number
- name: height
in: query
required: true
type: number
- name: fit
in: query
required: false
type: string
- name: position
in: query
required: false
type: string
- name: gravity
in: query
required: false
type: string
- name: strategy
in: query
required: false
type: string
- name: background
in: query
required: false
type: string
- name: withoutEnlargement
in: query
required: false
type: boolean
x-amazon-apigateway-integration:
httpMethod: POST
type: aws_proxy
uri:
Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ThumbnailFunction.Arn}/invocations
requestTemplates:
"application/json": "{\"url\": \"$input.params('url')\"}"
ThumbnailFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: .
Handler: index.thumbnail
Runtime: nodejs10.x
Events:
Thumbnail:
Type: Api
Properties:
Path: /thumbnail
Method: get
ContentHandling: CONVERT_TO_BINARY
Outputs:
ThumbnailApi:
Description: "API Gateway endpoint URL for Prod stage for Thumbnail function"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/prod/thumbnail/"
ThumbnailFunction:
Description: "Thumbnail Lambda Function ARN"
Value: !GetAtt ThumbnailFunction.Arn
ThumbnailFunctionIamRole:
Description: "Implicit IAM Role created for Thumbnail function"
Value: !GetAtt ThumbnailFunctionRole.Arn