steps.api.cloud_objects.cloud_token =================================== .. py:module:: steps.api.cloud_objects.cloud_token Classes ------- .. autoapisummary:: steps.api.cloud_objects.cloud_token.JobToken steps.api.cloud_objects.cloud_token.LoginToken steps.api.cloud_objects.cloud_token.ApiKey Module Contents --------------- .. py:class:: JobToken(label: str = None, duration: int = 99999, token_id: int = -1, user_id: int = -1, token: str = '', **kwargs) Bases: :py:obj:`steps.api.cloud_objects.cloud_base.ACloudObject` Job token class for job-specific authentication. This class handles the creation and management of tokens used for job operations. :param label: Label for the token :param duration: Token duration in seconds :param token_id: Token ID (defaults to -1 for new tokens) :param user_id: ID of the user the token belongs to :param token: Token string :param kwargs: Additional attributes to set on the token .. py:method:: get_object_name() -> str :classmethod: .. py:method:: get_endpoint() -> str :classmethod: .. py:method:: get_api(context: steps.api.utils.CloudContext) -> steps.api.utils.Api :classmethod: .. py:method:: get_token_method() -> str :classmethod: .. py:attribute:: DURATION_KEY :value: 'duration' .. py:attribute:: LABEL_KEY :value: 'label' .. py:attribute:: label :type: str :value: None .. py:attribute:: token_id :type: int .. py:attribute:: user_id :type: int :value: -1 .. py:attribute:: duration :type: int :value: 99999 .. py:attribute:: token :type: str :value: '' .. py:method:: create(context: steps.api.utils.CloudContext, user: steps.api.cloud_objects.cloud_user.User) -> None Create this job token in the cloud. :param context: Cloud context for API configuration :param user: User providing authentication and owning the token :raises AssertionError: If the user doesn't have a login token :raises RuntimeError: If job token creation fails .. py:method:: read(context: steps.api.utils.CloudContext, user: steps.api.cloud_objects.cloud_user.User) -> None Read this job token's information from the cloud. :param context: Cloud context for API configuration :param user: User providing authentication :return: Dictionary with token data from response :raises AssertionError: If the user doesn't have job tokens or the token wasn't created :raises RuntimeError: If reading token data fails .. py:method:: delete(context: steps.api.utils.CloudContext, user: steps.api.cloud_objects.cloud_user.User) -> None Delete this job token from the cloud. :param context: Cloud context for API configuration :param user: User providing authentication :raises AssertionError: If the token wasn't created :raises RuntimeError: If deleting the token fails .. py:method:: list_all(context: steps.api.utils.CloudContext, admin: steps.api.cloud_objects.cloud_user.User) -> list[JobToken] :classmethod: List all job tokens in the cloud. :param context: Cloud context for API configuration :param admin: Admin user providing authentication :return: List of JobToken objects :raises AssertionError: If the user is not an admin :raises RuntimeError: If listing tokens fails .. py:class:: LoginToken Login token class for user authentication. This class manages the tokens used for user login and general API access. .. py:attribute:: ENDPOINT :value: '/api/login' .. py:attribute:: token :type: str :value: None .. py:method:: create(context: steps.api.utils.CloudContext, user=None) -> None Create a login token for the user. :param context: Cloud context for API configuration :param user: User to create the login token for :raises RuntimeError: If login token creation fails .. py:class:: ApiKey(label: str = None, duration: int = 99999, api_key: str = '', api_key_id: int = -1, **_) Bases: :py:obj:`steps.api.cloud_objects.cloud_base.ACloudObject` API key class for API authentication. This class handles the creation and management of API keys for worker access. .. py:method:: get_object_name() -> str :classmethod: .. py:method:: get_endpoint() -> str :classmethod: .. py:method:: get_api(context: steps.api.utils.CloudContext) -> steps.api.utils.Api :classmethod: .. py:method:: get_token_method() -> str :classmethod: .. py:attribute:: DURATION_KEY :value: 'duration' .. py:attribute:: LABEL_KEY :value: 'label' .. py:attribute:: api_key :type: str :value: '' .. py:attribute:: api_key_id :type: int :value: -1 .. py:attribute:: label :type: str :value: None .. py:attribute:: duration :type: int :value: 99999 .. py:property:: token :type: str Get the token string for this API key. :return: API key string .. py:method:: create(context: steps.api.utils.CloudContext, admin=None) -> None Create this API key in the cloud. :param context: Cloud context for API configuration :param admin: Admin user providing authentication :raises AssertionError: If the user is not an admin :raises RuntimeError: If API key creation fails