Source code for q2_sdk.hq.models.external_auth.create_user

from __future__ import annotations
from dataclasses import dataclass

from lxml import objectify  # type: ignore
from q2_sdk.tools.utils import to_bool
from .base import BaseAuthRequest, BaseAuthResponse


[docs] @dataclass class Request(BaseAuthRequest): """ Shape that comes in from HQ when a User is created. This can be invoked in a sandbox with ``q2 db create_online_user`` .. code-block:: xml <HQ request="CreateUser" messageID="{0}"> <UserId>2</UserId> <CSRLogin>CSRLoginName</CSRLogin> <isLogon>True</isLogon> </HQ> """ raw: objectify.Element user_id: int is_logon: bool @staticmethod def from_xml(xml: objectify.Element) -> Request: user_id = int(xml.UserId.text) is_logon = to_bool(getattr(xml, "isLogon", False)) return Request( xml, user_id, is_logon, )
[docs] @dataclass class Response(BaseAuthResponse): ...