harbor_client.ReplicationApi

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

MethodHTTP requestDescription
create_replication_policyPOST /replication/policiesCreate a replication policy
delete_replication_policyDELETE /replication/policies/{id}Delete the specific replication policy
get_replication_executionGET /replication/executions/{id}Get the specific replication execution
get_replication_logGET /replication/executions/{id}/tasks/{task_id}/logGet the log of the specific replication task
get_replication_policyGET /replication/policies/{id}Get the specific replication policy
list_replication_executionsGET /replication/executionsList replication executions
list_replication_policiesGET /replication/policiesList replication policies
list_replication_tasksGET /replication/executions/{id}/tasksList replication tasks for a specific execution
start_replicationPOST /replication/executionsStart one replication execution
stop_replicationPUT /replication/executions/{id}Stop the specific replication execution
update_replication_policyPUT /replication/policies/{id}Update the replication policy

create_replication_policy

Signature

create_replication_policy(policy: ReplicationPolicy, x_request_id: Optional[str])-> None

Create a replication policy

Create a replication policy

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

try:
    # Create a replication policy
    api_instance.create_replication_policy(policy, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling ReplicationApi->create_replication_policy: %s\n" % e)

Parameters

NameTypeDescriptionNotes
policyReplicationPolicyThe replication policy
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]

delete_replication_policy

Signature

delete_replication_policy(id: int, x_request_id: Optional[str])-> None

Delete the specific replication policy

Delete the specific replication policy

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.ReplicationApi(harbor_client.ApiClient(configuration))
id = 789 # int | Replication policy ID
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Delete the specific replication policy
    api_instance.delete_replication_policy(id, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling ReplicationApi->delete_replication_policy: %s\n" % e)

Parameters

NameTypeDescriptionNotes
idintReplication policy ID
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_replication_execution

Signature

get_replication_execution(id: int, x_request_id: Optional[str])-> ReplicationExecution

Get the specific replication execution

Get the replication 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.ReplicationApi(harbor_client.ApiClient(configuration))
id = 789 # int | The ID of the execution.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Get the specific replication execution
    api_response = api_instance.get_replication_execution(id, x_request_id=x_request_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ReplicationApi->get_replication_execution: %s\n" % e)

Parameters

NameTypeDescriptionNotes
idintThe ID of the execution.
x_request_idstrAn unique ID for the request[optional]

Return type

ReplicationExecution

Authorization

basic

HTTP request headers

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

[Back to top]

get_replication_log

Signature

get_replication_log(id: int, task_id: int, x_request_id: Optional[str])-> str

Get the log of the specific replication task

Get the log of the specific replication task

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.ReplicationApi(harbor_client.ApiClient(configuration))
id = 789 # int | The ID of the execution that the tasks belongs to.
task_id = 789 # int | The ID of the task.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Get the log of the specific replication task
    api_response = api_instance.get_replication_log(id, task_id, x_request_id=x_request_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ReplicationApi->get_replication_log: %s\n" % e)

Parameters

NameTypeDescriptionNotes
idintThe ID of the execution that the tasks belongs to.
task_idintThe ID of the task.
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_replication_policy

Signature

get_replication_policy(id: int, x_request_id: Optional[str])-> ReplicationPolicy

Get the specific replication policy

Get the specific replication policy

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

try:
    # Get the specific replication policy
    api_response = api_instance.get_replication_policy(id, x_request_id=x_request_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ReplicationApi->get_replication_policy: %s\n" % e)

Parameters

NameTypeDescriptionNotes
idintPolicy ID
x_request_idstrAn unique ID for the request[optional]

Return type

ReplicationPolicy

Authorization

basic

HTTP request headers

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

[Back to top]

list_replication_executions

Signature

list_replication_executions(x_request_id: Optional[str], sort: Optional[str], page: Optional[int], page_size: Optional[int], policy_id: Optional[int], status: Optional[str], trigger: Optional[str])-> list[ReplicationExecution]

List replication executions

List replication executions

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.ReplicationApi(harbor_client.ApiClient(configuration))
x_request_id = 'x_request_id_example' # str | An unique ID for the request (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)
policy_id = 56 # int | The ID of the policy that the executions belong to. (optional)
status = 'status_example' # str | The execution status. (optional)
trigger = 'trigger_example' # str | The trigger mode. (optional)

try:
    # List replication executions
    api_response = api_instance.list_replication_executions(x_request_id=x_request_id, sort=sort, page=page, page_size=page_size, policy_id=policy_id, status=status, trigger=trigger)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ReplicationApi->list_replication_executions: %s\n" % e)

Parameters

NameTypeDescriptionNotes
x_request_idstrAn unique ID for the request[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]
policy_idintThe ID of the policy that the executions belong to.[optional]
statusstrThe execution status.[optional]
triggerstrThe trigger mode.[optional]

Return type

list[ReplicationExecution]

Authorization

basic

HTTP request headers

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

[Back to top]

list_replication_policies

Signature

list_replication_policies(x_request_id: Optional[str], q: Optional[str], sort: Optional[str], page: Optional[int], page_size: Optional[int], name: Optional[str])-> list[ReplicationPolicy]

List replication policies

List replication policies

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.ReplicationApi(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)
name = 'name_example' # str | Deprecated, use \"query\" instead. The policy name. (optional)

try:
    # List replication policies
    api_response = api_instance.list_replication_policies(x_request_id=x_request_id, q=q, sort=sort, page=page, page_size=page_size, name=name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ReplicationApi->list_replication_policies: %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]
namestrDeprecated, use "query" instead. The policy name.[optional]

Return type

list[ReplicationPolicy]

Authorization

basic

HTTP request headers

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

[Back to top]

list_replication_tasks

Signature

list_replication_tasks(id: int, x_request_id: Optional[str], sort: Optional[str], page: Optional[int], page_size: Optional[int], status: Optional[str], resource_type: Optional[str])-> list[ReplicationTask]

List replication tasks for a specific execution

List replication tasks for a specific execution

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.ReplicationApi(harbor_client.ApiClient(configuration))
id = 789 # int | The ID of the execution that the tasks belongs to.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (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)
status = 'status_example' # str | The task status. (optional)
resource_type = 'resource_type_example' # str | The resource type. (optional)

try:
    # List replication tasks for a specific execution
    api_response = api_instance.list_replication_tasks(id, x_request_id=x_request_id, sort=sort, page=page, page_size=page_size, status=status, resource_type=resource_type)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ReplicationApi->list_replication_tasks: %s\n" % e)

Parameters

NameTypeDescriptionNotes
idintThe ID of the execution that the tasks belongs to.
x_request_idstrAn unique ID for the request[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]
statusstrThe task status.[optional]
resource_typestrThe resource type.[optional]

Return type

list[ReplicationTask]

Authorization

basic

HTTP request headers

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

[Back to top]

start_replication

Signature

start_replication(execution: StartReplicationExecution, x_request_id: Optional[str])-> None

Start one replication execution

Start one replication execution according to the policy

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.ReplicationApi(harbor_client.ApiClient(configuration))
execution = harbor_client.StartReplicationExecution() # StartReplicationExecution | The ID of policy that the execution belongs to
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Start one replication execution
    api_instance.start_replication(execution, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling ReplicationApi->start_replication: %s\n" % e)

Parameters

NameTypeDescriptionNotes
executionStartReplicationExecutionThe ID of policy that the execution belongs to
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]

stop_replication

Signature

stop_replication(id: int, x_request_id: Optional[str])-> None

Stop the specific replication execution

Stop the replication 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.ReplicationApi(harbor_client.ApiClient(configuration))
id = 789 # int | The ID of the execution.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Stop the specific replication execution
    api_instance.stop_replication(id, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling ReplicationApi->stop_replication: %s\n" % e)

Parameters

NameTypeDescriptionNotes
idintThe ID of the execution.
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_replication_policy

Signature

update_replication_policy(id: int, policy: ReplicationPolicy, x_request_id: Optional[str])-> None

Update the replication policy

Update the replication policy

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.ReplicationApi(harbor_client.ApiClient(configuration))
id = 789 # int | The policy ID
policy = harbor_client.ReplicationPolicy() # ReplicationPolicy | The replication policy
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Update the replication policy
    api_instance.update_replication_policy(id, policy, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling ReplicationApi->update_replication_policy: %s\n" % e)

Parameters

NameTypeDescriptionNotes
idintThe policy ID
policyReplicationPolicyThe replication policy
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]