File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/libcloud/compute/drivers/__pycache__/onapp.cpython-310.pyc
Back
o ;jL: � @ s� d dl Z d dlmZ d dlmZ d dlmZmZmZm Z d dl mZ d dlm Z dgZ di d d ed ��dded ��dded ��d d ed ��dded ��dded ��dded ��dded ��dded ��dded ��dded ��dded ��dded ��dded ��dded ��dded ��dded ��i dded ��dded ��dded ��dded ��dded ��d d ed ��d!d!ed ��d"d"ed ��d#d#ed ��d$d$ed ��d%d%ed ��d&d&ed ��d'd'ed ��d(d(ed ��d)d)ed ��d*d*ed ��d+d+ed ���i d,d,ed ��d-d-ed ��d.d.ed ��d/d/ed ��d0d0ed ��d1d1ed ��d2d2ed ��d3d3ed ��d4d4ed ��d5d5ed ��d6d6ed ��d7d7ed ��d8d8ed ��d9d9ed ��d:d:ed ��d;d;ed ��d<d<ed ���d=d=ed �i�iZG d>d� de �ZdS )?� N)�httplib)�OnAppConnection)�Node�KeyPair� NodeImage� NodeDriver)�is_private_subnet)�Provider�OnAppNodeDriver�nodeZadd_to_marketplace)�key_name�transform_funcZ admin_note�allow_resize_without_reboot�allowed_hot_migrate�allowed_swapZbootedZbuiltZcpu_priority� cpu_sharesZcpu_socketsZcpu_threadsZ cpu_units�cpus� created_atZcustomer_network_idZ deleted_atZedge_server_typeZenable_autoscaleZenable_monitisZfirewall_notrack�hostnameZ hypervisor_id�idZinitial_root_passwordZinitial_root_password_encryptedZlocal_remote_access_ip_addressZlocal_remote_access_port�locked�memory� min_disk_sizeZmonthly_bandwidth_usedZnote�operating_system�operating_system_distroZ preferred_hvsZprice_per_hourZprice_per_hour_powered_offZ recovery_modeZremote_access_passwordZservice_password�stateZstorage_server_typeZstrict_virtual_machine_idZsupport_incremental_backupsZ suspended�template_idZtemplate_labelZtotal_disk_size� updated_at�user_idZvipZxen_idc @ s� e Zd ZdZeZejZdZ dZ d!dd�Zd"dd �Zd d� Z dd � Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zedd� �Zedd� �Zd S )#r z! Base OnApp node driver. ZOnAppzhttp://onapp.com/� c K sp t ||||||||| | |�d�d�}|�tjd i |��� t�d|i�} | jjd| ddidd�}| � |j d �S )z� Add a VS :param kwargs: All keyword arguments to create a VS :type kwargs: ``dict`` :rtype: :class:`OnAppNode` � rate_limit)�labelr r r r r Zprimary_disk_sizeZswap_disk_sizeZrequired_virtual_machine_buildZrequired_ip_address_assignmentr �virtual_machine�/virtual_machines.json�Content-type�application/json�POST��data�headers�methodN� )�dict�get�updater �_create_args_to_params�json�dumps� connection�request�_to_node�object)�self�nameZ ex_memoryZex_cpusZ ex_cpu_sharesZex_hostnameZex_template_idZex_primary_disk_sizeZex_swap_disk_sizeZ!ex_required_virtual_machine_buildZ!ex_required_ip_address_assignment�kwargs� server_paramsr( �responser+ r+ �R/opt/saltstack/salt/lib/python3.10/site-packages/libcloud/compute/drivers/onapp.py�create_node� s, ��zOnAppNodeDriver.create_noder c C s. ||d�}dj |jd�}| jj||dd� dS )a� Delete a VS :param node: OnApp node :type node: :class: `OnAppNode` :param convert_last_backup: set 1 to convert the last VS's backup to template, otherwise set 0 :type convert_last_backup: ``int`` :param destroy_all_backups: set 1 to destroy all existing backups of this VS, otherwise set 0 :type destroy_all_backups: ``int`` )Zconvert_last_backupZdestroy_all_backupsz#/virtual_machines/{identifier}.json)� identifier�DELETE)�paramsr* T)�formatr r2 r3 )r6 r Zex_convert_last_backupZex_destroy_all_backupsr9 �actionr+ r+ r; �destroy_node� s �zOnAppNodeDriver.destroy_nodec C �4 | j �d�}g }|jD ]}|�| �|d �� q|S )zM List all VS :rtype: ``list`` of :class:`OnAppNode` r# r"