ActionsClient

class ResourceActionsClient(client: Client, resource: str | None)[source]
get_all(status: list[str] | None = None, sort: list[str] | None = None) list[BoundAction][source]

Get all actions.

Parameters:
  • status – List[str] (optional) Response will have only actions with specified statuses. Choices: running success error

  • sort – List[str] (optional) Specify how the results are sorted. Choices: id command status progress started finished . You can add one of “:asc”, “:desc” to modify sort order. ( “:asc” is default)

Returns:

List[BoundAction]

get_by_id(id: int) BoundAction[source]

Get a specific action by its ID.

Parameters:

id – int

Returns:

BoundAction

get_list(status: list[str] | None = None, sort: list[str] | None = None, page: int | None = None, per_page: int | None = None) ActionsPageResult[source]

Get a list of actions.

Parameters:
  • status – List[str] (optional) Response will have only actions with specified statuses. Choices: running success error

  • sort – List[str] (optional) Specify how the results are sorted. Choices: id command status progress started finished . You can add one of “:asc”, “:desc” to modify sort order. ( “:asc” is default)

  • page – int (optional) Specifies the page to fetch

  • per_page – int (optional) Specifies how many results are returned by page

Returns:

(List[BoundAction], Meta)

class ActionsClient(client: Client)[source]
get_all(status: list[str] | None = None, sort: list[str] | None = None) list[BoundAction][source]

Deprecated since version 1.28: Use client.<resource>.actions.get_all() instead, e.g. using hcloud.certificates.client.CertificatesClient.actions.

Starting 1 October 2023, it will no longer be available.

get_by_id(id: int) BoundAction

Get a specific action by its ID.

Parameters:

id – int

Returns:

BoundAction

get_list(status: list[str] | None = None, sort: list[str] | None = None, page: int | None = None, per_page: int | None = None) ActionsPageResult[source]

Deprecated since version 1.28: Use client.<resource>.actions.get_list() instead, e.g. using hcloud.certificates.client.CertificatesClient.actions.

Starting 1 October 2023, it will no longer be available.

class BoundAction(client: ClientEntityBase, data: dict, complete: bool = True)[source]
model

alias of Action

wait_until_finished(max_retries: int = 100) None[source]

Wait until the specific action has status=”finished” (set Client.poll_interval to specify a delay between checks)

Parameters:

max_retries – int Specify how many retries will be performed before an ActionTimeoutException will be raised

Raises:

ActionFailedException when action is finished with status==”error”

Raises:

ActionTimeoutException when Action is still in “running” state after max_retries reloads.

class Action(id: int, command: str | None = None, status: str | None = None, progress: int | None = None, started: str | None = None, finished: str | None = None, resources: list[dict] | None = None, error: dict | None = None)[source]

Action Domain

Parameters:
  • id – int ID of an action

  • command – Command executed in the action

  • status – Status of the action

  • progress – Progress of action in percent

  • started – Point in time when the action was started

  • finished (datetime,None) – Point in time when the action was finished. Only set if the action is finished otherwise None

  • resources – Resources the action relates to

  • error – Error message for the action if error occurred, otherwise None.

STATUS_ERROR = 'error'

Action Status error

STATUS_RUNNING = 'running'

Action Status running

STATUS_SUCCESS = 'success'

Action Status success