-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Attach connectors to source (#2772)
Co-authored-by: Sam Liu <xinhol@amazon.com> Co-authored-by: aws-sam-cli-bot <46753707+aws-sam-cli-bot@users.noreply.github.com> Co-authored-by: _sam <3804518+aahung@users.noreply.github.com>
- Loading branch information
1 parent
b4f9ea1
commit 96691c1
Showing
56 changed files
with
9,311 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
integration/resources/expected/combination/embedded_connector.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[ | ||
{ | ||
"LogicalResourceId": "MyRole1", | ||
"ResourceType": "AWS::IAM::Role" | ||
}, | ||
{ | ||
"LogicalResourceId": "MyRole2", | ||
"ResourceType": "AWS::IAM::Role" | ||
}, | ||
{ | ||
"LogicalResourceId": "TriggerFunction", | ||
"ResourceType": "AWS::Lambda::Function" | ||
}, | ||
{ | ||
"LogicalResourceId": "MyFunction2", | ||
"ResourceType": "AWS::Lambda::Function" | ||
}, | ||
{ | ||
"LogicalResourceId": "TriggerFunctionMyConnectorPolicy", | ||
"ResourceType": "AWS::IAM::ManagedPolicy" | ||
} | ||
] |
72 changes: 72 additions & 0 deletions
72
integration/resources/templates/combination/embedded_connector.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
Resources: | ||
MyRole1: | ||
Type: AWS::IAM::Role | ||
Properties: | ||
AssumeRolePolicyDocument: | ||
Statement: | ||
- Effect: Allow | ||
Action: sts:AssumeRole | ||
Principal: | ||
Service: lambda.amazonaws.com | ||
ManagedPolicyArns: | ||
- !Sub arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole | ||
|
||
MyRole2: | ||
Type: AWS::IAM::Role | ||
Properties: | ||
AssumeRolePolicyDocument: | ||
Statement: | ||
- Effect: Allow | ||
Action: sts:AssumeRole | ||
Principal: | ||
Service: lambda.amazonaws.com | ||
ManagedPolicyArns: | ||
- !Sub arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole | ||
|
||
TriggerFunction: | ||
Type: AWS::Lambda::Function | ||
Connectors: | ||
MyConnector: | ||
Properties: | ||
Destination: | ||
Id: MyFunction2 | ||
Permissions: | ||
- Write | ||
Properties: | ||
Role: !GetAtt MyRole1.Arn | ||
Runtime: nodejs14.x | ||
Handler: index.handler | ||
Code: | ||
ZipFile: | | ||
const AWS = require('aws-sdk'); | ||
exports.handler = async (event) => { | ||
const params = { | ||
FunctionName: process.env.FUNCTION_NAME, | ||
InvocationType: 'RequestResponse', | ||
Payload: '{}', | ||
}; | ||
const lambda = new AWS.Lambda(); | ||
const response = await lambda.invoke(params).promise(); | ||
if(response.StatusCode !== 200){ | ||
throw new Error('Failed to get response from lambda function') | ||
} | ||
return response; | ||
}; | ||
Environment: | ||
Variables: | ||
FUNCTION_NAME: !Ref MyFunction2 | ||
|
||
MyFunction2: | ||
Type: AWS::Lambda::Function | ||
Properties: | ||
Role: !GetAtt MyRole2.Arn | ||
Runtime: nodejs14.x | ||
Handler: index.handler | ||
Code: | ||
ZipFile: | | ||
const AWS = require('aws-sdk'); | ||
exports.handler = async (event) => { | ||
console.log(JSON.stringify(event)); | ||
}; | ||
Metadata: | ||
SamTransformTest: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.