U
    (f7                     @   s   d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZmZmZ d dlmZ G dd	 d	eZG d
d deeZedddZe	edddZeddeddZdddeedfgdddZdS )    )messages)APIEndpoint)AdditionalInfo)APIError)UAConfig)
DataObjectFieldStringDataValue)get_versionc                   @   s   e Zd ZejZdS )VersionErrorN)__name__
__module____qualname__r   ZE_API_VERSION_ERRORZ_formatted_msg r   r   ?/usr/lib/python3/dist-packages/uaclient/api/u/pro/version/v1.pyr   
   s   r   c                   @   s*   e Zd ZededdgZedddZdS )VersionResultinstalled_versionzThe current installed version)docr   c                C   s
   || _ d S Nr   )selfr   r   r   r   __init__   s    zVersionResult.__init__N)r   r   r   r   r	   Zfieldsstrr   r   r   r   r   r      s   r   )returnc                   C   s
   t t S r   )_versionr   r   r   r   r   version   s    r   )cfgr   c              
   C   sF   z
t  }W n0 tk
r: } ztt|dW 5 d}~X Y nX t|dS )z?
    This endpoint shows the installed Pro Client version.
    )Z	error_msgNr   )r
   	Exceptionr   r   r   )r   r   er   r   r   r      s
    
 r   Zv1ZVersionN)r   namefnZoptions_clsz27.11FzG
from uaclient.api.u.pro.version.v1 import version

result = version()
z2Raised if the Client cannot determine the version.zpro api u.pro.version.v1z+
{
    "installed_version": "32.3~24.04"
}
)Zintroduced_inZrequires_networkZexample_pythonZresult_class
exceptionsZexample_cliZexample_json)Zuaclientr   Zuaclient.api.apir   Zuaclient.api.data_typesr   Zuaclient.api.errorsr   Zuaclient.configr   Zuaclient.data_typesr   r   r	   Zuaclient.versionr
   r   r   r   r   ZendpointZ_docr   r   r   r   <module>   s2   