/usr/lib/python3/dist-packages/uaclient/api/u/pro/attach/magic/wait/__pycache__
NameSizeModeActions
v1.cpython-310.pyc41730644editdlrm
__init__.cpython-310.pyc1720644editdlrm
Edit: /usr/lib/python3/dist-packages/uaclient/api/u/pro/attach/magic/wait/__pycache__/v1.cpython-310.pyc (4173B)
o Ki[ @sddlZddlmZmZddlmZddlmZddlm Z ddl m Z ddl m Z mZmZmZdZGd d d e ZGd d d e eZd edefddZd ede defddZeddeedZdddeejdfejdfejdfejdfgddd ZdS)!N) exceptionssecret_manager) APIEndpoint)AdditionalInfo)UAConfig)UAContractClient) DataObjectField IntDataValueStringDataValueFc@s*eZdZededdgZdefddZdS)MagicAttachWaitOptions magic_tokenz,The Token provided by the initiate endpoint.doccCs ||_dSNr)selfrrI/usr/lib/python3/dist-packages/uaclient/api/u/pro/attach/magic/wait/v1.py__init__s zMagicAttachWaitOptions.__init__N)__name__ __module__ __qualname__r r fieldsstrrrrrrr sr c @szeZdZededdededdededdeded ded ed ded ed dgZdedededed ed ef ddZ dS)MagicAttachWaitResult user_codezACode the user will see in the UI when confirming the Magic Attachrtokenz1The same Magic Token that was sent as an argumentexpiresz0Timestamp 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 tocontract_tokenz(The contract Token to attach the machinecCs(||_||_||_||_||_||_dSrrrrr r!r")rrrrr r!r"rrrrDs   zMagicAttachWaitResult.__init__N) rrrr r r rrintrrrrrrsZ$roptionsreturncCs t|tSr)_waitr)r%rrrwaitUs r(cfgc Cst|}d}d}d}tj|j|tkrd}z |j|jd}d}Wn5tjy/Yttj y:d}Yntj yW}z|dkrK|d7}n|WYd}~nd}~ww|ry| dduryt |d |d |d t |d |d |ddS|r}d}t||d7}|tkst)zi This endpoint polls the contracts service waiting for the user to confirm the Magic Attach. r Nr contractTokenuserCoderr expiresIn contractIDr#)rrsecrets add_secretrMAXIMUM_ATTEMPTSget_magic_attach_token_inforMagicAttachTokenErrorMagicAttachUnavailableConnectivityErrorgetrr$timesleep)r%r)contract num_attemptsnum_connection_errors wait_time wait_resperrrr'[sN     )r'v1MagicAttachWait)versionnamefn options_clsz27.11Tz from uaclient.api.u.pro.attach.magic.wait.v1 import MagicAttachWaitOptions, wait options = MagicAttachWaitOptions(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=z { "user_code":"", "token":"", "expires": "T.", "expires_in": 500, "contract_id": "", "contract_token": "", } ) introduced_inrequires_networkexample_python result_classr example_cli example_json)r:uaclientrruaclient.api.apiruaclient.api.data_typesruaclient.configruaclient.contractruaclient.data_typesrr r r r4r rr(r'endpointr8ContractAPIErrorr6r7_docrrrrs`     6  :