steps.api.cloud_objects.cloud_base ================================== .. py:module:: steps.api.cloud_objects.cloud_base Classes ------- .. autoapisummary:: steps.api.cloud_objects.cloud_base.TokenType steps.api.cloud_objects.cloud_base.ACloudObject Module Contents --------------- .. py:class:: TokenType(*args, **kwds) Bases: :py:obj:`enum.Enum` Enum defining different token types used for authentication. Attributes: Login (int): Login token type used for general authentication. Job (int): Job token type used for job-specific operations. API_Key (int): API key token type used for worker access. .. py:attribute:: Login :value: 0 .. py:attribute:: Job :value: 1 .. py:attribute:: API_Key :value: 2 .. py:class:: ACloudObject Bases: :py:obj:`abc.ABC`, :py:obj:`dict` Abstract base class for all cloud objects. Provides common functionality for API interactions including CRUD operations and endpoint management. All cloud objects (User, Job, Platform, etc.) should inherit from this class. .. py:method:: get_object_name() -> str :classmethod: :abstractmethod: Return the name of the object type. This method should be implemented by all subclasses to define the object name used in API paths and object identification. :return: Name of the object used in API paths .. py:method:: get_endpoint() -> str :classmethod: :abstractmethod: Return the base API endpoint for this object type. This method should be implemented by all subclasses to define the API endpoint path for the object. :return: API endpoint path for this object type .. py:method:: get_object_id_key() -> str :classmethod: Return the key name used for the object's ID. By default, creates the key by appending '_id' to the object name. :return: Key name for the object's ID .. py:method:: get_id_endpoint() -> str :classmethod: Return the API endpoint for accessing a specific object instance. Constructs an endpoint with the object ID parameter in the path. :return: API endpoint with object ID parameter .. py:method:: get_id_endpoint_with_extension(extension_path: str) -> str :classmethod: Return the API endpoint with an extension for a specific object instance. Constructs an endpoint with the object ID parameter and additional path extension. :param extension_path: Additional path to append after the object ID :return: Extended API endpoint with object ID parameter .. py:method:: get_object_id() -> str | int Return the ID of this object instance. :return: The object's ID value .. py:method:: get_api(context: steps.api.utils.CloudContext) -> steps.api.utils.Api :classmethod: :abstractmethod: Return the API instance for this object type. This method should be implemented by all subclasses to define which API context to use for requests. :param context: Cloud context containing API configurations :return: API instance for making requests .. py:method:: get_token_method() -> str :classmethod: Return the token type used for authentication with this object. By default, uses the Login token type. :return: Token type for authentication .. py:method:: keys() -> list[str] Return a list of all keys in this object's dictionary. :return: List of dictionary keys .. py:method:: update_from_dict(object_dict: dict[str]) -> None Update this object's attributes from a dictionary. Special handling for 'id' key to map it to the appropriate object ID key. :param object_dict: Dictionary with attributes to update .. py:method:: get_create_request(context: steps.api.utils.CloudContext, user) -> steps.api.utils.Request Create a new request for creating this object. Configures a POST request to the object's endpoint with appropriate authentication and content type headers. :param context: Cloud context for API configuration :param user: User providing authentication :return: Configured request object .. py:method:: get_endpoint_id_request_with_extension(context: steps.api.utils.CloudContext, user, extension_path: str) -> steps.api.utils.Request Create a request for an extended endpoint for this object instance. Creates a request that targets a specific object ID with an additional path extension. :param context: Cloud context for API configuration :param user: User providing authentication :param extension_path: Additional path to append after the object ID :return: Configured request object with extended URL .. py:method:: get_read_request(context: steps.api.utils.CloudContext, user: steps.api.cloud_objects.cloud_user.User) -> steps.api.utils.Request Create a request for reading this object instance. Configures a GET request to access the object's data. :param context: Cloud context for API configuration :param user: User providing authentication :return: Configured GET request .. py:method:: get_update_request(context: steps.api.utils.CloudContext, user: steps.api.cloud_objects.cloud_user.User) -> steps.api.utils.Request Create a request for updating this object instance. Configures a PUT request to update the object's data. :param context: Cloud context for API configuration :param user: User providing authentication :return: Configured PUT request .. py:method:: get_delete_request(context: steps.api.utils.CloudContext, user: steps.api.cloud_objects.cloud_user.User) -> steps.api.utils.Request Create a request for deleting this object instance. Configures a DELETE request to remove the object. :param context: Cloud context for API configuration :param user: User providing authentication :return: Configured DELETE request .. py:method:: get_list_all_request(context: steps.api.utils.CloudContext, user: steps.api.cloud_objects.cloud_user.User) -> steps.api.utils.Request :classmethod: Create a request for listing all objects of this type. Configures a GET request to the base endpoint to retrieve all objects. :param context: Cloud context for API configuration :param user: User providing authentication :return: Configured GET request for listing objects