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

��JhT
�@s�ddlmZddlmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
mZmZmZGdd	�d	e
e�Zed
�dd�Ze	ed
�dd�Zeddedd�Zdddeejdfejdfejdfgddd�ZdS)�)�secret_manager)�
exceptions)�APIEndpoint)�AdditionalInfo)�UAConfig)�UAContractClient)�
DataObject�Field�IntDataValue�StringDataValuec@sTeZdZededd�ededd�ededd�eded	d�gZeeeed
�dd�Z	d
S)�MagicAttachInitiateResult�	user_codezACode the user will see in the UI when confirming the Magic Attach)�doc�tokenzgMagic Token that can be used in either `u.pro.attach.magic.revoke.v1`_ or `u.pro.attach.magic.wait.v1`_�expiresz0Timestamp of the Magic Attach process expiration�
expires_inz/Seconds before the Magic Attach process expires�r
rrrcCs||_||_||_||_dS�Nr)�selfr
rrr�r�M/usr/lib/python3/dist-packages/uaclient/api/u/pro/attach/magic/initiate/v1.py�__init__.sz"MagicAttachInitiateResult.__init__N)
�__name__�
__module__�__qualname__r	rr
Zfields�str�intrrrrrrs4��	��� �r)�returncCs
tt��Sr)�	_initiaterrrrr�initiate;sr)�cfgrcCsTt|�}|��}tj�|d�tj�|d�t|d|d|dt|d�d�S)z�
    This endpoint initiates the Magic Attach flow, retrieving the User Code to
    confirm the operation and the Token used to proceed.
    rZuserCoderZ	expiresInr)rZnew_magic_attach_tokenrZsecretsZ
add_secretrr)r ZcontractZ
initiate_resprrrr?s
�rZv1ZMagicAttachInitiateN)�version�name�fnZoptions_clsz27.11TzW
from uaclient.api.u.pro.attach.magic.initiate.v1 import initiate

result = initiate()
zARaised if it is not possible to connect to the contracts service.zLRaised if there is an unexpected error in the contracts service interaction.zHRaised if the Magic Attach service is busy or unavailable at the moment.z&pro api u.pro.attach.magic.initiate.v1z�
{
    "user_code":"<UI_code>",
    "token":"<magic_token>",
    "expires": "<yyyy-MM-dd>T<HH:mm:ss>.<TZ>",
    "expires_in": 600
}
)Z
introduced_inZrequires_networkZexample_pythonZresult_classrZexample_cliZexample_json)ZuaclientrZuaclient.apirZuaclient.api.apirZuaclient.api.data_typesrZuaclient.configrZuaclient.contractrZuaclient.data_typesrr	r
rrrrZendpointZConnectivityErrorZContractAPIErrorZMagicAttachUnavailableZ_docrrrr�<module>s@,������