The current system is a containerized app. Tech stack: docker, python, ibm cloud schematics python SDK, ibm cloud core python SDK
High level: Use python to interact with the IBM Cloud schematics API. The code should allow for running destroy, plan, apply, and status check functions
Schematics workspaces can have the following status codes:
- INACTIVE = no resources are provisioned, need to run a workspace plan
- ACTIVE = workspace plan was applied and resources were deployed
- INPROGRESS = workspace is running a destroy, plan or, apply
- SCANNING = only applicable during initial workspace creation or when pulling latest version
- FAILED = workspace destroy, plan, or apply failed
- CANCELLED = workspace destroy, plan, or apply was cancelled by user
Application Flow:
- Check workspace status
- If workspace is INACTIVE call the PLAN FUNCTION. Once PLAN FUNCTION completes, move on to APPLY FUNCTION
- if workspace is ACTIVE, call the workspace destroy function. Once that completes run the PLAN FUNCTION. When that completes move on to APPLY FUNCTION
- When APPLY FUNCTION and status = ACTIVE send a message to a discord server
PLAN FUNCTION: Plan function should include check for workspace status, when plan status = INACTIVE move on to apply function. Status returns outside of INACTIVE / SCANNING / INPROGRESS should be considered an error.
APPLY FUNCTION: Apply function should include check for workspace status, when status = ACTIVE the job is considered complete. While status = INPROGRESS, use sleep and check status in 10 minutes. Status returns outside of ACTIVE / INPROGRESS should be considered an error.