Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 984 Bytes

README.md

File metadata and controls

33 lines (23 loc) · 984 Bytes

The code here requires:

Sample usage:

  • Clone the repository where you want to run the commands
  • Navigate to digitalocean_helper directory
import os
import only_file

API_TOKEN = os.environ["DO_API_TOKEN"]

manager = only_file.get_digitalocean_manager(api_token=API_TOKEN)

# list all active droplets
all_droplets = only_file.list_active_droplets(manager)

# get a droplet instance
droplet = all_droplets[0]

# Check if a droplet is shutdown
only_file.is_droplet_shutdown(droplet)

# Turn off a droplet
only_file.shutdown_droplet(droplet)

# Destroy all turned off droplets
only_file.destroy_turnedoff_droplets(manager)