Skip to content

Scanners

get_scanner(registration_id) async

Fetch a scanner by ID.

Parameters:

Name Type Description Default
registration_id Union[int, str]

The ID of the scanner to fetch.

required

Returns:

Type Description
ScannerRegistration

The scanner.

create_scanner(scanner) async

Creates a new scanner. Returns location of the created scanner.

Parameters:

Name Type Description Default
scanner ScannerRegistrationReq

The scanner to create.

required

Returns:

Type Description
str

The location of the created scanner.

update_scanner(registration_id, scanner) async

Update a scanner.

Parameters:

Name Type Description Default
registration_id Union[int, str]

The ID of the scanner to update.

required
scanner ScannerRegistrationReq

The updated scanner definition.

required

delete_scanner(registration_id, missing_ok=None) async

Delete a scanner by ID.

Parameters:

Name Type Description Default
registration_id Union[int, str]

The ID of the scanner to delete.

required
missing_ok Optional[bool]

DEPRECATED: Whether to ignore 404 error when deleting the scanner.

None

Returns:

Type Description
Optional[ScannerRegistration]

The scanner, or None if the scanner is not found and missing_ok is True.

Raises:

Type Description
HarborAPIException

Successful deletion request that returns an empty response.

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

Get a list of scanners.

Parameters:

Name Type Description Default
query Optional[str]

A query string to filter the scanners.

Supported query patterns are:

* exact match(`"k=v"`)
* fuzzy match(`"k=~v"`)
* range(`"k=[min~max]"`)
* list with union releationship(`"k={v1 v2 v3}"`)
* list with intersection relationship(`"k=(v1 v2 v3)"`).

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 scanners.

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[ScannerRegistration]

description

set_default_scanner(registration_id, is_default=True) async

Set a scanner as the default scanner.

Parameters:

Name Type Description Default
registration_id Union[int, str]

The ID of the scanner to set as the default.

required
is_default bool

Whether to set the scanner as the default, by default True. Set to False to unset the scanner as the default.

True

ping_scanner_adapter(settings) async

Ping a scanner adapter.

Parameters:

Name Type Description Default
settings ScannerRegistrationSettings

The settings of the scanner adapter.

required