HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //proc/1233/cwd/usr/lib/python3/dist-packages/uaclient/api/__pycache__/api.cpython-310.pyc
o

nHJe��
@s ddlZddlmZddlmZmZmZmZmZddl	m
Z
ddlmZm
Z
mZddlmZddlmZddlmZmZdd	lmZgd
�Zdeedeed
eeeefeeffdd�Zdedeed
eeeefeeffdd�Zdedeededed
e
f
dd�ZGdd�d�ZdS)�N)�
import_module)�Any�Callable�Dict�List�Tuple)�errors)�APIData�APIResponse�ErrorWarningObject)�UAConfig)�IncorrectFieldTypeError)�API_UNKNOWN_ARG�WARN_NEW_VERSION_AVAILABLE)�check_for_new_version)z,u.pro.attach.auto.configure_retry_service.v1z%u.pro.attach.auto.full_auto_attach.v1z'u.pro.attach.auto.should_auto_attach.v1zu.pro.attach.magic.initiate.v1zu.pro.attach.magic.revoke.v1zu.pro.attach.magic.wait.v1zu.pro.packages.summary.v1zu.pro.packages.updates.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.v1z u.pro.status.enabled_services.v1zu.pro.status.is_attached.v1zu.pro.version.v1zu.security.package_manifest.v1zu.unattended_upgrades.status.v1zu.apt_news.current_news.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�appendrr�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]*\}}|r'|s1tjd�||�d��||vrE|�	t
tj|d�jtj
id��|||<q||fS)N)r*z{}:{}rr)�json�loads�decoder�JSONDecodeErrorr�APIJSONDataFormatError�itemsrrrrrr r!)r*rr"r#�	json_datar%r&r'r'r(�
_process_dataAs(���
r2�
endpoint_path�cfgc

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|�||�}WnCty�}
zt�|
�WYd}
~
Sd}
~
ww|s�|r�t�tj|d��Sz|�|�}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>mszcall_api.<locals>.<listcomp>)rr5)�versionr)�type�
attributesr)�_schema_versionr#r*)�VALID_ENDPOINTSr�	error_out�APIInvalidEndpointrr5�options_clsrr)r2�extend�APIError�	from_dictr
�
APIMissingArgr6�fn�	Exception�APINoArgsForEndpointrrrrrr r!r
r:r#r	r)
r3rr*r4�moduler5�option_warningsrr"r#�e�result�new_versionr'r'r(�call_api^s�
�
�������
������
��rNc@s"eZdZdededefdd�ZdS)�APIEndpointr:r!rFcCs||_||_||_||_dS)N)r:r!rFrA)�selfr:r!rFrAr'r'r(�__init__�s
zAPIEndpoint.__init__N)�__name__�
__module__�__qualname__�strrrQr'r'r'r(rO�s���rO)r+�	importlibr�typingrrrrr�uaclient.apir�uaclient.api.data_typesr	r
r�uaclient.configr�uaclient.data_typesr
�uaclient.messagesrr�uaclient.versionrr>rUr)r2rNrOr'r'r'r(�<module>sH��
���
�����
�H