Skip to content

Commit

Permalink
add some missing api calls and fields
Browse files Browse the repository at this point in the history
(cherry picked from commit 5b26879)
  • Loading branch information
cleverca22 authored and disassembler committed Jun 25, 2019
1 parent 03165b2 commit 99f0514
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packet/Device.py
Expand Up @@ -21,11 +21,16 @@ def __init__(self, data, manager):
self.spot_instance = data.get("spot_instance")
self.spot_price_max = data.get("spot_price_max")
self.ssh_keys = data.get("ssh_keys", [])
# one of: queued provisioning active powering_off powering_on inactive
self.state = data["state"]
self.tags = data["tags"]
self.termination_time = data.get("termination_time")
self.updated_at = data["updated_at"]
self.user = data["user"]
if 'provisioning_percentage' in data:
self.provisioning_percentage = data['provisioning_percentage']
else:
self.provisioning_percentage = None

def update(self):
params = {"hostname": self.hostname, "locked": self.locked, "tags": self.tags}
Expand Down
5 changes: 5 additions & 0 deletions packet/Manager.py
Expand Up @@ -144,6 +144,11 @@ def create_ssh_key(self, label, public_key):
data = self.call_api("ssh-keys", type="POST", params=params)
return SSHKey(data, self)

def create_project_ssh_key(self, project_id, label, public_key):
params = {'key': public_key, 'label': label}
data = self.call_api('projects/%s/ssh-keys' % project_id, type='POST', params=params)
return SSHKey(data, self)

def list_volumes(self, project_id, params={}):
params["include"] = "facility,attachments.device"
data = self.call_api("projects/%s/storage" % project_id, params=params)
Expand Down
1 change: 1 addition & 0 deletions packet/Plan.py
Expand Up @@ -11,6 +11,7 @@ def __init__(self, data):
self.pricing = data["pricing"]
self.specs = data["specs"]
self.description = data["description"]
self.available_in = data["available_in"]

def __str__(self):
return "%s" % (self.slug)
Expand Down

0 comments on commit 99f0514

Please sign in to comment.