File tree Expand file tree Collapse file tree 3 files changed +11
-33
lines changed
examples/2016-10-31/api_gateway_responses Expand file tree Collapse file tree 3 files changed +11
-33
lines changed Original file line number Diff line number Diff line change 28
28
import boto3
29
29
from docopt import docopt
30
30
31
+ my_path = os .path .dirname (os .path .abspath (__file__ ))
32
+ sys .path .insert (0 , my_path + '/..' )
33
+
31
34
from samtranslator .public .translator import ManagedPolicyLoader
32
35
from samtranslator .translator .transform import transform
33
36
from samtranslator .yaml_helper import yaml_parse
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -3,46 +3,31 @@ Transform: AWS::Serverless-2016-10-31
3
3
Description : Simple webservice deomnstrating gateway responses.
4
4
5
5
Resources :
6
- ExplicitApi :
6
+ MyApi :
7
7
Type : AWS::Serverless::Api
8
8
Properties :
9
- Auth :
10
- Authorizers :
11
- Authorizer :
12
- FunctionArn : !GetAtt AuthorizerFunction.Arn
13
- Identity :
14
- ValidationExpression : " ^Bearer +[-0-9a-zA-Z\\ ._]*$"
15
- ReauthorizeEvery : 300
9
+ StageName : Prod
16
10
GatewayResponses :
17
- UNAUTHORIZED :
11
+ DEFAULT_4xx :
18
12
ResponseParameters :
19
13
Headers :
20
14
Access-Control-Expose-Headers : " 'WWW-Authenticate'"
21
15
Access-Control-Allow-Origin : " '*'"
22
- WWW-Authenticate : >-
23
- 'Bearer realm="admin"'
16
+
24
17
GetFunction :
25
18
Type : AWS::Serverless::Function
26
19
Properties :
27
20
Handler : index.get
28
21
Runtime : nodejs6.10
29
- CodeUri : src/
22
+ InlineCode : module.exports = async () => throw new Error('Check out the response headers!')
30
23
Events :
31
24
GetResource :
32
25
Type : Api
33
26
Properties :
34
- Path : /resource/{resourceId}
27
+ Path : /error
35
28
Method : get
36
- Auth :
37
- Authorizer : Authorizer
38
- RestApiId : !Ref ExplicitApi
39
- AuthorizerFunction :
40
- Type : AWS::Serverless::Function
41
- Properties :
42
- Handler : index.auth
43
- Runtime : nodejs6.10
44
- CodeUri : src/
29
+ RestApiId : !Ref MyApi
45
30
Outputs :
46
31
ApiURL :
47
32
Description : " API endpoint URL for Prod environment"
48
- Value : !Sub "https://${ServerlessRestApi }.execute-api.${AWS::Region}.amazonaws.com/Prod/resource /"
33
+ Value : !Sub "https://${MyApi }.execute-api.${AWS::Region}.amazonaws.com/Prod/error /"
You can’t perform that action at this time.
0 commit comments