File: v1_reservedip.py

package info (click to toggle)
python-vultr 1.0.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 184 kB
  • sloc: python: 1,004; makefile: 5
file content (22 lines) | stat: -rw-r--r-- 743 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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')