steps.api.cloud_objects.cloud_token

Classes

JobToken

Job token class for job-specific authentication.

LoginToken

Login token class for user authentication.

ApiKey

API key class for API authentication.

Module Contents

class steps.api.cloud_objects.cloud_token.JobToken(label: str = None, duration: int = 99999, token_id: int = -1, user_id: int = -1, token: str = '', **kwargs)[source]

Bases: 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.

Parameters:
  • label – Label for the token

  • duration – Token duration in seconds

  • token_id – Token ID (defaults to -1 for new tokens)

  • user_id – ID of the user the token belongs to

  • token – Token string

  • kwargs – Additional attributes to set on the token

classmethod get_object_name() str[source]
classmethod get_endpoint() str[source]
classmethod get_api(context: steps.api.utils.CloudContext) steps.api.utils.Api[source]
classmethod get_token_method() str[source]
DURATION_KEY = 'duration'[source]
LABEL_KEY = 'label'[source]
label: str = None[source]
token_id: int[source]
user_id: int = -1[source]
duration: int = 99999[source]
token: str = ''[source]
create(context: steps.api.utils.CloudContext, user: steps.api.cloud_objects.cloud_user.User) None[source]

Create this job token in the cloud.

Parameters:
  • context – Cloud context for API configuration

  • user – User providing authentication and owning the token

Raises:
  • AssertionError – If the user doesn’t have a login token

  • RuntimeError – If job token creation fails

read(context: steps.api.utils.CloudContext, user: steps.api.cloud_objects.cloud_user.User) None[source]

Read this job token’s information from the cloud.

Parameters:
  • context – Cloud context for API configuration

  • user – User providing authentication

Returns:

Dictionary with token data from response

Raises:
  • AssertionError – If the user doesn’t have job tokens or the token wasn’t created

  • RuntimeError – If reading token data fails

delete(context: steps.api.utils.CloudContext, user: steps.api.cloud_objects.cloud_user.User) None[source]

Delete this job token from the cloud.

Parameters:
  • context – Cloud context for API configuration

  • user – User providing authentication

Raises:
  • AssertionError – If the token wasn’t created

  • RuntimeError – If deleting the token fails

classmethod list_all(context: steps.api.utils.CloudContext, admin: steps.api.cloud_objects.cloud_user.User) list[JobToken][source]

List all job tokens in the cloud.

Parameters:
  • context – Cloud context for API configuration

  • admin – Admin user providing authentication

Returns:

List of JobToken objects

Raises:
  • AssertionError – If the user is not an admin

  • RuntimeError – If listing tokens fails

class steps.api.cloud_objects.cloud_token.LoginToken[source]

Login token class for user authentication.

This class manages the tokens used for user login and general API access.

ENDPOINT = '/api/login'[source]
token: str = None[source]
create(context: steps.api.utils.CloudContext, user=None) None[source]

Create a login token for the user.

Parameters:
  • context – Cloud context for API configuration

  • user – User to create the login token for

Raises:

RuntimeError – If login token creation fails

class steps.api.cloud_objects.cloud_token.ApiKey(label: str = None, duration: int = 99999, api_key: str = '', api_key_id: int = -1, **_)[source]

Bases: 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.

classmethod get_object_name() str[source]
classmethod get_endpoint() str[source]
classmethod get_api(context: steps.api.utils.CloudContext) steps.api.utils.Api[source]
classmethod get_token_method() str[source]
DURATION_KEY = 'duration'[source]
LABEL_KEY = 'label'[source]
api_key: str = ''[source]
api_key_id: int = -1[source]
label: str = None[source]
duration: int = 99999[source]
property token: str[source]

Get the token string for this API key.

Returns:

API key string

create(context: steps.api.utils.CloudContext, admin=None) None[source]

Create this API key in the cloud.

Parameters:
  • context – Cloud context for API configuration

  • admin – Admin user providing authentication

Raises:
  • AssertionError – If the user is not an admin

  • RuntimeError – If API key creation fails