/
connector_with_non_id_source_and_destination.yaml
110 lines (100 loc) · 2.66 KB
/
connector_with_non_id_source_and_destination.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
Transform: AWS::Serverless-2016-10-31
Resources:
MyRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Action: sts:AssumeRole
Principal:
Service: lambda.amazonaws.com
ManagedPolicyArns:
- arn:{AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
SamFunction:
Type: AWS::Serverless::Function
Properties:
Runtime: nodejs18.x
Handler: index.handler
Role: !GetAtt MyRole.Arn
InlineCode: |
const AWS = require('aws-sdk');
exports.handler = async (event) => {
console.log(JSON.stringify(event));
};
SamTable:
Type: AWS::Serverless::SimpleTable
Properties:
PrimaryKey:
Name: NoteId
Type: String
SamStateMachine:
Type: AWS::Serverless::StateMachine
Properties:
# Express state machine support sync execution
# which allows us to get the error message quickly in trigger function.
Type: EXPRESS
Role: !GetAtt MyRole.Arn
Definition:
StartAt: MyLambdaState
States:
MyLambdaState:
Type: Task
Resource: !GetAtt SamFunction.Arn
End: true
SamApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
DefinitionUri: s3://sam-demo-bucket/webpage_swagger.json
Description: my description
SamHttpApi:
Type: AWS::Serverless::HttpApi
Properties:
StageName: Prod
Connector1:
Type: AWS::Serverless::Connector
Properties:
Source:
Type: AWS::Serverless::Function
RoleName: MyRole
Destination:
Type: AWS::Serverless::SimpleTable
Arn: !GetAtt SamTable.Arn
Permissions:
- Read
Connector2:
Type: AWS::Serverless::Connector
Properties:
Source:
Type: AWS::Serverless::Api
ResourceId: !Ref SamApi
Qualifier: Prod/GET/foobar
Destination:
Type: AWS::Serverless::Function
Arn: !GetAtt SamFunction.Arn
Permissions:
- Write
Connector3:
Type: AWS::Serverless::Connector
Properties:
Source:
Type: AWS::Serverless::StateMachine
RoleName: MyRole
Destination:
Type: AWS::Serverless::Function
Arn: !GetAtt SamFunction.Arn
Permissions:
- Write
Connector4:
Type: AWS::Serverless::Connector
Properties:
Source:
Type: AWS::Serverless::HttpApi
ResourceId: !Ref SamHttpApi
Qualifier: Prod/GET/foobar
Destination:
Type: AWS::Serverless::Function
Arn: !GetAtt SamFunction.Arn
Permissions:
- Write