All URIs are relative to http://localhost/api/v2.0
Method | HTTP request | Description |
---|---|---|
create_scanner | POST /scanners | Create a scanner registration |
delete_scanner | DELETE /scanners/{registration_id} | Delete a scanner registration |
get_scanner | GET /scanners/{registration_id} | Get a scanner registration details |
get_scanner_metadata | GET /scanners/{registration_id}/metadata | Get the metadata of the specified scanner registration |
list_scanners | GET /scanners | List scanner registrations |
ping_scanner | POST /scanners/ping | Tests scanner registration settings |
set_scanner_as_default | PATCH /scanners/{registration_id} | Set system default scanner registration |
update_scanner | PUT /scanners/{registration_id} | Update a scanner registration |
create_scanner(registration: ScannerRegistrationReq, x_request_id: Optional[str])-> None
Create a scanner registration
Creats a new scanner registration with the given data.
from __future__ import print_function
import time
import harbor_client
from harbor_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = harbor_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = harbor_client.ScannerApi(harbor_client.ApiClient(configuration))
registration = harbor_client.ScannerRegistrationReq() # ScannerRegistrationReq | A scanner registration to be created.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
try:
# Create a scanner registration
api_instance.create_scanner(registration, x_request_id=x_request_id)
except ApiException as e:
print("Exception when calling ScannerApi->create_scanner: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
registration | ScannerRegistrationReq | A scanner registration to be created. | |
x_request_id | str | An unique ID for the request | [optional] |
void (empty response body)
delete_scanner(registration_id: str, x_request_id: Optional[str])-> ScannerRegistration
Delete a scanner registration
Deletes the specified scanner registration.
from __future__ import print_function
import time
import harbor_client
from harbor_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = harbor_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = harbor_client.ScannerApi(harbor_client.ApiClient(configuration))
registration_id = 'registration_id_example' # str | The scanner registration identifier.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
try:
# Delete a scanner registration
api_response = api_instance.delete_scanner(registration_id, x_request_id=x_request_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling ScannerApi->delete_scanner: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
registration_id | str | The scanner registration identifier. | |
x_request_id | str | An unique ID for the request | [optional] |
get_scanner(registration_id: str, x_request_id: Optional[str])-> ScannerRegistration
Get a scanner registration details
Retruns the details of the specified scanner registration.
from __future__ import print_function
import time
import harbor_client
from harbor_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = harbor_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = harbor_client.ScannerApi(harbor_client.ApiClient(configuration))
registration_id = 'registration_id_example' # str | The scanner registration identifer.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
try:
# Get a scanner registration details
api_response = api_instance.get_scanner(registration_id, x_request_id=x_request_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling ScannerApi->get_scanner: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
registration_id | str | The scanner registration identifer. | |
x_request_id | str | An unique ID for the request | [optional] |
get_scanner_metadata(registration_id: str, x_request_id: Optional[str])-> ScannerAdapterMetadata
Get the metadata of the specified scanner registration
Get the metadata of the specified scanner registration, including the capabilities and customized properties.
from __future__ import print_function
import time
import harbor_client
from harbor_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = harbor_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = harbor_client.ScannerApi(harbor_client.ApiClient(configuration))
registration_id = 'registration_id_example' # str | The scanner registration identifier.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
try:
# Get the metadata of the specified scanner registration
api_response = api_instance.get_scanner_metadata(registration_id, x_request_id=x_request_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling ScannerApi->get_scanner_metadata: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
registration_id | str | The scanner registration identifier. | |
x_request_id | str | An unique ID for the request | [optional] |
list_scanners(x_request_id: Optional[str], q: Optional[str], sort: Optional[str], page: Optional[int], page_size: Optional[int])-> list[ScannerRegistration]
List scanner registrations
Returns a list of currently configured scanner registrations.
from __future__ import print_function
import time
import harbor_client
from harbor_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = harbor_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = harbor_client.ScannerApi(harbor_client.ApiClient(configuration))
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
q = 'q_example' # str | Query string to query resources. Supported query patterns are \"exact match(k=v)\", \"fuzzy match(k=~v)\", \"range(k=[min~max])\", \"list with union releationship(k={v1 v2 v3})\" and \"list with intersetion relationship(k=(v1 v2 v3))\". The value of range and list can be string(enclosed by \" or '), integer or time(in format \"2020-04-09 02:36:00\"). All of these query patterns should be put in the query string \"q=xxx\" and splitted by \",\". e.g. q=k1=v1,k2=~v2,k3=[min~max] (optional)
sort = 'sort_example' # str | Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with \"sort=field1,-field2\" (optional)
page = 1 # int | The page number (optional) (default to 1)
page_size = 10 # int | The size of per page (optional) (default to 10)
try:
# List scanner registrations
api_response = api_instance.list_scanners(x_request_id=x_request_id, q=q, sort=sort, page=page, page_size=page_size)
pprint(api_response)
except ApiException as e:
print("Exception when calling ScannerApi->list_scanners: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
x_request_id | str | An unique ID for the request | [optional] |
q | str | Query string to query resources. Supported query patterns are "exact match(k=v)", "fuzzy match(k=~v)", "range(k=[min~max])", "list with union releationship(k={v1 v2 v3})" and "list with intersetion relationship(k=(v1 v2 v3))". The value of range and list can be string(enclosed by " or '), integer or time(in format "2020-04-09 02:36:00"). All of these query patterns should be put in the query string "q=xxx" and splitted by ",". e.g. q=k1=v1,k2=~v2,k3=[min~max] | [optional] |
sort | str | Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with "sort=field1,-field2" | [optional] |
page | int | The page number | [optional] [default to 1] |
page_size | int | The size of per page | [optional] [default to 10] |
ping_scanner(settings: ScannerRegistrationSettings, x_request_id: Optional[str])-> None
Tests scanner registration settings
Pings scanner adapter to test endpoint URL and authorization settings.
from __future__ import print_function
import time
import harbor_client
from harbor_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = harbor_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = harbor_client.ScannerApi(harbor_client.ApiClient(configuration))
settings = harbor_client.ScannerRegistrationSettings() # ScannerRegistrationSettings | A scanner registration settings to be tested.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
try:
# Tests scanner registration settings
api_instance.ping_scanner(settings, x_request_id=x_request_id)
except ApiException as e:
print("Exception when calling ScannerApi->ping_scanner: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
settings | ScannerRegistrationSettings | A scanner registration settings to be tested. | |
x_request_id | str | An unique ID for the request | [optional] |
void (empty response body)
set_scanner_as_default(registration_id: str, payload: IsDefault, x_request_id: Optional[str])-> None
Set system default scanner registration
Set the specified scanner registration as the system default one.
from __future__ import print_function
import time
import harbor_client
from harbor_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = harbor_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = harbor_client.ScannerApi(harbor_client.ApiClient(configuration))
registration_id = 'registration_id_example' # str | The scanner registration identifier.
payload = harbor_client.IsDefault() # IsDefault |
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
try:
# Set system default scanner registration
api_instance.set_scanner_as_default(registration_id, payload, x_request_id=x_request_id)
except ApiException as e:
print("Exception when calling ScannerApi->set_scanner_as_default: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
registration_id | str | The scanner registration identifier. | |
payload | IsDefault | ||
x_request_id | str | An unique ID for the request | [optional] |
void (empty response body)
update_scanner(registration_id: str, registration: ScannerRegistrationReq, x_request_id: Optional[str])-> None
Update a scanner registration
Updates the specified scanner registration.
from __future__ import print_function
import time
import harbor_client
from harbor_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = harbor_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = harbor_client.ScannerApi(harbor_client.ApiClient(configuration))
registration_id = 'registration_id_example' # str | The scanner registration identifier.
registration = harbor_client.ScannerRegistrationReq() # ScannerRegistrationReq | A scanner registraiton to be updated.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
try:
# Update a scanner registration
api_instance.update_scanner(registration_id, registration, x_request_id=x_request_id)
except ApiException as e:
print("Exception when calling ScannerApi->update_scanner: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
registration_id | str | The scanner registration identifier. | |
registration | ScannerRegistrationReq | A scanner registraiton to be updated. | |
x_request_id | str | An unique ID for the request | [optional] |
void (empty response body)