-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add HttpApi Event as new event type for AWS::Serverless::StateMachine #1925
Conversation
symmetrie: also added action parameter to swagger routine _construct_full_role in addition to _construct_role
Discussion about role naming/scope:NameIt used to be:
I changed role naming to:
If one StateMachine has more than one events to an API the same role will be reused (it will be generated multiple times, so it is exported only once), instead of a new one for every event. Still with this naming a new Role will be created per API. So I propose a improvement: I think it would even be better Then only one role would be created. This role can then also be (re)used for other event sources than API. ScopeI created a role that allows for all three actions for the StateMachine even if only one is used. Is that OK? |
Discussion about new "Action" property on EventSource:So I added an "Action" property to the event source. There are three possible values:
DecisionIN SCOPE Questions
|
Discussion extra parametersName - for ExecutionName in start & startSync (Name actually does not work for startSync, but console shows it also...) To support these parameter I added: Parameters optional property that is a dict (no checks are performed, but the Parameters are passed requestParameters in the integration) Example: Resources:
MyStateMachine:
Type: AWS::Serverless::StateMachine
Properties:
Type: EXPRESS
DefinitionUri: ${statemachineurl}
Events:
NormalPost:
Type: HttpApi
Properties:
Path: /normal
Method: post
Parameters:
Name: $request.body.Name
Input: $request.body.Input
SyncPost:
Type: HttpApi
Properties:
Path: /sync
Method: post
Action: startSync
Parameters:
Name: $request.body.Name
Input: $request.body.Input
TraceHeader: $request.header.x-trace DecisionIN SCOPE Questions
|
Discussion HttpApi -> (any) StateMachine (cross region)By default the API integration will assume the specified ARN is in the same region as the API is, but the integrations support calling a StateMachine in a different region. If you specify the Region parameter (which cannot be specified from the request.header/body/path) the API will look for the specified ARN in the Region specified. This means the region in the ARN should match the Region specified otherwise I think the way to support this with SAM is as follows: Resources:
MyStateMachine:
Type: AWS::Serverless::StateMachineReference
Properties:
Name: MyStateMachine
Region: us-east-1
Account: 123454567 # is cross account supported??
Events:
SyncPost:
Type: HttpApi
Properties:
Path: /sync
Method: post
Action: startSync # static checking if resource is EXPRESS?? The integration would then use the StateMachine ARN it can contruct from the StateMachineReference properties and also specify the Region in the integration so the integration looks in the correct region for the StateMachine. To be able to point request to different StateMachines: Resources:
MyStateMachine:
Type: AWS::Serverless::StateMachineReference
Properties:
Events:
SyncPost:
Type: HttpApi
Properties:
Path: /sync
Method: post
StateMachine: $request.header.machine
Action: startSync # static checking if resource is EXPRESS?? Here MyStateMachine is not one particular StateMachine (no name/region/account). It will just create a integration on the API without a reference to a specific StateMachine. The Role created my reflect this. To test this out I want to change the integration tests in the SAM project to support specifying the region in which to deploy. DecisionOUT OF SCOPE Since |
Error added for Action startSync with a STANDARD StateMachine
- moved to open api changed one ValueError to InvalidDocumentException
Codecov Report
@@ Coverage Diff @@
## develop #1925 +/- ##
===========================================
- Coverage 93.85% 93.72% -0.13%
===========================================
Files 89 89
Lines 5887 5993 +106
Branches 1205 1230 +25
===========================================
+ Hits 5525 5617 +92
- Misses 166 174 +8
- Partials 196 202 +6
Continue to review full report at Codecov.
|
Closing this due to inactivity. To reopen this please create an issue first to get it prioritized with the SAM team. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1925 +/- ##
===========================================
+ Coverage 93.85% 94.08% +0.23%
===========================================
Files 89 89
Lines 5887 6019 +132
Branches 1205 1228 +23
===========================================
+ Hits 5525 5663 +138
+ Misses 166 164 -2
+ Partials 196 192 -4 ☔ View full report in Codecov by Sentry. |
Issue #1851
Description of changes:
eventsources/push.py
andstepfunctions/events.py
Description of how you validated changes:
Checklist:
make pr
passesExamples?
See integration test that was added
TODO
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.