add admin API endpoints to set specfic scenario states #1721
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
description
This PR adds two admin endpoints:
get the current state of a scenario:
GET
__admin/scenario/state?stateName=scenario-name
set the current state of a scenario
POST
__admin/scenario/state
Body:
further notes
This allows setting a scenario to any state without knowing the current state.
The workaround discussed in PR #1079 and issue #847 only allows resetting the scenario if you know the current state.
Also, I do not think that it is the ideal usage to create additional "control mappings" to achieve
__admin
functionality, therefore here is an alternative proposal.In contrast to PR #1079 this PR not just allows resetting a scenario, you can also switch to an intermediate or final state of a scenario.
Would also enable PR:
#1079
and also fix issue
#847
(when setting scenario state in POST-Request to "Started")
Discussion
If this PR is correct according to the Contribution Rules, please let me know, so I can fix it.
If the API changes are not desirable (e.g. a path parameter would be nicer for the "state-name" in the GET request), please let me know.