forked from aws/serverless-application-model
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding InputTransformer Property (aws#3338)
- Loading branch information
Connor Robertson
authored
Sep 5, 2023
1 parent
0900f2b
commit 00b8a37
Showing
8 changed files
with
579 additions
and
0 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
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
45 changes: 45 additions & 0 deletions
45
tests/translator/input/serverless_statemachine_eventbridgerule_with_input_transformer.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,45 @@ | ||
Resources: | ||
StateMachine: | ||
Type: AWS::Serverless::StateMachine | ||
Properties: | ||
Name: !Sub ${AWS::StackName}-StateMachine | ||
Definition: | ||
Comment: A Hello World example of the Amazon States Language using Pass states | ||
StartAt: Hello | ||
States: | ||
Hello: | ||
Type: Pass | ||
Result: Hello | ||
Next: World | ||
World: | ||
Type: Pass | ||
Result: World | ||
End: true | ||
Policies: | ||
- Version: '2012-10-17' | ||
Statement: | ||
- Effect: Deny | ||
Action: '*' | ||
Resource: '*' | ||
Events: | ||
EventBridgeEvent: | ||
Type: EventBridgeRule | ||
Properties: | ||
EventBusName: default | ||
Pattern: | ||
source: | ||
- aws.s3 | ||
detail-type: | ||
- Object Created | ||
detail: | ||
bucket: | ||
name: | ||
- abc | ||
object: | ||
key: | ||
- xyz | ||
InputTransformer: | ||
InputPathsMap: | ||
bucket: $.detail.bucket.name | ||
key: $.detail.object.key | ||
InputTemplate: '{"bucket": <bucket>, "key": <key>}' |
174 changes: 174 additions & 0 deletions
174
...nslator/output/aws-cn/serverless_statemachine_eventbridgerule_with_input_transformer.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,174 @@ | ||
{ | ||
"Resources": { | ||
"StateMachine": { | ||
"Properties": { | ||
"DefinitionString": { | ||
"Fn::Join": [ | ||
"\n", | ||
[ | ||
"{", | ||
" \"Comment\": \"A Hello World example of the Amazon States Language using Pass states\",", | ||
" \"StartAt\": \"Hello\",", | ||
" \"States\": {", | ||
" \"Hello\": {", | ||
" \"Next\": \"World\",", | ||
" \"Result\": \"Hello\",", | ||
" \"Type\": \"Pass\"", | ||
" },", | ||
" \"World\": {", | ||
" \"End\": true,", | ||
" \"Result\": \"World\",", | ||
" \"Type\": \"Pass\"", | ||
" }", | ||
" }", | ||
"}" | ||
] | ||
] | ||
}, | ||
"RoleArn": { | ||
"Fn::GetAtt": [ | ||
"StateMachineRole", | ||
"Arn" | ||
] | ||
}, | ||
"StateMachineName": { | ||
"Fn::Sub": "${AWS::StackName}-StateMachine" | ||
}, | ||
"Tags": [ | ||
{ | ||
"Key": "stateMachine:createdBy", | ||
"Value": "SAM" | ||
} | ||
] | ||
}, | ||
"Type": "AWS::StepFunctions::StateMachine" | ||
}, | ||
"StateMachineEventBridgeEvent": { | ||
"Properties": { | ||
"EventBusName": "default", | ||
"EventPattern": { | ||
"detail": { | ||
"bucket": { | ||
"name": [ | ||
"abc" | ||
] | ||
}, | ||
"object": { | ||
"key": [ | ||
"xyz" | ||
] | ||
} | ||
}, | ||
"detail-type": [ | ||
"Object Created" | ||
], | ||
"source": [ | ||
"aws.s3" | ||
] | ||
}, | ||
"Targets": [ | ||
{ | ||
"Arn": { | ||
"Ref": "StateMachine" | ||
}, | ||
"Id": "StateMachineEventBridgeEventStepFunctionsTarget", | ||
"InputTransformer": { | ||
"InputPathsMap": { | ||
"bucket": "$.detail.bucket.name", | ||
"key": "$.detail.object.key" | ||
}, | ||
"InputTemplate": "{\"bucket\": <bucket>, \"key\": <key>}" | ||
}, | ||
"RoleArn": { | ||
"Fn::GetAtt": [ | ||
"StateMachineEventBridgeEventRole", | ||
"Arn" | ||
] | ||
} | ||
} | ||
] | ||
}, | ||
"Type": "AWS::Events::Rule" | ||
}, | ||
"StateMachineEventBridgeEventRole": { | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": [ | ||
"sts:AssumeRole" | ||
], | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": [ | ||
"events.amazonaws.com" | ||
] | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"Policies": [ | ||
{ | ||
"PolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "states:StartExecution", | ||
"Effect": "Allow", | ||
"Resource": { | ||
"Ref": "StateMachine" | ||
} | ||
} | ||
] | ||
}, | ||
"PolicyName": "StateMachineEventBridgeEventRoleStartExecutionPolicy" | ||
} | ||
] | ||
}, | ||
"Type": "AWS::IAM::Role" | ||
}, | ||
"StateMachineRole": { | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": [ | ||
"sts:AssumeRole" | ||
], | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": [ | ||
"states.amazonaws.com" | ||
] | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"ManagedPolicyArns": [], | ||
"Policies": [ | ||
{ | ||
"PolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "*", | ||
"Effect": "Deny", | ||
"Resource": "*" | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"PolicyName": "StateMachineRolePolicy0" | ||
} | ||
], | ||
"Tags": [ | ||
{ | ||
"Key": "stateMachine:createdBy", | ||
"Value": "SAM" | ||
} | ||
] | ||
}, | ||
"Type": "AWS::IAM::Role" | ||
} | ||
} | ||
} |
Oops, something went wrong.