Skip to content

Latest commit

 

History

History
239 lines (176 loc) · 9.45 KB

RepositoryApi.md

File metadata and controls

239 lines (176 loc) · 9.45 KB

harbor.RepositoryApi

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

Method HTTP request Description
delete_repository DELETE /projects/{project_name}/repositories/{repository_name} Delete repository
get_repository GET /projects/{project_name}/repositories/{repository_name} Get repository
list_repositories GET /projects/{project_name}/repositories List repositories
update_repository PUT /projects/{project_name}/repositories/{repository_name} Update repository

delete_repository

delete_repository(project_name, repository_name, x_request_id=x_request_id)

Delete repository

Delete the repository specified by name

Example

from __future__ import print_function
import time
import harbor
from harbor.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = harbor.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = harbor.RepositoryApi(harbor.ApiClient(configuration))
project_name = 'project_name_example' # str | The name of the project
repository_name = 'repository_name_example' # str | The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Delete repository
    api_instance.delete_repository(project_name, repository_name, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling RepositoryApi->delete_repository: %s\n" % e)

Parameters

Name Type Description Notes
project_name str The name of the project
repository_name str The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
x_request_id str An unique ID for the request [optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_repository

Repository get_repository(project_name, repository_name, x_request_id=x_request_id)

Get repository

Get the repository specified by name

Example

from __future__ import print_function
import time
import harbor
from harbor.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = harbor.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = harbor.RepositoryApi(harbor.ApiClient(configuration))
project_name = 'project_name_example' # str | The name of the project
repository_name = 'repository_name_example' # str | The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Get repository
    api_response = api_instance.get_repository(project_name, repository_name, x_request_id=x_request_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling RepositoryApi->get_repository: %s\n" % e)

Parameters

Name Type Description Notes
project_name str The name of the project
repository_name str The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
x_request_id str An unique ID for the request [optional]

Return type

Repository

Authorization

basic

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_repositories

list[Repository] list_repositories(project_name, x_request_id=x_request_id, q=q, page=page, page_size=page_size)

List repositories

List repositories of the specified project

Example

from __future__ import print_function
import time
import harbor
from harbor.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = harbor.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = harbor.RepositoryApi(harbor.ApiClient(configuration))
project_name = 'project_name_example' # str | The name of the project
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)
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 repositories
    api_response = api_instance.list_repositories(project_name, x_request_id=x_request_id, q=q, page=page, page_size=page_size)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling RepositoryApi->list_repositories: %s\n" % e)

Parameters

Name Type Description Notes
project_name str The name of the project
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=[minmax])", "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=[minmax] [optional]
page int The page number [optional] [default to 1]
page_size int The size of per page [optional] [default to 10]

Return type

list[Repository]

Authorization

basic

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

update_repository

update_repository(body, project_name, repository_name, x_request_id=x_request_id)

Update repository

Update the repository specified by name

Example

from __future__ import print_function
import time
import harbor
from harbor.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = harbor.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = harbor.RepositoryApi(harbor.ApiClient(configuration))
body = harbor.Repository() # Repository | The JSON object of repository.
project_name = 'project_name_example' # str | The name of the project
repository_name = 'repository_name_example' # str | The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Update repository
    api_instance.update_repository(body, project_name, repository_name, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling RepositoryApi->update_repository: %s\n" % e)

Parameters

Name Type Description Notes
body Repository The JSON object of repository.
project_name str The name of the project
repository_name str The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
x_request_id str An 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] [Back to API list] [Back to Model list] [Back to README]