File: //lib/python3/dist-packages/uaclient/api/u/pro/attach/magic/initiate/__pycache__/v1.cpython-38.pyc
U
��JhT
� @ s� d dl mZ d dlmZ d dlmZ d dlmZ d dlm Z d dl
mZ d dlm
Z
mZmZmZ G dd � d e
e�Zed
�dd�Ze ed
�dd�Zeddedd�Zdddeejdfejdfejdfgddd�ZdS )� )�secret_manager)�
exceptions)�APIEndpoint)�AdditionalInfo)�UAConfig)�UAContractClient)�
DataObject�Field�IntDataValue�StringDataValuec @ sT e Zd Zededd�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
r r r c C s || _ || _|| _|| _d S �Nr )�selfr
r r r � r �M/usr/lib/python3/dist-packages/uaclient/api/u/pro/attach/magic/initiate/v1.py�__init__. s z"MagicAttachInitiateResult.__init__N)
�__name__�
__module__�__qualname__r r r
Zfields�str�intr r r r r r s4 �� ��� �r )�returnc C s
t t� �S r )� _initiater r r r r �initiate; s r )�cfgr c C sT t | �}|�� }tj�|d � tj�|d � t|d |d |d t|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.
r ZuserCoder Z expiresInr )r Znew_magic_attach_tokenr ZsecretsZ
add_secretr r )r ZcontractZ
initiate_respr r r r ? s
�r Zv1ZMagicAttachInitiateN)�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_pythonZresult_classr Zexample_cliZexample_json)Zuaclientr Zuaclient.apir Zuaclient.api.apir Zuaclient.api.data_typesr Zuaclient.configr Zuaclient.contractr Zuaclient.data_typesr r r
r r r r ZendpointZConnectivityErrorZContractAPIErrorZMagicAttachUnavailableZ_docr r r r �<module> s@ ,������