Skip to content

Commit

Permalink
Merge pull request #41 from structrs/master
Browse files Browse the repository at this point in the history
Add (partial) reservedip to endpoints
  • Loading branch information
dopry authored Jun 4, 2018
2 parents 9f9db62 + 9b7d1a5 commit 84da9d1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions vultr/v1_reservedip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'''Partial class to handle Vultr ReservedIP API calls'''
from .utils import VultrBase, update_params


class VultrReservedIP(VultrBase):
'''Handles Vultr ReservedIP API calls'''
def __init__(self, api_key):
VultrBase.__init__(self, api_key)

def create(self, dcid, ip_type, params=None):
''' /v1/reservedip/create
POST - account
Create a new reserved IP. Reserved IPs can only be used within the
same datacenter for which they were created.
Link: https://www.vultr.com/api/#reservedip_create
'''
params = update_params(params, {
'DCID': dcid,
'ip_type': ip_type
})
return self.request('/v1/reservedip/create', params, 'POST')
2 changes: 2 additions & 0 deletions vultr/vultr.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from .v1_os import VultrOS
from .v1_plans import VultrPlans
from .v1_regions import VultrRegions
from .v1_reservedip import VultrReservedIP
from .v1_server import VultrServer
from .v1_snapshot import VultrSnapshot
from .v1_sshkey import VultrSSHKey
Expand All @@ -33,6 +34,7 @@ def __init__(self, api_key):
self.os = VultrOS(api_key)
self.plans = VultrPlans(api_key)
self.regions = VultrRegions(api_key)
self.reservedip = VultrReservedIP(api_key)
self.server = VultrServer(api_key)
self.snapshot = VultrSnapshot(api_key)
self.sshkey = VultrSSHKey(api_key)
Expand Down

0 comments on commit 84da9d1

Please sign in to comment.