harbor_client.GcApi

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

MethodHTTP requestDescription
create_gc_schedulePOST /system/gc/scheduleCreate a gc schedule.
get_gcGET /system/gc/{gc_id}Get gc status.
get_gc_historyGET /system/gcGet gc results.
get_gc_logGET /system/gc/{gc_id}/logGet gc job log.
get_gc_scheduleGET /system/gc/scheduleGet gc's schedule.
stop_gcPUT /system/gc/{gc_id}Stop the specific GC execution
update_gc_schedulePUT /system/gc/scheduleUpdate gc's schedule.

create_gc_schedule

Signature

create_gc_schedule(schedule: Schedule, x_request_id: Optional[str])-> None

Create a gc schedule.

This endpoint is for update gc schedule.

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.GcApi(harbor_client.ApiClient(configuration))
schedule = harbor_client.Schedule() # Schedule | Updates of gc's schedule.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Create a gc schedule.
    api_instance.create_gc_schedule(schedule, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling GcApi->create_gc_schedule: %s\n" % e)

Parameters

NameTypeDescriptionNotes
scheduleScheduleUpdates of gc's schedule.
x_request_idstrAn unique ID for the request[optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

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

[Back to top]

get_gc

Signature

get_gc(gc_id: int, x_request_id: Optional[str])-> GCHistory

Get gc status.

This endpoint let user get gc status filtered by specific 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.GcApi(harbor_client.ApiClient(configuration))
gc_id = 789 # int | The ID of the gc log
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Get gc status.
    api_response = api_instance.get_gc(gc_id, x_request_id=x_request_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling GcApi->get_gc: %s\n" % e)

Parameters

NameTypeDescriptionNotes
gc_idintThe ID of the gc log
x_request_idstrAn unique ID for the request[optional]

Return type

GCHistory

Authorization

basic

HTTP request headers

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

[Back to top]

get_gc_history

Signature

get_gc_history(x_request_id: Optional[str], q: Optional[str], sort: Optional[str], page: Optional[int], page_size: Optional[int])-> list[GCHistory]

Get gc results.

This endpoint let user get gc execution history.

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.GcApi(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:
    # Get gc results.
    api_response = api_instance.get_gc_history(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 GcApi->get_gc_history: %s\n" % e)

Parameters

NameTypeDescriptionNotes
x_request_idstrAn unique ID for the request[optional]
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]
pageintThe page number[optional] [default to 1]
page_sizeintThe size of per page[optional] [default to 10]

Return type

list[GCHistory]

Authorization

basic

HTTP request headers

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

[Back to top]

get_gc_log

Signature

get_gc_log(gc_id: int, x_request_id: Optional[str])-> str

Get gc job log.

This endpoint let user get gc job logs filtered by specific 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.GcApi(harbor_client.ApiClient(configuration))
gc_id = 789 # int | The ID of the gc log
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Get gc job log.
    api_response = api_instance.get_gc_log(gc_id, x_request_id=x_request_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling GcApi->get_gc_log: %s\n" % e)

Parameters

NameTypeDescriptionNotes
gc_idintThe ID of the gc log
x_request_idstrAn unique ID for the request[optional]

Return type

str

Authorization

basic

HTTP request headers

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

[Back to top]

get_gc_schedule

Signature

get_gc_schedule(x_request_id: Optional[str])-> GCHistory

Get gc’s schedule.

This endpoint is for get schedule of gc job.

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.GcApi(harbor_client.ApiClient(configuration))
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Get gc's schedule.
    api_response = api_instance.get_gc_schedule(x_request_id=x_request_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling GcApi->get_gc_schedule: %s\n" % e)

Parameters

NameTypeDescriptionNotes
x_request_idstrAn unique ID for the request[optional]

Return type

GCHistory

Authorization

basic

HTTP request headers

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

[Back to top]

stop_gc

Signature

stop_gc(gc_id: int, x_request_id: Optional[str])-> None

Stop the specific GC execution

Stop the GC execution specified by 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.GcApi(harbor_client.ApiClient(configuration))
gc_id = 789 # int | The ID of the gc log
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Stop the specific GC execution
    api_instance.stop_gc(gc_id, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling GcApi->stop_gc: %s\n" % e)

Parameters

NameTypeDescriptionNotes
gc_idintThe ID of the gc log
x_request_idstrAn unique ID for the request[optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

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

[Back to top]

update_gc_schedule

Signature

update_gc_schedule(schedule: Schedule, x_request_id: Optional[str])-> None

Update gc’s schedule.

This endpoint is for update gc schedule.

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.GcApi(harbor_client.ApiClient(configuration))
schedule = harbor_client.Schedule() # Schedule | Updates of gc's schedule.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Update gc's schedule.
    api_instance.update_gc_schedule(schedule, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling GcApi->update_gc_schedule: %s\n" % e)

Parameters

NameTypeDescriptionNotes
scheduleScheduleUpdates of gc's schedule.
x_request_idstrAn unique ID for the request[optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

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

[Back to top]