HEX
Server: LiteSpeed
System: Linux s787.bom1.mysecurecloudhost.com 4.18.0-477.13.1.lve.el8.x86_64 #1 SMP Thu Jun 1 16:40:47 EDT 2023 x86_64
User: mobilech (5348)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/vultr/__pycache__/v1_server.cpython-310.pyc
o

;j�#�@s@dZddlmZmZddlmZddlmZGdd�de�ZdS)z.Partial class to handle Vultr Server API calls�)�	VultrBase�
update_params)�VultrServerIPv4)�VultrServerIPv6c@s�eZdZdZdd�Zd)dd�Zd)dd�Zd)d	d
�Zd)dd�Zd)d
d�Z	d)dd�Z
d*dd�Zd)dd�Zd)dd�Z
d)dd�Zd)dd�Zd)dd�Zd)dd�Zd)dd �Zd)d!d"�Zd)d#d$�Zd)d%d&�Zd)d'd(�ZdS)+�VultrServerzHandles Vultr Server API callscCs$t�||�t|�|_t|�|_dS�N)r�__init__rZipv4rZipv6)�selfZapi_key�r
�C/opt/saltstack/salt/lib/python3.10/site-packages/vultr/v1_server.pyr	s
zVultrServer.__init__NcC�t|d|i�}|�d|d�S)z� /v1/server/bandwidth
        GET - account
        Get the bandwidth used by a virtual machine

        Link: https://www.vultr.com/api/#server_bandwidth
        �SUBIDz/v1/server/bandwidth�GET�r�request�r	�subid�paramsr
r
r�	bandwidth�zVultrServer.bandwidthcCs t||||d��}|�d|d�S)a� /v1/server/create
        POST - account
        Create a new virtual machine. You will start being billed for this
        immediately. The response only contains the SUBID for the new machine.
        You should use v1/server/list to poll and wait for the machine to be
        created (as this does not happen instantly).

        Link: https://www.vultr.com/api/#server_create
        )ZDCID�	VPSPLANID�OSIDz/v1/server/create�POSTr)r	Zdcid�	vpsplanid�osidrr
r
r�creates
�zVultrServer.createcCr)a /v1/server/destroy
        POST - account
        Destroy (delete) a virtual machine. All data will be permanently lost,
        and the IP address will be released. There is no going back from this
        call.

        Link: https://www.vultr.com/api/#server_destroy
        r
z/v1/server/destroyrrrr
r
r�destroy)�	zVultrServer.destroycCr)z� /v1/server/get_user_data
        GET - account
        Retrieves the (base64 encoded) user-data for this subscription.

        Link: https://www.vultr.com/api/#server_get_user_data
        r
z/v1/server/get_user_datarrrr
r
r�
get_user_data5rzVultrServer.get_user_datacCr)an /v1/server/halt
        POST - account
        Halt a virtual machine. This is a hard power off (basically, unplugging
        the machine). The data on the machine will not be modified, and you
        will still be billed for the machine. To completely delete a
        machine, see v1/server/destroy

        Link: https://www.vultr.com/api/#server_halt
        r
z/v1/server/haltrrrr
r
r�halt?s
zVultrServer.haltcC�t|||d��}|�d|d�S)z� /v1/server/label_set
        POST - account
        Set the label of a virtual machine.

        Link: https://www.vultr.com/api/#server_label_set
        )r
�labelz/v1/server/label_setrr)r	rr!rr
r
r�	label_setLs
�zVultrServer.label_setcCs&t||rd|int��}|�d|d�S)a /v1/server/list
        GET - account
        List all active or pending virtual machines on the current account. The
        'status' field represents the status of the subscription and will be
        one of pending|active|suspended|closed. If the status is 'active', you
        can check 'power_status' to determine if the VPS is powered on or not.
        The API does not provide any way to determine if the initial
        installation has completed or not.

        Link: https://www.vultr.com/api/#server_server_list
        r
z/v1/server/listr)r�dictrrr
r
r�listYs
�zVultrServer.listcCr)z� v1/server/neighbors
        GET - account
        Determine what other subscriptions are hosted on the same physical
        host as a given subscription.

        Link: https://www.vultr.com/api/#server_neighbors
        r
z/v1/server/neighborsrrrr
r
r�	neighborsk�zVultrServer.neighborscCr )z� /v1/server/os_change
        POST - account
        Changes the operating system of a virtual machine. All data will be
        permanently lost.

        Link: https://www.vultr.com/api/#server_os_change
        )r
rz/v1/server/os_changerr)r	rrrr
r
r�	os_changev�
�zVultrServer.os_changecCr)z� /v1/server/os_change_list
        GET - account
        Retrieves a list of operating systems to which this server can be
        changed.

        Link: https://www.vultr.com/api/#server_os_change_list
        r
z/v1/server/os_change_listrrrr
r
r�os_change_list�r&zVultrServer.os_change_listcCr)z� /v1/server/reboot
        POST - account
        Reboot a virtual machine. This is a hard reboot
        (basically, unplugging the machine).

        Link: https://www.vultr.com/api/#server_reboot
        r
z/v1/server/rebootrrrr
r
r�reboot�r&zVultrServer.rebootcCr)a/ /v1/server/reinstall
        POST - account
        Reinstall the operating system on a virtual machine. All data
        will be permanently lost, but the IP address will remain the
        same There is no going back from this call.

        Link: https://www.vultr.com/api/#server_reinstall
        r
z/v1/server/reinstallrrrr
r
r�	reinstall�rzVultrServer.reinstallcCr )z� /v1/server/restore_backup
        POST - account
        Restore the specified backup to the virtual machine. Any data
        already on the virtual machine will be lost.

        Link: https://www.vultr.com/api/#server_restore_backup
        )r
ZBACKUPIDz/v1/server/restore_backuprr)r	rZbackupidrr
r
r�restore_backup�r(zVultrServer.restore_backupcCr )z� /v1/server/restore_snapshot
        POST - account
        Restore the specificed snapshot to the virtual machine.
        Any data already on the virtual machine will be lost.

        Link: https://www.vultr.com/api/#server_restore_snapshot
        )r
Z
SNAPSHOTIDz/v1/server/restore_snapshotrr)r	rZ
snapshotidrr
r
r�restore_snapshot�r(zVultrServer.restore_snapshotcCr )aB /v1/server/set_user_data
        POST - account
        Sets the cloud-init user-data (base64) for this subscription.
        Note that user-data is not supported on every operating
        system, and is generally only provided on instance startup.

        Link: https://www.vultr.com/api/#server_set_user_data
        )r
�userdataz/v1/server/set_user_datarr)r	rr.rr
r
r�
set_user_data�s
	�zVultrServer.set_user_datacCr)z� /v1/server/start
        POST - account
        Start a virtual machine. If the machine is already
        running, it will be restarted.

        Link: https://www.vultr.com/api/#server_start
        r
z/v1/server/startrrrr
r
r�start�r&zVultrServer.startcCr )z� /v1/server/upgrade_plan
        POST - account
        Upgrade the plan of a virtual machine. The virtual machine will be
        rebooted upon a successful upgrade.

        Link: https://www.vultr.com/api/#server_upgrade_plan
        )r
rz/v1/server/upgrade_planrr)r	rrrr
r
r�upgrade_plan�r(zVultrServer.upgrade_plancCr)a4 /v1/server/upgrade_plan_list
        GET - account
        Retrieve a list of the VPSPLANIDs for which a virtual machine
        can be upgraded. An empty response array means that there are
        currently no upgrades available.

        Link: https://www.vultr.com/api/#server_upgrade_plan_list
        r
z/v1/server/upgrade_plan_listrrrr
r
r�upgrade_plan_list�rzVultrServer.upgrade_plan_listr)NN)�__name__�
__module__�__qualname__�__doc__rrrrrrr"r$r%r'r)r*r+r,r-r/r0r1r2r
r
r
rrs*


















rN)	r6�utilsrrZv1_server_ipv4rZv1_server_ipv6rrr
r
r
r�<module>s