The last PR started work that this PR finishes. We added an AWS Lambda function to the step function DAG that validates that the input is correct.
{
"command": "deploy"
}
and
{
"command": "destroy",
"destroy_at_utc_time": "some ISO formatted UTC timestamp in the future"
}
are both considered valid inputs. Everything else is invalid. Eventually, we'll probably want to not require that destroy_at_utc_time would be set, and instead the server would delete right away, rather than in the future. That would be important for instantly stopping the server.
Here's the new state machine.
The lambda function handler has some test cases inside. We didn't use a python testing framework for these. I skipped that because I didn't want the overhead of putting the tests in another file and rigging up the PYTHONPATH to make it so those tests could import from the handler. Instead, the test cases are part of the if __name__ == "__main__" block in index.py.
Next up:
We'll add a Wait task to the state machine so that the "destroy" command waits until the given timestamp to actually destroy the server.
The last PR started work that this PR finishes. We added an AWS Lambda function to the step function DAG that validates that the input is correct.
and
are both considered valid inputs. Everything else is invalid. Eventually, we'll probably want to not require that
destroy_at_utc_time
would be set, and instead the server would delete right away, rather than in the future. That would be important for instantly stopping the server.Here's the new state machine.
The lambda function handler has some test cases inside. We didn't use a python testing framework for these. I skipped that because I didn't want the overhead of putting the tests in another file and rigging up the PYTHONPATH to make it so those tests could import from the handler. Instead, the test cases are part of the
if __name__ == "__main__"
block inindex.py
.Next up:
We'll add a
Wait
task to the state machine so that the "destroy" command waits until the given timestamp to actually destroy the server.