steps.api.cloud_objects.cloud_base
Classes
Enum defining different token types used for authentication. |
|
Abstract base class for all cloud objects. |
Module Contents
- class steps.api.cloud_objects.cloud_base.TokenType(*args, **kwds)[source]
Bases:
enum.EnumEnum 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.
- class steps.api.cloud_objects.cloud_base.ACloudObject[source]
Bases:
abc.ABC,dictAbstract 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.
- classmethod get_object_name() str[source]
- 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.
- Returns:
Name of the object used in API paths
- classmethod get_endpoint() str[source]
- 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.
- Returns:
API endpoint path for this object type
- classmethod get_object_id_key() str[source]
Return the key name used for the object’s ID.
By default, creates the key by appending ‘_id’ to the object name.
- Returns:
Key name for the object’s ID
- classmethod get_id_endpoint() str[source]
Return the API endpoint for accessing a specific object instance.
Constructs an endpoint with the object ID parameter in the path.
- Returns:
API endpoint with object ID parameter
- classmethod get_id_endpoint_with_extension(extension_path: str) str[source]
Return the API endpoint with an extension for a specific object instance.
Constructs an endpoint with the object ID parameter and additional path extension.
- Parameters:
extension_path – Additional path to append after the object ID
- Returns:
Extended API endpoint with object ID parameter
- get_object_id() str | int[source]
Return the ID of this object instance.
- Returns:
The object’s ID value
- classmethod get_api(context: steps.api.utils.CloudContext) steps.api.utils.Api[source]
- 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.
- Parameters:
context – Cloud context containing API configurations
- Returns:
API instance for making requests
- classmethod get_token_method() str[source]
Return the token type used for authentication with this object.
By default, uses the Login token type.
- Returns:
Token type for authentication
- keys() list[str][source]
Return a list of all keys in this object’s dictionary.
- Returns:
List of dictionary keys
- update_from_dict(object_dict: dict[str]) None[source]
Update this object’s attributes from a dictionary.
Special handling for ‘id’ key to map it to the appropriate object ID key.
- Parameters:
object_dict – Dictionary with attributes to update
- get_create_request(context: steps.api.utils.CloudContext, user) steps.api.utils.Request[source]
Create a new request for creating this object.
Configures a POST request to the object’s endpoint with appropriate authentication and content type headers.
- Parameters:
context – Cloud context for API configuration
user – User providing authentication
- Returns:
Configured request object
- get_endpoint_id_request_with_extension(context: steps.api.utils.CloudContext, user, extension_path: str) steps.api.utils.Request[source]
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.
- Parameters:
context – Cloud context for API configuration
user – User providing authentication
extension_path – Additional path to append after the object ID
- Returns:
Configured request object with extended URL
- get_read_request(context: steps.api.utils.CloudContext, user: steps.api.cloud_objects.cloud_user.User) steps.api.utils.Request[source]
Create a request for reading this object instance.
Configures a GET request to access the object’s data.
- Parameters:
context – Cloud context for API configuration
user – User providing authentication
- Returns:
Configured GET request
- get_update_request(context: steps.api.utils.CloudContext, user: steps.api.cloud_objects.cloud_user.User) steps.api.utils.Request[source]
Create a request for updating this object instance.
Configures a PUT request to update the object’s data.
- Parameters:
context – Cloud context for API configuration
user – User providing authentication
- Returns:
Configured PUT request
- get_delete_request(context: steps.api.utils.CloudContext, user: steps.api.cloud_objects.cloud_user.User) steps.api.utils.Request[source]
Create a request for deleting this object instance.
Configures a DELETE request to remove the object.
- Parameters:
context – Cloud context for API configuration
user – User providing authentication
- Returns:
Configured DELETE request
- classmethod get_list_all_request(context: steps.api.utils.CloudContext, user: steps.api.cloud_objects.cloud_user.User) steps.api.utils.Request[source]
Create a request for listing all objects of this type.
Configures a GET request to the base endpoint to retrieve all objects.
- Parameters:
context – Cloud context for API configuration
user – User providing authentication
- Returns:
Configured GET request for listing objects