harbor_client.Robotv1Api

All URIs are relative to http://localhost/api/v2.0

MethodHTTP requestDescription
create_robot_v1POST /projects/{project_name_or_id}/robotsCreate a robot account
delete_robot_v1DELETE /projects/{project_name_or_id}/robots/{robot_id}Delete a robot account
get_robot_by_idv1GET /projects/{project_name_or_id}/robots/{robot_id}Get a robot account
list_robot_v1GET /projects/{project_name_or_id}/robotsGet all robot accounts of specified project
update_robot_v1PUT /projects/{project_name_or_id}/robots/{robot_id}Update status of robot account.

create_robot_v1

Signature

create_robot_v1(project_name_or_id: str, robot: RobotCreateV1, x_request_id: Optional[str], x_is_resource_name: Optional[bool])-> RobotCreated

Create a robot account

Create a robot account

Example

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.Robotv1Api(harbor_client.ApiClient(configuration))
project_name_or_id = 'project_name_or_id_example' # str | The name or id of the project
robot = harbor_client.RobotCreateV1() # RobotCreateV1 | The JSON object of a robot account.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
x_is_resource_name = false # bool | The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (optional) (default to false)

try:
    # Create a robot account
    api_response = api_instance.create_robot_v1(project_name_or_id, robot, x_request_id=x_request_id, x_is_resource_name=x_is_resource_name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling Robotv1Api->create_robot_v1: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_name_or_idstrThe name or id of the project
robotRobotCreateV1The JSON object of a robot account.
x_request_idstrAn unique ID for the request[optional]
x_is_resource_nameboolThe flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.[optional] [default to false]

Return type

RobotCreated

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top]

delete_robot_v1

Signature

delete_robot_v1(project_name_or_id: str, robot_id: int, x_request_id: Optional[str], x_is_resource_name: Optional[bool])-> None

Delete a robot account

This endpoint deletes specific robot account information by robot ID.

Example

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.Robotv1Api(harbor_client.ApiClient(configuration))
project_name_or_id = 'project_name_or_id_example' # str | The name or id of the project
robot_id = 56 # int | Robot ID
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
x_is_resource_name = false # bool | The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (optional) (default to false)

try:
    # Delete a robot account
    api_instance.delete_robot_v1(project_name_or_id, robot_id, x_request_id=x_request_id, x_is_resource_name=x_is_resource_name)
except ApiException as e:
    print("Exception when calling Robotv1Api->delete_robot_v1: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_name_or_idstrThe name or id of the project
robot_idintRobot ID
x_request_idstrAn unique ID for the request[optional]
x_is_resource_nameboolThe flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.[optional] [default to false]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top]

get_robot_by_idv1

Signature

get_robot_by_idv1(project_name_or_id: str, robot_id: int, x_request_id: Optional[str], x_is_resource_name: Optional[bool])-> Robot

Get a robot account

This endpoint returns specific robot account information by robot ID.

Example

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.Robotv1Api(harbor_client.ApiClient(configuration))
project_name_or_id = 'project_name_or_id_example' # str | The name or id of the project
robot_id = 56 # int | Robot ID
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
x_is_resource_name = false # bool | The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (optional) (default to false)

try:
    # Get a robot account
    api_response = api_instance.get_robot_by_idv1(project_name_or_id, robot_id, x_request_id=x_request_id, x_is_resource_name=x_is_resource_name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling Robotv1Api->get_robot_by_idv1: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_name_or_idstrThe name or id of the project
robot_idintRobot ID
x_request_idstrAn unique ID for the request[optional]
x_is_resource_nameboolThe flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.[optional] [default to false]

Return type

Robot

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top]

list_robot_v1

Signature

list_robot_v1(project_name_or_id: str, x_request_id: Optional[str], x_is_resource_name: Optional[bool], page: Optional[int], page_size: Optional[int], q: Optional[str], sort: Optional[str])-> list[Robot]

Get all robot accounts of specified project

Get all robot accounts of specified project

Example

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.Robotv1Api(harbor_client.ApiClient(configuration))
project_name_or_id = 'project_name_or_id_example' # str | The name or id of the project
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
x_is_resource_name = false # bool | The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (optional) (default to false)
page = 1 # int | The page number (optional) (default to 1)
page_size = 10 # int | The size of per page (optional) (default to 10)
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)

try:
    # Get all robot accounts of specified project
    api_response = api_instance.list_robot_v1(project_name_or_id, x_request_id=x_request_id, x_is_resource_name=x_is_resource_name, page=page, page_size=page_size, q=q, sort=sort)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling Robotv1Api->list_robot_v1: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_name_or_idstrThe name or id of the project
x_request_idstrAn unique ID for the request[optional]
x_is_resource_nameboolThe flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.[optional] [default to false]
pageintThe page number[optional] [default to 1]
page_sizeintThe size of per page[optional] [default to 10]
qstrQuery 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]
sortstrSort 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]

Return type

list[Robot]

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top]

update_robot_v1

Signature

update_robot_v1(project_name_or_id: str, robot_id: int, robot: Robot, x_request_id: Optional[str], x_is_resource_name: Optional[bool])-> None

Update status of robot account.

Used to disable/enable a specified robot account.

Example

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.Robotv1Api(harbor_client.ApiClient(configuration))
project_name_or_id = 'project_name_or_id_example' # str | The name or id of the project
robot_id = 56 # int | Robot ID
robot = harbor_client.Robot() # Robot | The JSON object of a robot account.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
x_is_resource_name = false # bool | The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (optional) (default to false)

try:
    # Update status of robot account.
    api_instance.update_robot_v1(project_name_or_id, robot_id, robot, x_request_id=x_request_id, x_is_resource_name=x_is_resource_name)
except ApiException as e:
    print("Exception when calling Robotv1Api->update_robot_v1: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_name_or_idstrThe name or id of the project
robot_idintRobot ID
robotRobotThe JSON object of a robot account.
x_request_idstrAn unique ID for the request[optional]
x_is_resource_nameboolThe flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.[optional] [default to false]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top]