Destroy Environment

Clean-up! Clean-up! Everybody do their share.

Cleaning up

You successfully created some infrastructure, but now you want to clean up. Hopefully because it was part of a CI/CD pipeline and the test completed.

This does exactly what it sounds like - it completely tears down all of the infrastructure in the specified environment. Use it carefully - just like rm -rf * in Linux/Unix.

job

POST https://portal.tuono.io/api/v1/job

Destroy an environment in your cloud provider.

Headers

Name
Type
Description

Authorization

string

Bearer {YOUR TOKEN}

Content-Type

string

application/json

Request Body

Name
Type
Description

environment_id

string

Id of the environment you want to destroy

action

string

destroy

{'object': {'_id': '5f774cb56bdc0466b3afdb70',
            '_inserted': '2020-10-02 15:52:21',
            '_updated': '2020-10-02 15:52:21',
            'action': 'destroy',
            'blueprint_ids': [],
            'cred_type': 'static',
            'credential_set': 'mh-static-aws',
            'credential_set_id': '5f7612549e2aa1e6a254c4ae',
            'environment_id': '5f76120d92160c05fa55ac04',
            'executed_by': '5f7611299e2aa1e6a254c4a8',
            'execution_feedback': [],
            'failure_insights': [],
            'organization_id': '5f76112956599f23a120fdcc',
            'previous_working_set': {},
            'simulation_feedback': [],
            'status': 'starting',
            'sts_credentials': None,
            'support': [],
            'venue': 'aws',
            'working_set': {}
            }
}

Example code

import json
import requests

token = "Your JWT token"
env_id = "Environment ID"
headers = {"Authorization": f"Bearer {token}", "Content-Type": "application/json"}
url = f"https://portal.tuono.io/api/v1/job"
data = dict(action="destroy", environment_id=env_id)
response = requests.post(url, data=json.dumps(data), headers=headers)
job = response.json()["object"]

Last updated

Was this helpful?