Skip to content

Robots

get_robot(robot_id) async

Fetch a robot account by its ID.

Parameters:

Name Type Description Default
robot_id int

The ID of the robot account to get.

required

Returns:

Type Description
Robot

Information about the robot account.

create_robot(robot, path=None, overwrite=False) async

Create a new robot account.

Attention

This action requires a sysadmin account to perform.

Parameters:

Name Type Description Default
robot RobotCreate

The definition for the robot account to create.

required
path Optional[Union[str, Path]]

Optional path to save the robot credentials to.

None
overwrite bool

If True, overwrite the existing credentials file. Has no effect if path is None.

False

Returns:

Type Description
RobotCreated

Information about the created robot account.

update_robot(robot_id, robot) async

Update a robot account.

Parameters:

Name Type Description Default
robot_id int

The ID of the robot account to update.

required
robot Robot

The new definition for the robot account.

required

refresh_robot_secret(robot_id, secret) async

Refresh the secret of a robot account.

Parameters:

Name Type Description Default
robot_id int

The ID of the robot account to refresh.

required
secret str

The secret of the robot account.

required

Returns:

Type Description
RobotSec

The updated Robot secret.

delete_robot(robot_id, missing_ok=None) async

Delete a robot account.

Parameters:

Name Type Description Default
robot_id int

The ID of the robot account to delete.

required
missing_ok Optional[bool]

DEPRECATED: Do not raise an error if the robot account does not exist.

None

get_robots(query=None, sort=None, page=1, page_size=10, limit=None) async

Get all robot accounts, optionally filtered by query.

Parameters:

Name Type Description Default
query Optional[str]

A query string to filter the resources.

Except the basic properties, the other supported queries includes:

* `"tags=*"` to list only tagged resources
* `"tags=nil"` to list only untagged resources
* `"tags=~v"` to list resources whose tag fuzzy matches "v"
* `"tags=v"` to list artifact whose tag exactly matches "v"
* `"labels=(id1, id2)"` to list resources that both labels with id1 and id2 are added to

The value of range and list can be:

* string(enclosed by `"` or `'`)
* integer
* time(in format `"2020-04-09 02:36:00"`)

All of these query patterns should be put in the query string and separated by ",". e.g. "k1=v1,k2=~v2,k3=[min~max]"

None
sort Optional[str]

The sort order of the artifacts.

None
page int

The page of results to return

1
page_size int

The number of results to return per page

10
limit Optional[int]

The maximum number of results to return.

None

Returns:

Type Description
List[Robot]

A list of registered robot accounts matching the query.