Skip to content

Commit

Permalink
Dev (#2)
Browse files Browse the repository at this point in the history
* Adding IPv4
* Fix on README.md
* Bump Version
  • Loading branch information
smashedr authored Jan 18, 2022
1 parent 461a959 commit e7ca2c9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ data = {
'region': available[0]['id'],
'plan': plan['id'],
'os_id': ubuntu_lts['id'],
'sshkey_id': sshkey['id'],
'sshkey_id': [sshkey['id']],
'hostname': hostname,
'label': hostname,
}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='vultr-python',
version='0.1.4',
version='0.1.5',
description='Python 3 wrapper for the Vultr API v2.0',
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
15 changes: 15 additions & 0 deletions vultr.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,21 @@ def delete_script(self, script: Union[str, dict]):
url = f'{self.url}/startup-scripts/{script_id}'
return self._delete(url)

def list_ipv4(self, instance: Union[str, dict]):
instance_id = self._get_obj_key(instance)
url = f'{self.url}/instances/{instance_id}/ipv4'
return self._get(url)['ipv4s']

def create_ipv4(self, instance: Union[str, dict], **kwargs):
instance_id = self._get_obj_key(instance)
url = f'{self.url}/instances/{instance_id}/ipv4'
return self._post(url, kwargs)['ipv4']

def delete_ipv4(self, instance: Union[str, dict]):
instance_id = self._get_obj_key(instance)
url = f'{self.url}/instances/{instance_id}/ipv4'
return self._delete(url)

@staticmethod
def filter_keys(keys: list, name: str) -> dict:
try:
Expand Down

0 comments on commit e7ca2c9

Please sign in to comment.