CasperSecurity

Current Path : /usr/lib/python3/dist-packages/uaclient/api/__pycache__/
Upload File :
Current File : //usr/lib/python3/dist-packages/uaclient/api/__pycache__/api.cpython-310.pyc

o

�K�i<�
@s4ddlZddlmZddlmZmZmZmZmZm	Z	ddl
mZmZddl
mZmZmZddlmZddlmZddlmZmZdd	lmZgd
�Zdeedeed
e	eeefeeffdd�Zdedeed
e	eeefeeffdd�Z	ddedeedededeed
efdd�ZGdd�d�ZdS)�N)�
import_module)�Any�Callable�Dict�List�Optional�Tuple)�AbstractProgress�errors)�APIData�APIResponse�ErrorWarningObject)�UAConfig)�IncorrectFieldTypeError)�API_UNKNOWN_ARG�WARN_NEW_VERSION_AVAILABLE)�check_for_new_version)zu.pro.version.v1z,u.pro.attach.auto.configure_retry_service.v1z%u.pro.attach.auto.full_auto_attach.v1z'u.pro.attach.auto.should_auto_attach.v1z%u.pro.attach.guest.get_guest_token.v1zu.pro.attach.magic.initiate.v1zu.pro.attach.magic.revoke.v1zu.pro.attach.magic.wait.v1z'u.pro.attach.token.full_token_attach.v1zu.pro.detach.v1zu.pro.packages.summary.v1zu.pro.packages.updates.v1zu.pro.security.cves.v1z!u.pro.security.fix.cve.execute.v1zu.pro.security.fix.cve.plan.v1z!u.pro.security.fix.usn.execute.v1zu.pro.security.fix.usn.plan.v1z'u.pro.security.status.livepatch_cves.v1z(u.pro.security.status.reboot_required.v1zu.pro.services.dependencies.v1zu.pro.services.disable.v1zu.pro.services.enable.v1z u.pro.status.enabled_services.v1zu.pro.status.is_attached.v1zu.apt_news.current_news.v1zu.security.package_manifest.v1zu.unattended_upgrades.status.v1�options�fields�returnc	Cs�i}g}|D];}z	|�d�\}}Wn
tytj|d��w|r#|s)tj|d��||vr=|�ttj|d�jtj	id��|||<q||fS)N�=��arg��title�code�meta)
�split�
ValueErrorr
�APIBadArgsFormat�appendr
r�format�msg�name)rr�kwargs�warnings�option�k�v�r)�2/usr/lib/python3/dist-packages/uaclient/api/api.py�_process_options+s(���
r+�datacCs�i}g}zt�|�}Wntjjytj|d��w|��D]\}}||vr7|�tt	j
|d�jt	jid��|||<q||fS)N)r,rr)
�json�loads�decoder�JSONDecodeErrorr
�APIJSONDataFormatError�itemsr r
rr!r"r#)r,rr$r%�	json_datar'r(r)r)r*�
_process_dataHs$���
r4�
endpoint_path�cfg�progress_objectc
Cs|tvr
t�tj|d��Std|�}|j}g}|jr�dd�|jjD�}z |r/t||�\}	}
n|r9t	||�\}	}
nig}	}
|�
|
�Wntjy\}zt�|�WYd}~Sd}~wwz|j�|	�}Wnt
y�}zt�tj|j|d��WYd}~Sd}~wwz|jr�|j|||d�}n|�||�}WnNty�}zt�|�WYd}~Sd}~ww|s�|r�t�tj|d��Sz|jr�|j||d�}n|�|�}Wnty�}zt�|�WYd}~Sd}~wwt�}
|
r�|�ttj|
d�jtjid��t|j|j|t|j||jd	�d
�S)N)�endpointz
uaclient.api.cSsg|]}|j�qSr))�key)�.0�fr)r)r*�
<listcomp>uszcall_api.<locals>.<listcomp>)rr8)r7)�versionr)�type�
attributesr)�_schema_versionr%r,) �VALID_ENDPOINTSr
�	error_out�APIInvalidEndpointrr8�options_clsrr+r4�extend�APIError�	from_dictr�
APIMissingArgr9�supports_progress�fn�	Exception�APINoArgsForEndpointrr r
rr!r"r#rr=r%rr)r5rr,r6r7�moduler8�option_warningsrr$r%�e�result�new_versionr)r)r*�call_apibs�
�
���������
�
������
��rRc	@s*eZdZ	d	dedededefdd�ZdS)
�APIEndpointFr=r#rJrIcCs"||_||_||_||_||_dS�N)r=r#rJrDrI)�selfr=r#rJrDrIr)r)r*�__init__�s

zAPIEndpoint.__init__N)F)�__name__�
__module__�__qualname__�strr�boolrVr)r)r)r*rS�s�����rSrT) r-�	importlibr�typingrrrrrr�uaclient.apir	r
�uaclient.api.data_typesrrr
�uaclient.configr�uaclient.data_typesr�uaclient.messagesrr�uaclient.versionrrArZr+r4rRrSr)r)r)r*�<module>sN ��
���
�������
�T
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY