Example #1
0
 def rename(self, name):
     """This method renames the droplet to the specified name."""
     url = self.api_url + "/rename"
     params = {'name': name}
     params.update(self._client_params)
     response = get(url, params=params)
     return handle_resource_action(response)
Example #2
0
    def destroy(self):
        """This method destroys one of your droplets - this is irreversible.
        :returns: The Event id of the 'destroy'-event.

        """
        url = self.api_url + "/destroy"
        response = get(url, params=self._client_params)
        return handle_resource_action(response)
Example #3
0
 def rebuild(self, image):
     """This method allows you to reinstall a droplet with a default image. This is useful if you want to start again
     but retain the same IP address for your droplet."""
     url = self.api_url + "/rebuild"
     params = {'image_id': image.id}
     params.update(self._client_params)
     response = get(url, params=params)
     return handle_resource_action(response)
Example #4
0
 def snapshot(self, name):
     """This method allows you to take a snapshot of the droplet once it has been powered off, which can later be
     restored or used to create a new droplet from the same image. Please be aware this may cause a reboot."""
     url = self.api_url + "/snapshot"
     params = {'name': name}
     params.update(self._client_params)
     response = get(url, params=params)
     return handle_resource_action(response)
Example #5
0
 def restore(self, image):
     """This method allows you to restore a droplet with a previous image or snapshot. This will be a mirror copy of
     the image or snapshot to your droplet. Be sure you have backed up any necessary information prior to restore."""
     url = self.api_url + "/restore"
     params = {'image_id': image.id}
     params.update(self._client_params)
     response = get(url, params=params)
     return handle_resource_action(response)
Example #6
0
 def resize(self, size):
     """This method allows you to resize a specific droplet to a different size. This will affect the number of
     processors and memory allocated to the droplet."""
     url = self.api_url + "/resize"
     params = {'size_id': size.id}
     params.update(self._client_params)
     response = get(url, params=params)
     return handle_resource_action(response)
Example #7
0
 def password_reset(self):
     """This method will reset the root password for a droplet. Please be aware that this will reboot the droplet to
     allow resetting the password."""
     url = self.api_url + "/password_reset"
     response = get(url, params=self._client_params)
     return handle_resource_action(response)
Example #8
0
 def power_on(self):
     """This method allows you to poweron a powered off droplet."""
     url = self.api_url + "/power_on"
     response = get(url, params=self._client_params)
     return handle_resource_action(response)
Example #9
0
 def power_off(self):
     """This method allows you to poweroff a running droplet. The droplet will remain in your account."""
     url = self.api_url + "/power_off"
     response = get(url, params=self._client_params)
     return handle_resource_action(response)
Example #10
0
 def shutdown(self):
     """This method allows you to shutdown a running droplet. The droplet will remain in your account."""
     url = self.api_url + "/shutdown"
     response = get(url, params=self._client_params)
     return handle_resource_action(response)
Example #11
0
 def power_cycle(self):
     """This method allows you to power cycle a droplet. This will turn off the droplet and then turn it back on."""
     url = self.api_url + "/power_cycle"
     response = get(url, params=self._client_params)
     return handle_resource_action(response)
Example #12
0
 def reboot(self):
     """This method allows you to reboot a droplet. This is the preferred method to use if a server is not
     responding."""
     url = self.api_url + "/reboot"
     response = get(url, params=self._client_params)
     return handle_resource_action(response)