%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/uaclient/api/u/pro/attach/magic/wait/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/uaclient/api/u/pro/attach/magic/wait/__pycache__/v1.cpython-312.pyc

�

�(�f[�	�N�ddlZddlmZmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
mZmZmZdZGd	�d
e
�ZGd�de
e�Zd
edefd�Zd
ede	defd�Zeddee��Zdddeej.dfej0dfej2dfej4dfgddd�Zy)�N)�
exceptions�secret_manager)�APIEndpoint)�AdditionalInfo)�UAConfig)�UAContractClient)�
DataObject�Field�IntDataValue�StringDataValue�Fc�0�eZdZeded��gZdefd�Zy)�MagicAttachWaitOptions�magic_tokenz,The Token provided by the initiate endpoint.��docc��||_y�N�r)�selfrs  �I/usr/lib/python3/dist-packages/uaclient/api/u/pro/attach/magic/wait/v1.py�__init__zMagicAttachWaitOptions.__init__s
��&���N)�__name__�
__module__�__qualname__r
r�fields�strr�rrrrs&��
���>�	
��F�'�C�'rrc��eZdZeded��eded��eded��eded	��ed
ed��eded
��gZdedededed
edefd�Z	y)�MagicAttachWaitResult�	user_codezACode the user will see in the UI when confirming the Magic Attachr�tokenz1The same Magic Token that was sent as an argument�expiresz0Timestamp of the Magic Attach process expiration�
expires_inz/Seconds before the Magic Attach process expires�contract_idz2ID of the contract the machine will be attached to�contract_tokenz(The contract Token to attach the machinec�X�||_||_||_||_||_||_yr�r"r#r$r%r&r')rr"r#r$r%r&r's       rrzMagicAttachWaitResult.__init__Ds0��#�����
����$���&���,��rN)
rrrr
rrrr�intrrrrr!r!s���
����		
�	���C�	
�
	���B�	
�
	���A�	
�
	���D�	
�
	���:�	
�;"�F�H-��-��-��	-�
�-��
-��-rr!�options�returnc�*�t|t��Sr)�_waitr)r+s r�waitr/Us����(�*�%�%r�cfgc	��t|�}d}d}d}tjj|j�|t
kr�d}	|j
|j��}d}|r=|jd��,t|d	|d
|dt|d�|d
|d��S|rd}tj|�|dz
}|t
kr��tj��#tj$rYtj��tj$rd}Y��tj$r}|dkr|dz
}n|�Yd}~��d}~wwxYw)zi
    This endpoint polls the contracts service waiting for the user to confirm
    the Magic Attach.
    r�
Nr����
contractToken�userCoder#r$�	expiresIn�
contractIDr))rr�secrets�
add_secretr�MAXIMUM_ATTEMPTS�get_magic_attach_token_infor�MagicAttachTokenError�MagicAttachUnavailable�ConnectivityError�getr!r*�time�sleep)r+r0�contract�num_attempts�num_connection_errors�	wait_time�	wait_resp�es        rr.r.[st�� ��$�H��L����I����%�%�g�&9�&9�:�
�)�
)��	�	� �<�<�#�/�/�=��I�%&�!�&�����7�C�(�#�J�/���(�!�)�,��y��5�6�%�l�3�(��9�
�
���I��
�
�9������O�)�
)�R�
*�
*�
,�,��C�/�/�	��@�
*�
*�
,�,�5�0�0�	��I��+�+�	�$�q�(�%��*�%���&��	�s$�C � E�E�E�0
E�E�v1�MagicAttachWait)�version�name�fn�options_clsz27.11Tz�
from uaclient.api.u.pro.attach.magic.wait.v1 import MagicAttachWaitOptions, wait

options = MagicAttachWaitOptions(magic_token="<magic_token>")
result = wait(options)
zARaised if it is not possible to connect to the contracts service.zLRaised if there is an unexpected error in the contracts service interaction.z-Raised when an invalid/expired Token is sent.zHRaised if the Magic Attach service is busy or unavailable at the moment.zCpro api u.pro.attach.magic.wait.v1 --args magic_token=<magic_token>z�
{
    "user_code":"<UI_code>",
    "token":"<magic_token>",
    "expires": "<yyyy-MM-dd>T<HH:mm:ss>.<TZ>",
    "expires_in": 500,
    "contract_id": "<Contract-ID>",
    "contract_token": "<attach_token>",
}
)�
introduced_in�requires_network�example_python�result_classr�example_cli�example_json)rB�uaclientrr�uaclient.api.apir�uaclient.api.data_typesr�uaclient.configr�uaclient.contractr�uaclient.data_typesr	r
rrr<rr!r/r.�endpointr@�ContractAPIErrorr>r?�_docrrr�<module>r_s���/�(�2�$�.�����
'�Z�
'�3-�J��3-�l&�
#�&��&�7-�
#�7-�*2�7-��7-�t��	��&�	�����*�
�(�(��	
�
�'�'�(�	
�
�,�,�;�	
�

�-�-��	
�'�6Y�	�M0�r

Zerion Mini Shell 1.0