HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/uaclient/api/u/pro/packages/updates/__pycache__/v1.cpython-38.pyc
U

��Jh��@s�ddlmZddlmZddlmZddlmZddlm	Z	m
Z
mZmZm
Z
ddlmZmZmZmZGdd�de	�ZGd	d
�d
e	�ZGdd�de	e�Zed
�dd�Zeed�dd�Zeddedd�Zdddegddd�ZdS)�)�List)�APIEndpoint)�AdditionalInfo)�UAConfig)�
DataObject�Field�IntDataValue�StringDataValue�	data_list)�create_updates_list�filter_updates� get_installed_packages_by_origin�get_ua_infoc	@sbeZdZededd�ededd�ededd�eded	d�ed
edd�gZeeeeed�d
d�ZdS)�
UpdateSummary�num_updatesz Total count of available updates��doc�num_esm_apps_updatesz,Count of available updates from ``esm-apps``�num_esm_infra_updatesz-Count of available updates from ``esm-infra``�num_standard_security_updatesz8Count of available updates from the ``-security`` pocket�num_standard_updatesz7Count of available updates from the ``-updates`` pocket�rrrrrcCs"||_||_||_||_||_dS�Nr)�selfrrrrr�r�H/usr/lib/python3/dist-packages/uaclient/api/u/pro/packages/updates/v1.py�__init__0s
zUpdateSummary.__init__N)�__name__�
__module__�__qualname__rr�fields�intrrrrrrs@�������rc
@speZdZededd�ededd�ededd�eded	d�ed
edd�eded
d�gZeeeeeed�dd�Z	dS)�
UpdateInfo�
download_sizez%Download size for the update in bytesr�originz#Where the update is downloaded from�packagez!Name of the package to be updated�provided_byz!Service which provides the update�statusz0Whether this update is ready for download or not�versionzVersion of the update�r#r$r%r&r'r(cCs(||_||_||_||_||_||_dSrr))rr#r$r%r&r'r(rrrr[s	zUpdateInfo.__init__N)
rrrrrr	r r!�strrrrrrr"?sD�������r"c@s@eZdZededd�edee�dd�gZeeed�dd�Z	d	S)
�PackageUpdatesResult�summaryz Summary of all available updatesr�updatesz&Detailed list of all available updates�r,r-cCs||_||_dSrr.)rr,r-rrrrxszPackageUpdatesResult.__init__N)
rrrrrr
r"r rrrrrrr+ls���r+)�returncCs
tt��Sr)�_updatesrrrrrr-}sr-)�cfgr/cCs�t|�}t�}t|d�}t||�}t|d�}t|d�}t|d�}t|d�}t||||||||d�}	dd�|D�}
t|	|
d	�S)
zx
    This endpoint shows available updates for packages in a system, categorised
    by where they can be obtained.
    �allzesm-appsz	esm-infrazstandard-securityzstandard-updatesrc
Ss8g|]0}t|d|d|d|d|d|dd��qS)r#r$r%Zservice_namer'r(r))r")�.0�updaterrr�
<listcomp>�s	��z_updates.<locals>.<listcomp>r.)rr
rr�lenrr+)r1Zua_infoZpackagesZupgradable_versionsZupdate_listrrrrr,r-rrrr0�s6
�����
	�r0Zv1ZPackageUpdatesN)r(�name�fnZoptions_clsz27.12FzP
from uaclient.api.u.pro.packages.updates.v1 import updates

result = updates()
z!pro api u.pro.packages.updates.v1a�
{
    "summary": {
        "num_updates": 1,
        "num_esm_apps_updates": 2,
        "num_esm_infra_updates": 3,
        "num_standard_security_updates": 4,
        "num_standard_updates": 5,
    },
    "updates": [
        {
            "download_size": 6,
            "origin": "<some site>",
            "package": "<package name>",
            "provided_by": "<service name>",
            "status": "<update status>",
            "version": "<updated version>",
        },
    ]
}
)Z
introduced_inZrequires_networkZexample_pythonZresult_class�
exceptionsZexample_cliZexample_json)�typingrZuaclient.api.apirZuaclient.api.data_typesrZuaclient.configrZuaclient.data_typesrrrr	r
Zuaclient.security_statusrrr
rrr"r+r-r0ZendpointZ_docrrrr�<module>s0*-*��