PHP WebShell

Текущая директория: /usr/lib/python3/dist-packages/uaclient/api/u/pro/attach/magic/wait/__pycache__

Просмотр файла: v1.cpython-310.pyc

o

Uٵg[�	@s�ddlZddlmZmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
mZmZmZdZGd	d
�d
e
�ZGdd�de
e�Zd
edefdd�Zd
ede	defdd�Zeddeed�Zdddeejdfejdfejdfejdfgddd �ZdS)!�N)�
exceptions�secret_manager)�APIEndpoint)�AdditionalInfo)�UAConfig)�UAContractClient)�
DataObject�Field�IntDataValue�StringDataValue�Fc@s*eZdZededd�gZdefdd�ZdS)�MagicAttachWaitOptions�magic_tokenz,The Token provided by the initiate endpoint.��doccCs
||_dS�N�r)�selfr�r�I/usr/lib/python3/dist-packages/uaclient/api/u/pro/attach/magic/wait/v1.py�__init__s
zMagicAttachWaitOptions.__init__N)�__name__�
__module__�__qualname__r	r�fields�strrrrrrr
s��r
c@szeZdZededd�ededd�ededd�eded	d�ed
edd�eded
d�gZdedededed
edefdd�Z	dS)�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 machinecCs(||_||_||_||_||_||_dSr�rrrr r!r")rrrrr r!r"rrrrDs	
zMagicAttachWaitResult.__init__N)
rrrr	rr
rr�intrrrrrrsZ�������$������r�options�returncCst|t��Sr)�_waitr)r%rrr�waitUsr(�cfgc
Cst|�}d}d}d}tj�|j�|tkr�d}z|j|jd�}d}Wn5tjy/Yt���tj	y:d}Yntj
yW}z|dkrK|d7}n|�WYd}~nd}~ww|ry|�d�duryt|d	|d
|dt
|d�|d
|dd�S|r}d}t�|�|d7}|tkst���)zi
    This endpoint polls the contracts service waiting for the user to confirm
    the Magic Attach.
    r�
Nr����
contractToken�userCoderr�	expiresIn�
contractIDr#)rr�secrets�
add_secretr�MAXIMUM_ATTEMPTS�get_magic_attach_token_infor�MagicAttachTokenError�MagicAttachUnavailable�ConnectivityError�getrr$�time�sleep)r%r)�contract�num_attempts�num_connection_errors�	wait_time�	wait_resp�errrr'[sN� �
���
�
�)r'�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)r:�uaclientrr�uaclient.api.apir�uaclient.api.data_typesr�uaclient.configr�uaclient.contractr�uaclient.data_typesrr	r
rr4r
rr(r'�endpointr8�ContractAPIErrorr6r7�_docrrrr�<module>s`
6�
���
�:������
�

Выполнить команду


Для локальной разработки. Не используйте в интернете!