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/services/dependencies/__pycache__/v1.cpython-38.pyc
U

��Jh%�@s�ddlZddlmZddlmZmZddlmZddlm	Z	ddl
mZddlm
Z
mZmZmZe�e�e��ZGdd	�d	e
�ZGd
d�de
�ZGdd
�d
e
�ZGdd�de
e	�Zed�dd�Zeed�dd�Zeddedd�Zdddeddd�ZdS)�N)�List)�entitlements�util)�APIEndpoint)�AdditionalInfo)�UAConfig)�
DataObject�Field�StringDataValue�	data_listc@s8eZdZededd�ededd�gZeed�dd�Zd	S)
�Reason�codez'Short string that represents the reason��doc�titlez9Longer string describing the reason - possibly translated�r
rcCs||_||_dS�Nr)�selfr
r�r�M/usr/lib/python3/dist-packages/uaclient/api/u/pro/services/dependencies/v1.py�__init__szReason.__init__N)�__name__�
__module__�__qualname__r	r
�fields�strrrrrrr
s���
rc@s8eZdZededd�ededd�gZeed�dd�Zd	S)
�ServiceWithReason�name�0Name of the Pro service this item corresponds tor�reasonz0Reason that this service is in the list it is in�rrcCs||_||_dSrr )rrrrrrr.szServiceWithReason.__init__N)	rrrr	r
rrrrrrrrr s���
rc@sVeZdZededd�edee�dd�edee�dd�gZee	ee	ed�d	d
�Z
dS)�ServiceWithDependenciesrrr�incompatible_withzkList of Pro services this service is incompatible with. That means they cannot be enabled at the same time.�
depends_onzwList of Pro services this service depends on. The services in this list must be enabled for this service to be enabled.�rr"r#cCs||_||_||_dSrr$)rrr"r#rrrrLsz ServiceWithDependencies.__init__N)rrrr	r
rrrrrrrrrrr!3s(�����r!c@s2eZdZedee�dd�gZeed�dd�ZdS)�DependenciesResult�servicesz*Each Pro service gets an item in this listr�r&cCs
||_dSrr')rr&rrrraszDependenciesResult.__init__N)	rrrr	rr!rrrrrrrr%Xs��r%)�returncCs
tt��Sr)�
_dependenciesrrrrr�dependenciesesr*)�cfgr(c
Cs�g}tjD]�}||�}g}g}|jD]*}|�t|jjt|jj|jj	d�d��q$|j
D]*}|�t|jjt|jj|jj	d�d��qV|�t|j||d��q
t|d�S)a
    This endpoint will return a full list of all service dependencies,
    regardless of the current system state. That means it will always return
    the same thing until new services are added, or until we add/remove
    dependencies between services.
    rr r$r')
rZENTITLEMENT_CLASSESZincompatible_services�appendrZentitlementrrZ	named_msg�msgZrequired_servicesr!r%)r+r&Zent_clsZentr"r#Zent_with_reasonrrrr)isB

���	
���	��r)Zv1ZServiceDependencies)�versionr�fnZoptions_clsZ32Fz^
from uaclient.api.u.pro.services.dependencies.v1 import dependencies
result = dependencies()
z&pro api u.pro.services.dependencies.v1a�
{
    "services": [
        {
            "name": "one",
            "depends_on": [
                {
                    "name": "zero",
                    "reason": {
                        "code": "one-and-zero",
                        "title": "Service One requires service Zero."
                    }
                },
                ...
            ],
            "incompatible_with": [
                {
                    "name": "two",
                    "reason": {
                        "code": "one-and-two",
                        "title": "Services One and Two are not compatible."
                    }
                },
                ...
            ]
        },
        ...
    ]
}
)Z
introduced_inZrequires_networkZexample_pythonZresult_classZexample_cliZexample_json)Zlogging�typingrZuaclientrrZuaclient.api.apirZuaclient.api.data_typesrZuaclient.configrZuaclient.data_typesrr	r
rZ	getLoggerZreplace_top_level_logger_namerZLOGrrr!r%r*r)ZendpointZ_docrrrr�<module>s4%
*��