harbor_client.ArtifactApi

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

MethodHTTP requestDescription
add_labelPOST /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/labelsAdd label to artifact
copy_artifactPOST /projects/{project_name}/repositories/{repository_name}/artifactsCopy artifact
create_tagPOST /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tagsCreate tag
delete_artifactDELETE /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}Delete the specific artifact
delete_tagDELETE /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tags/{tag_name}Delete tag
get_additionGET /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/additions/{addition}Get the addition of the specific artifact
get_artifactGET /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}Get the specific artifact
get_vulnerabilities_additionGET /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/additions/vulnerabilitiesGet the vulnerabilities addition of the specific artifact
list_accessoriesGET /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/accessoriesList accessories
list_artifactsGET /projects/{project_name}/repositories/{repository_name}/artifactsList artifacts
list_tagsGET /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tagsList tags
remove_labelDELETE /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/labels/{label_id}Remove label from artifact

add_label

Signature

add_label(project_name: str, repository_name: str, reference: str, label: Label, x_request_id: Optional[str])-> None

Add label to artifact

Add label to the specified artiact.

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.ArtifactApi(harbor_client.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
reference = 'reference_example' # str | The reference of the artifact, can be digest or tag
label = harbor_client.Label() # Label | The label that added to the artifact. Only the ID property is needed.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Add label to artifact
    api_instance.add_label(project_name, repository_name, reference, label, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling ArtifactApi->add_label: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_namestrThe name of the project
repository_namestrThe name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
referencestrThe reference of the artifact, can be digest or tag
labelLabelThe label that added to the artifact. Only the ID property is needed.
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]

copy_artifact

Signature

copy_artifact(project_name: str, repository_name: str, _from: str, x_request_id: Optional[str])-> None

Copy artifact

Copy the artifact specified in the "from" parameter to the repository.

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.ArtifactApi(harbor_client.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
_from = '_from_example' # str | The artifact from which the new artifact is copied from, the format should be \"project/repository:tag\" or \"project/repository@digest\".
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Copy artifact
    api_instance.copy_artifact(project_name, repository_name, _from, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling ArtifactApi->copy_artifact: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_namestrThe name of the project
repository_namestrThe name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
_fromstrThe artifact from which the new artifact is copied from, the format should be "project/repository:tag" or "project/repository@digest".
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]

create_tag

Signature

create_tag(project_name: str, repository_name: str, reference: str, tag: Tag, x_request_id: Optional[str])-> None

Create tag

Create a tag for the specified artifact

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.ArtifactApi(harbor_client.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
reference = 'reference_example' # str | The reference of the artifact, can be digest or tag
tag = harbor_client.Tag() # Tag | The JSON object of tag.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Create tag
    api_instance.create_tag(project_name, repository_name, reference, tag, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling ArtifactApi->create_tag: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_namestrThe name of the project
repository_namestrThe name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
referencestrThe reference of the artifact, can be digest or tag
tagTagThe JSON object of tag.
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_artifact

Signature

delete_artifact(project_name: str, repository_name: str, reference: str, x_request_id: Optional[str])-> None

Delete the specific artifact

Delete the artifact specified by the reference under the project and repository. The reference can be digest or tag

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.ArtifactApi(harbor_client.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
reference = 'reference_example' # str | The reference of the artifact, can be digest or tag
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Delete the specific artifact
    api_instance.delete_artifact(project_name, repository_name, reference, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling ArtifactApi->delete_artifact: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_namestrThe name of the project
repository_namestrThe name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
referencestrThe reference of the artifact, can be digest or tag
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_tag

Signature

delete_tag(project_name: str, repository_name: str, reference: str, tag_name: str, x_request_id: Optional[str])-> None

Delete tag

Delete the tag of the specified artifact

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.ArtifactApi(harbor_client.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
reference = 'reference_example' # str | The reference of the artifact, can be digest or tag
tag_name = 'tag_name_example' # str | The name of the tag
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Delete tag
    api_instance.delete_tag(project_name, repository_name, reference, tag_name, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling ArtifactApi->delete_tag: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_namestrThe name of the project
repository_namestrThe name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
referencestrThe reference of the artifact, can be digest or tag
tag_namestrThe name of the tag
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_addition

Signature

get_addition(project_name: str, repository_name: str, reference: str, addition: str, x_request_id: Optional[str])-> str

Get the addition of the specific artifact

Get the addition of the artifact specified by the reference under the project and repository.

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.ArtifactApi(harbor_client.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
reference = 'reference_example' # str | The reference of the artifact, can be digest or tag
addition = 'addition_example' # str | The type of addition.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Get the addition of the specific artifact
    api_response = api_instance.get_addition(project_name, repository_name, reference, addition, x_request_id=x_request_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ArtifactApi->get_addition: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_namestrThe name of the project
repository_namestrThe name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
referencestrThe reference of the artifact, can be digest or tag
additionstrThe type of addition.
x_request_idstrAn unique ID for the request[optional]

Return type

str

Authorization

basic

HTTP request headers

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

[Back to top]

get_artifact

Signature

get_artifact(project_name: str, repository_name: str, reference: str, x_request_id: Optional[str], page: Optional[int], page_size: Optional[int], x_accept_vulnerabilities: Optional[str], with_tag: Optional[bool], with_label: Optional[bool], with_scan_overview: Optional[bool], with_accessory: Optional[bool], with_signature: Optional[bool], with_immutable_status: Optional[bool])-> Artifact

Get the specific artifact

Get the artifact specified by the reference under the project and repository. The reference can be digest or tag.

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.ArtifactApi(harbor_client.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
reference = 'reference_example' # str | The reference of the artifact, can be digest or tag
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
page = 1 # int | The page number (optional) (default to 1)
page_size = 10 # int | The size of per page (optional) (default to 10)
x_accept_vulnerabilities = 'application/vnd.security.vulnerability.report; version=1.1, application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0' # str | A comma-separated lists of MIME types for the scan report or scan summary. The first mime type will be used when the report found for it. Currently the mime type supports 'application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0' and 'application/vnd.security.vulnerability.report; version=1.1' (optional) (default to application/vnd.security.vulnerability.report; version=1.1, application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0)
with_tag = true # bool | Specify whether the tags are inclued inside the returning artifacts (optional) (default to true)
with_label = false # bool | Specify whether the labels are inclued inside the returning artifacts (optional) (default to false)
with_scan_overview = false # bool | Specify whether the scan overview is inclued inside the returning artifacts (optional) (default to false)
with_accessory = false # bool | Specify whether the accessories are included of the returning artifacts. (optional) (default to false)
with_signature = false # bool | Specify whether the signature is inclued inside the returning artifacts (optional) (default to false)
with_immutable_status = false # bool | Specify whether the immutable status is inclued inside the tags of the returning artifacts. (optional) (default to false)

try:
    # Get the specific artifact
    api_response = api_instance.get_artifact(project_name, repository_name, reference, x_request_id=x_request_id, page=page, page_size=page_size, x_accept_vulnerabilities=x_accept_vulnerabilities, with_tag=with_tag, with_label=with_label, with_scan_overview=with_scan_overview, with_accessory=with_accessory, with_signature=with_signature, with_immutable_status=with_immutable_status)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ArtifactApi->get_artifact: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_namestrThe name of the project
repository_namestrThe name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
referencestrThe reference of the artifact, can be digest or tag
x_request_idstrAn unique ID for the request[optional]
pageintThe page number[optional] [default to 1]
page_sizeintThe size of per page[optional] [default to 10]
x_accept_vulnerabilitiesstrA comma-separated lists of MIME types for the scan report or scan summary. The first mime type will be used when the report found for it. Currently the mime type supports 'application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0' and 'application/vnd.security.vulnerability.report; version=1.1'[optional] [default to application/vnd.security.vulnerability.report; version=1.1, application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0]
with_tagboolSpecify whether the tags are inclued inside the returning artifacts[optional] [default to true]
with_labelboolSpecify whether the labels are inclued inside the returning artifacts[optional] [default to false]
with_scan_overviewboolSpecify whether the scan overview is inclued inside the returning artifacts[optional] [default to false]
with_accessoryboolSpecify whether the accessories are included of the returning artifacts.[optional] [default to false]
with_signatureboolSpecify whether the signature is inclued inside the returning artifacts[optional] [default to false]
with_immutable_statusboolSpecify whether the immutable status is inclued inside the tags of the returning artifacts.[optional] [default to false]

Return type

Artifact

Authorization

basic

HTTP request headers

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

[Back to top]

get_vulnerabilities_addition

Signature

get_vulnerabilities_addition(project_name: str, repository_name: str, reference: str, x_request_id: Optional[str], x_accept_vulnerabilities: Optional[str])-> str

Get the vulnerabilities addition of the specific artifact

Get the vulnerabilities addition of the artifact specified by the reference under the project and repository.

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.ArtifactApi(harbor_client.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
reference = 'reference_example' # str | The reference of the artifact, can be digest or tag
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
x_accept_vulnerabilities = 'application/vnd.security.vulnerability.report; version=1.1, application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0' # str | A comma-separated lists of MIME types for the scan report or scan summary. The first mime type will be used when the report found for it. Currently the mime type supports 'application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0' and 'application/vnd.security.vulnerability.report; version=1.1' (optional) (default to application/vnd.security.vulnerability.report; version=1.1, application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0)

try:
    # Get the vulnerabilities addition of the specific artifact
    api_response = api_instance.get_vulnerabilities_addition(project_name, repository_name, reference, x_request_id=x_request_id, x_accept_vulnerabilities=x_accept_vulnerabilities)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ArtifactApi->get_vulnerabilities_addition: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_namestrThe name of the project
repository_namestrThe name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
referencestrThe reference of the artifact, can be digest or tag
x_request_idstrAn unique ID for the request[optional]
x_accept_vulnerabilitiesstrA comma-separated lists of MIME types for the scan report or scan summary. The first mime type will be used when the report found for it. Currently the mime type supports 'application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0' and 'application/vnd.security.vulnerability.report; version=1.1'[optional] [default to application/vnd.security.vulnerability.report; version=1.1, application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0]

Return type

str

Authorization

basic

HTTP request headers

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

[Back to top]

list_accessories

Signature

list_accessories(project_name: str, repository_name: str, reference: str, x_request_id: Optional[str], q: Optional[str], sort: Optional[str], page: Optional[int], page_size: Optional[int])-> list[Accessory]

List accessories

List accessories of the specific artifact

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.ArtifactApi(harbor_client.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
reference = 'reference_example' # str | The reference of the artifact, can be digest or tag
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:
    # List accessories
    api_response = api_instance.list_accessories(project_name, repository_name, reference, 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 ArtifactApi->list_accessories: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_namestrThe name of the project
repository_namestrThe name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
referencestrThe reference of the artifact, can be digest or tag
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[Accessory]

Authorization

basic

HTTP request headers

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

[Back to top]

list_artifacts

Signature

list_artifacts(project_name: str, repository_name: str, x_request_id: Optional[str], q: Optional[str], sort: Optional[str], page: Optional[int], page_size: Optional[int], x_accept_vulnerabilities: Optional[str], with_tag: Optional[bool], with_label: Optional[bool], with_scan_overview: Optional[bool], with_signature: Optional[bool], with_immutable_status: Optional[bool], with_accessory: Optional[bool])-> list[Artifact]

List artifacts

List artifacts under the specific project and repository. Except the basic properties, the other supported queries in "q" includes "tags=*" to list only tagged artifacts, "tags=nil" to list only untagged artifacts, "tags=~v" to list artifacts whose tag fuzzy matches "v", "tags=v" to list artifact whose tag exactly matches "v", "labels=(id1, id2)" to list artifacts that both labels with id1 and id2 are added to

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.ArtifactApi(harbor_client.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)
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)
x_accept_vulnerabilities = 'application/vnd.security.vulnerability.report; version=1.1, application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0' # str | A comma-separated lists of MIME types for the scan report or scan summary. The first mime type will be used when the report found for it. Currently the mime type supports 'application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0' and 'application/vnd.security.vulnerability.report; version=1.1' (optional) (default to application/vnd.security.vulnerability.report; version=1.1, application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0)
with_tag = true # bool | Specify whether the tags are included inside the returning artifacts (optional) (default to true)
with_label = false # bool | Specify whether the labels are included inside the returning artifacts (optional) (default to false)
with_scan_overview = false # bool | Specify whether the scan overview is included inside the returning artifacts (optional) (default to false)
with_signature = false # bool | Specify whether the signature is included inside the tags of the returning artifacts. Only works when setting \"with_tag=true\" (optional) (default to false)
with_immutable_status = false # bool | Specify whether the immutable status is included inside the tags of the returning artifacts. Only works when setting \"with_immutable_status=true\" (optional) (default to false)
with_accessory = false # bool | Specify whether the accessories are included of the returning artifacts. Only works when setting \"with_accessory=true\" (optional) (default to false)

try:
    # List artifacts
    api_response = api_instance.list_artifacts(project_name, repository_name, x_request_id=x_request_id, q=q, sort=sort, page=page, page_size=page_size, x_accept_vulnerabilities=x_accept_vulnerabilities, with_tag=with_tag, with_label=with_label, with_scan_overview=with_scan_overview, with_signature=with_signature, with_immutable_status=with_immutable_status, with_accessory=with_accessory)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ArtifactApi->list_artifacts: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_namestrThe name of the project
repository_namestrThe name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
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]
x_accept_vulnerabilitiesstrA comma-separated lists of MIME types for the scan report or scan summary. The first mime type will be used when the report found for it. Currently the mime type supports 'application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0' and 'application/vnd.security.vulnerability.report; version=1.1'[optional] [default to application/vnd.security.vulnerability.report; version=1.1, application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0]
with_tagboolSpecify whether the tags are included inside the returning artifacts[optional] [default to true]
with_labelboolSpecify whether the labels are included inside the returning artifacts[optional] [default to false]
with_scan_overviewboolSpecify whether the scan overview is included inside the returning artifacts[optional] [default to false]
with_signatureboolSpecify whether the signature is included inside the tags of the returning artifacts. Only works when setting "with_tag=true"[optional] [default to false]
with_immutable_statusboolSpecify whether the immutable status is included inside the tags of the returning artifacts. Only works when setting "with_immutable_status=true"[optional] [default to false]
with_accessoryboolSpecify whether the accessories are included of the returning artifacts. Only works when setting "with_accessory=true"[optional] [default to false]

Return type

list[Artifact]

Authorization

basic

HTTP request headers

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

[Back to top]

list_tags

Signature

list_tags(project_name: str, repository_name: str, reference: str, x_request_id: Optional[str], q: Optional[str], sort: Optional[str], page: Optional[int], page_size: Optional[int], with_signature: Optional[bool], with_immutable_status: Optional[bool])-> list[Tag]

List tags

List tags of the specific artifact

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.ArtifactApi(harbor_client.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
reference = 'reference_example' # str | The reference of the artifact, can be digest or tag
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)
with_signature = false # bool | Specify whether the signature is included inside the returning tags (optional) (default to false)
with_immutable_status = false # bool | Specify whether the immutable status is included inside the returning tags (optional) (default to false)

try:
    # List tags
    api_response = api_instance.list_tags(project_name, repository_name, reference, x_request_id=x_request_id, q=q, sort=sort, page=page, page_size=page_size, with_signature=with_signature, with_immutable_status=with_immutable_status)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ArtifactApi->list_tags: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_namestrThe name of the project
repository_namestrThe name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
referencestrThe reference of the artifact, can be digest or tag
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]
with_signatureboolSpecify whether the signature is included inside the returning tags[optional] [default to false]
with_immutable_statusboolSpecify whether the immutable status is included inside the returning tags[optional] [default to false]

Return type

list[Tag]

Authorization

basic

HTTP request headers

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

[Back to top]

remove_label

Signature

remove_label(project_name: str, repository_name: str, reference: str, label_id: int, x_request_id: Optional[str])-> None

Remove label from artifact

Remove the label from the specified artiact.

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.ArtifactApi(harbor_client.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
reference = 'reference_example' # str | The reference of the artifact, can be digest or tag
label_id = 789 # int | The ID of the label that removed from the artifact.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Remove label from artifact
    api_instance.remove_label(project_name, repository_name, reference, label_id, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling ArtifactApi->remove_label: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_namestrThe name of the project
repository_namestrThe name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
referencestrThe reference of the artifact, can be digest or tag
label_idintThe ID of the label that removed from the artifact.
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]