Server IP : 13.213.54.232 / Your IP : 216.73.216.72 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ip-172-31-17-110 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 7.1.33-67+ubuntu22.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/self/root/lib/python3/dist-packages/uaclient/api/u/pro/attach/magic/revoke/ |
Upload File : |
from uaclient.api import exceptions from uaclient.api.api import APIEndpoint from uaclient.api.data_types import AdditionalInfo from uaclient.config import UAConfig from uaclient.contract import UAContractClient from uaclient.data_types import DataObject, Field, StringDataValue class MagicAttachRevokeOptions(DataObject): fields = [ Field( "magic_token", StringDataValue, doc="The Token provided by the initiate endpoint.", ), ] def __init__(self, magic_token): self.magic_token = magic_token class MagicAttachRevokeResult(DataObject, AdditionalInfo): pass def revoke(options: MagicAttachRevokeOptions) -> MagicAttachRevokeResult: return _revoke(options, UAConfig()) def _revoke( options: MagicAttachRevokeOptions, cfg: UAConfig ) -> MagicAttachRevokeResult: """ This endpoint revokes a Magic Attach Token. """ contract = UAContractClient(cfg) contract.revoke_magic_attach_token(options.magic_token) return MagicAttachRevokeResult() endpoint = APIEndpoint( version="v1", name="MagicAttachRevoke", fn=_revoke, options_cls=MagicAttachRevokeOptions, ) _doc = { "introduced_in": "27.11", "requires_network": True, "example_python": """ from uaclient.api.u.pro.attach.magic.revoke.v1 import MagicAttachRevokeOptions, revoke options = MagicAttachWaitOptions(magic_token="<magic_token>") result = revoke(options) """, # noqa: E501 "result_class": MagicAttachRevokeResult, "exceptions": [ ( exceptions.ConnectivityError, ( "Raised if it is not possible to connect to the contracts" " service." ), ), ( exceptions.ContractAPIError, ( "Raised if there is an unexpected error in the contracts" " service interaction." ), ), ( exceptions.MagicAttachTokenAlreadyActivated, ( "Raised when trying to revoke a Token which was already" " activated through the UI." ), ), ( exceptions.MagicAttachTokenError, "Raised when an invalid/expired Token is sent.", ), ( exceptions.MagicAttachUnavailable, ( "Raised if the Magic Attach service is busy or unavailable at" " the moment." ), ), ], "example_cli": "pro api u.pro.attach.magic.revoke.v1 --args magic_token=<token>", # noqa: E501 "example_json": """ {} """, }