harbor_client.PurgeApi

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

MethodHTTP requestDescription
create_purge_schedulePOST /system/purgeaudit/scheduleCreate a purge job schedule.
get_purge_historyGET /system/purgeauditGet purge job results.
get_purge_jobGET /system/purgeaudit/{purge_id}Get purge job status.
get_purge_job_logGET /system/purgeaudit/{purge_id}/logGet purge job log.
get_purge_scheduleGET /system/purgeaudit/scheduleGet purge's schedule.
stop_purgePUT /system/purgeaudit/{purge_id}Stop the specific purge audit log execution
update_purge_schedulePUT /system/purgeaudit/scheduleUpdate purge job's schedule.

create_purge_schedule

Signature

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

Create a purge job schedule.

This endpoint is for update purge job 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.PurgeApi(harbor_client.ApiClient(configuration))
schedule = harbor_client.Schedule() # Schedule | The purge job's schedule, it is a json object. | The sample format is | {\"parameters\":{\"audit_retention_hour\":168,\"dry_run\":true, \"include_operations\":\"create,delete,pull\"},\"schedule\":{\"type\":\"Hourly\",\"cron\":\"0 0 * * * *\"}} | the include_operation should be a comma separated string, e.g. create,delete,pull, if it is empty, no operation will be purged. 
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

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

Parameters

NameTypeDescriptionNotes
scheduleScheduleThe purge job's schedule, it is a json object. | The sample format is | {"parameters":{"audit_retention_hour":168,"dry_run":true, "include_operations":"create,delete,pull"},"schedule":{"type":"Hourly","cron":"0 0 * * * *"}} | the include_operation should be a comma separated string, e.g. create,delete,pull, if it is empty, no operation will be purged.
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_purge_history

Signature

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

Get purge job results.

get purge job 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.PurgeApi(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 purge job results.
    api_response = api_instance.get_purge_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 PurgeApi->get_purge_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[ExecHistory]

Authorization

basic

HTTP request headers

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

[Back to top]

get_purge_job

Signature

get_purge_job(purge_id: int, x_request_id: Optional[str])-> ExecHistory

Get purge job status.

This endpoint let user get purge job 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.PurgeApi(harbor_client.ApiClient(configuration))
purge_id = 789 # int | The ID of the purge log
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Get purge job status.
    api_response = api_instance.get_purge_job(purge_id, x_request_id=x_request_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling PurgeApi->get_purge_job: %s\n" % e)

Parameters

NameTypeDescriptionNotes
purge_idintThe ID of the purge log
x_request_idstrAn unique ID for the request[optional]

Return type

ExecHistory

Authorization

basic

HTTP request headers

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

[Back to top]

get_purge_job_log

Signature

get_purge_job_log(purge_id: int, x_request_id: Optional[str])-> str

Get purge job log.

This endpoint let user get purge 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.PurgeApi(harbor_client.ApiClient(configuration))
purge_id = 789 # int | The ID of the purge log
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Get purge job log.
    api_response = api_instance.get_purge_job_log(purge_id, x_request_id=x_request_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling PurgeApi->get_purge_job_log: %s\n" % e)

Parameters

NameTypeDescriptionNotes
purge_idintThe ID of the purge 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_purge_schedule

Signature

get_purge_schedule(x_request_id: Optional[str])-> ExecHistory

Get purge’s schedule.

This endpoint is for get schedule of purge 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.PurgeApi(harbor_client.ApiClient(configuration))
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

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

Parameters

NameTypeDescriptionNotes
x_request_idstrAn unique ID for the request[optional]

Return type

ExecHistory

Authorization

basic

HTTP request headers

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

[Back to top]

stop_purge

Signature

stop_purge(purge_id: int, x_request_id: Optional[str])-> None

Stop the specific purge audit log execution

Stop the purge audit log 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.PurgeApi(harbor_client.ApiClient(configuration))
purge_id = 789 # int | The ID of the purge log
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Stop the specific purge audit log execution
    api_instance.stop_purge(purge_id, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling PurgeApi->stop_purge: %s\n" % e)

Parameters

NameTypeDescriptionNotes
purge_idintThe ID of the purge 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_purge_schedule

Signature

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

Update purge job’s schedule.

This endpoint is for update purge job 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.PurgeApi(harbor_client.ApiClient(configuration))
schedule = harbor_client.Schedule() # Schedule | The purge job's schedule, it is a json object. | The sample format is | {\"parameters\":{\"audit_retention_hour\":168,\"dry_run\":true, \"include_operations\":\"create,delete,pull\"},\"schedule\":{\"type\":\"Hourly\",\"cron\":\"0 0 * * * *\"}} | the include_operation should be a comma separated string, e.g. create,delete,pull, if it is empty, no operation will be purged. 
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

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

Parameters

NameTypeDescriptionNotes
scheduleScheduleThe purge job's schedule, it is a json object. | The sample format is | {"parameters":{"audit_retention_hour":168,"dry_run":true, "include_operations":"create,delete,pull"},"schedule":{"type":"Hourly","cron":"0 0 * * * *"}} | the include_operation should be a comma separated string, e.g. create,delete,pull, if it is empty, no operation will be purged.
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]