Skip to content

container-registry/harbor-api-client

Repository files navigation

harbor_client

These APIs provide services for manipulating Harbor project.

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 2.0
  • Package version: 2.7.0
  • Build package: io.swagger.codegen.languages.PythonClientCodegen

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import harbor_client 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import harbor_client

Getting Started

Please follow the installation procedure and then run the following:

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.LdapApi(harbor_client.ApiClient(configuration))
uid_list = harbor_client.LdapImportUsers() # LdapImportUsers | The uid listed for importing. This list will check users validity of ldap service based on configuration from the system.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Import selected available ldap users.
    api_instance.import_ldap_user(uid_list, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling LdapApi->import_ldap_user: %s\n" % e)

Documentation for API Endpoints

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

Class Method HTTP request Description
LdapApi import_ldap_user POST /ldap/users/import Import selected available ldap users.
LdapApi ping_ldap POST /ldap/ping Ping available ldap service.
LdapApi search_ldap_group GET /ldap/groups/search Search available ldap groups.
LdapApi search_ldap_user GET /ldap/users/search Search available ldap users.
RetentionApi create_retention POST /retentions Create Retention Policy
RetentionApi delete_retention DELETE /retentions/{id} Delete Retention Policy
RetentionApi get_rentenition_metadata GET /retentions/metadatas Get Retention Metadatas
RetentionApi get_retention GET /retentions/{id} Get Retention Policy
RetentionApi get_retention_task_log GET /retentions/{id}/executions/{eid}/tasks/{tid} Get Retention job task log
RetentionApi list_retention_executions GET /retentions/{id}/executions Get Retention executions
RetentionApi list_retention_tasks GET /retentions/{id}/executions/{eid}/tasks Get Retention tasks
RetentionApi operate_retention_execution PATCH /retentions/{id}/executions/{eid} Stop a Retention execution
RetentionApi trigger_retention_execution POST /retentions/{id}/executions Trigger a Retention Execution
RetentionApi update_retention PUT /retentions/{id} Update Retention Policy
SystemCVEAllowlistApi get_system_cve_allowlist GET /system/CVEAllowlist Get the system level allowlist of CVE.
SystemCVEAllowlistApi put_system_cve_allowlist PUT /system/CVEAllowlist Update the system level allowlist of CVE.
ArtifactApi add_label POST /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/labels Add label to artifact
ArtifactApi copy_artifact POST /projects/{project_name}/repositories/{repository_name}/artifacts Copy artifact
ArtifactApi create_tag POST /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tags Create tag
ArtifactApi delete_artifact DELETE /projects/{project_name}/repositories/{repository_name}/artifacts/{reference} Delete the specific artifact
ArtifactApi delete_tag DELETE /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tags/{tag_name} Delete tag
ArtifactApi get_addition GET /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/additions/{addition} Get the addition of the specific artifact
ArtifactApi get_artifact GET /projects/{project_name}/repositories/{repository_name}/artifacts/{reference} Get the specific artifact
ArtifactApi get_vulnerabilities_addition GET /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/additions/vulnerabilities Get the vulnerabilities addition of the specific artifact
ArtifactApi list_accessories GET /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/accessories List accessories
ArtifactApi list_artifacts GET /projects/{project_name}/repositories/{repository_name}/artifacts List artifacts
ArtifactApi list_tags GET /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tags List tags
ArtifactApi remove_label DELETE /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/labels/{label_id} Remove label from artifact
AuditlogApi list_audit_logs GET /audit-logs Get recent logs of the projects which the user is a member of
ConfigureApi get_configurations GET /configurations Get system configurations.
ConfigureApi get_internalconfig GET /internalconfig Get internal configurations.
ConfigureApi update_configurations PUT /configurations Modify system configurations.
GcApi create_gc_schedule POST /system/gc/schedule Create a gc schedule.
GcApi get_gc GET /system/gc/{gc_id} Get gc status.
GcApi get_gc_history GET /system/gc Get gc results.
GcApi get_gc_log GET /system/gc/{gc_id}/log Get gc job log.
GcApi get_gc_schedule GET /system/gc/schedule Get gc's schedule.
GcApi stop_gc PUT /system/gc/{gc_id} Stop the specific GC execution
GcApi update_gc_schedule PUT /system/gc/schedule Update gc's schedule.
HealthApi get_health GET /health Check the status of Harbor components
IconApi get_icon GET /icons/{digest} Get artifact icon
ImmutableApi create_immu_rule POST /projects/{project_name_or_id}/immutabletagrules Add an immutable tag rule to current project
ImmutableApi delete_immu_rule DELETE /projects/{project_name_or_id}/immutabletagrules/{immutable_rule_id} Delete the immutable tag rule.
ImmutableApi list_immu_rules GET /projects/{project_name_or_id}/immutabletagrules List all immutable tag rules of current project
ImmutableApi update_immu_rule PUT /projects/{project_name_or_id}/immutabletagrules/{immutable_rule_id} Update the immutable tag rule or enable or disable the rule
JobserviceApi action_pending_jobs PUT /jobservice/queues/{job_type} stop and clean, pause, resume pending jobs in the queue
JobserviceApi get_worker_pools GET /jobservice/pools Get worker pools
JobserviceApi get_workers GET /jobservice/pools/{pool_id}/workers Get workers
JobserviceApi list_job_queues GET /jobservice/queues list job queues
JobserviceApi stop_running_job PUT /jobservice/jobs/{job_id} Stop running job
LabelApi create_label POST /labels Post creates a label
LabelApi delete_label DELETE /labels/{label_id} Delete the label specified by ID.
LabelApi get_label_by_id GET /labels/{label_id} Get the label specified by ID.
LabelApi list_labels GET /labels List labels according to the query strings.
LabelApi update_label PUT /labels/{label_id} Update the label properties.
MemberApi create_project_member POST /projects/{project_name_or_id}/members Create project member
MemberApi delete_project_member DELETE /projects/{project_name_or_id}/members/{mid} Delete project member
MemberApi get_project_member GET /projects/{project_name_or_id}/members/{mid} Get the project member information
MemberApi list_project_members GET /projects/{project_name_or_id}/members Get all project member information
MemberApi update_project_member PUT /projects/{project_name_or_id}/members/{mid} Update project member
OidcApi ping_oidc POST /system/oidc/ping Test the OIDC endpoint.
PingApi get_ping GET /ping Ping Harbor to check if it's alive.
PreheatApi create_instance POST /p2p/preheat/instances Create p2p provider instances
PreheatApi create_policy POST /projects/{project_name}/preheat/policies Create a preheat policy under a project
PreheatApi delete_instance DELETE /p2p/preheat/instances/{preheat_instance_name} Delete the specified P2P provider instance
PreheatApi delete_policy DELETE /projects/{project_name}/preheat/policies/{preheat_policy_name} Delete a preheat policy
PreheatApi get_execution GET /projects/{project_name}/preheat/policies/{preheat_policy_name}/executions/{execution_id} Get a execution detail by id
PreheatApi get_instance GET /p2p/preheat/instances/{preheat_instance_name} Get a P2P provider instance
PreheatApi get_policy GET /projects/{project_name}/preheat/policies/{preheat_policy_name} Get a preheat policy
PreheatApi get_preheat_log GET /projects/{project_name}/preheat/policies/{preheat_policy_name}/executions/{execution_id}/tasks/{task_id}/logs Get the log text stream of the specified task for the given execution
PreheatApi list_executions GET /projects/{project_name}/preheat/policies/{preheat_policy_name}/executions List executions for the given policy
PreheatApi list_instances GET /p2p/preheat/instances List P2P provider instances
PreheatApi list_policies GET /projects/{project_name}/preheat/policies List preheat policies
PreheatApi list_providers GET /p2p/preheat/providers List P2P providers
PreheatApi list_providers_under_project GET /projects/{project_name}/preheat/providers Get all providers at project level
PreheatApi list_tasks GET /projects/{project_name}/preheat/policies/{preheat_policy_name}/executions/{execution_id}/tasks List all the related tasks for the given execution
PreheatApi manual_preheat POST /projects/{project_name}/preheat/policies/{preheat_policy_name} Manual preheat
PreheatApi ping_instances POST /p2p/preheat/instances/ping Ping status of a instance.
PreheatApi stop_execution PATCH /projects/{project_name}/preheat/policies/{preheat_policy_name}/executions/{execution_id} Stop a execution
PreheatApi update_instance PUT /p2p/preheat/instances/{preheat_instance_name} Update the specified P2P provider instance
PreheatApi update_policy PUT /projects/{project_name}/preheat/policies/{preheat_policy_name} Update preheat policy
ProjectApi create_project POST /projects Create a new project.
ProjectApi delete_project DELETE /projects/{project_name_or_id} Delete project by projectID
ProjectApi get_logs GET /projects/{project_name}/logs Get recent logs of the projects
ProjectApi get_project GET /projects/{project_name_or_id} Return specific project detail information
ProjectApi get_project_deletable GET /projects/{project_name_or_id}/_deletable Get the deletable status of the project
ProjectApi get_project_summary GET /projects/{project_name_or_id}/summary Get summary of the project.
ProjectApi get_scanner_of_project GET /projects/{project_name_or_id}/scanner Get project level scanner
ProjectApi head_project HEAD /projects Check if the project name user provided already exists.
ProjectApi list_projects GET /projects List projects
ProjectApi list_scanner_candidates_of_project GET /projects/{project_name_or_id}/scanner/candidates Get scanner registration candidates for configurating project level scanner
ProjectApi set_scanner_of_project PUT /projects/{project_name_or_id}/scanner Configure scanner for the specified project
ProjectApi update_project PUT /projects/{project_name_or_id} Update properties for a selected project.
ProjectMetadataApi add_project_metadatas POST /projects/{project_name_or_id}/metadatas/ Add metadata for the specific project
ProjectMetadataApi delete_project_metadata DELETE /projects/{project_name_or_id}/metadatas/{meta_name} Delete the specific metadata for the specific project
ProjectMetadataApi get_project_metadata GET /projects/{project_name_or_id}/metadatas/{meta_name} Get the specific metadata of the specific project
ProjectMetadataApi list_project_metadatas GET /projects/{project_name_or_id}/metadatas/ Get the metadata of the specific project
ProjectMetadataApi update_project_metadata PUT /projects/{project_name_or_id}/metadatas/{meta_name} Update the specific metadata for the specific project
PurgeApi create_purge_schedule POST /system/purgeaudit/schedule Create a purge job schedule.
PurgeApi get_purge_history GET /system/purgeaudit Get purge job results.
PurgeApi get_purge_job GET /system/purgeaudit/{purge_id} Get purge job status.
PurgeApi get_purge_job_log GET /system/purgeaudit/{purge_id}/log Get purge job log.
PurgeApi get_purge_schedule GET /system/purgeaudit/schedule Get purge's schedule.
PurgeApi stop_purge PUT /system/purgeaudit/{purge_id} Stop the specific purge audit log execution
PurgeApi update_purge_schedule PUT /system/purgeaudit/schedule Update purge job's schedule.
QuotaApi get_quota GET /quotas/{id} Get the specified quota
QuotaApi list_quotas GET /quotas List quotas
QuotaApi update_quota PUT /quotas/{id} Update the specified quota
RegistryApi create_registry POST /registries Create a registry
RegistryApi delete_registry DELETE /registries/{id} Delete the specific registry
RegistryApi get_registry GET /registries/{id} Get the specific registry
RegistryApi get_registry_info GET /registries/{id}/info Get the registry info
RegistryApi list_registries GET /registries List the registries
RegistryApi list_registry_provider_infos GET /replication/adapterinfos List all registered registry provider information
RegistryApi list_registry_provider_types GET /replication/adapters List registry adapters
RegistryApi ping_registry POST /registries/ping Check status of a registry
RegistryApi update_registry PUT /registries/{id} Update the registry
ReplicationApi create_replication_policy POST /replication/policies Create a replication policy
ReplicationApi delete_replication_policy DELETE /replication/policies/{id} Delete the specific replication policy
ReplicationApi get_replication_execution GET /replication/executions/{id} Get the specific replication execution
ReplicationApi get_replication_log GET /replication/executions/{id}/tasks/{task_id}/log Get the log of the specific replication task
ReplicationApi get_replication_policy GET /replication/policies/{id} Get the specific replication policy
ReplicationApi list_replication_executions GET /replication/executions List replication executions
ReplicationApi list_replication_policies GET /replication/policies List replication policies
ReplicationApi list_replication_tasks GET /replication/executions/{id}/tasks List replication tasks for a specific execution
ReplicationApi start_replication POST /replication/executions Start one replication execution
ReplicationApi stop_replication PUT /replication/executions/{id} Stop the specific replication execution
ReplicationApi update_replication_policy PUT /replication/policies/{id} Update the replication policy
RepositoryApi delete_repository DELETE /projects/{project_name}/repositories/{repository_name} Delete repository
RepositoryApi get_repository GET /projects/{project_name}/repositories/{repository_name} Get repository
RepositoryApi list_all_repositories GET /repositories List all authorized repositories
RepositoryApi list_repositories GET /projects/{project_name}/repositories List repositories
RepositoryApi update_repository PUT /projects/{project_name}/repositories/{repository_name} Update repository
RobotApi create_robot POST /robots Create a robot account
RobotApi delete_robot DELETE /robots/{robot_id} Delete a robot account
RobotApi get_robot_by_id GET /robots/{robot_id} Get a robot account
RobotApi list_robot GET /robots Get robot account
RobotApi refresh_sec PATCH /robots/{robot_id} Refresh the robot secret
RobotApi update_robot PUT /robots/{robot_id} Update a robot account
Robotv1Api create_robot_v1 POST /projects/{project_name_or_id}/robots Create a robot account
Robotv1Api delete_robot_v1 DELETE /projects/{project_name_or_id}/robots/{robot_id} Delete a robot account
Robotv1Api get_robot_by_idv1 GET /projects/{project_name_or_id}/robots/{robot_id} Get a robot account
Robotv1Api list_robot_v1 GET /projects/{project_name_or_id}/robots Get all robot accounts of specified project
Robotv1Api update_robot_v1 PUT /projects/{project_name_or_id}/robots/{robot_id} Update status of robot account.
ScanApi get_report_log GET /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/scan/{report_id}/log Get the log of the scan report
ScanApi scan_artifact POST /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/scan Scan the artifact
ScanApi stop_scan_artifact POST /projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/scan/stop Cancelling a scan job for a particular artifact
ScanAllApi create_scan_all_schedule POST /system/scanAll/schedule Create a schedule or a manual trigger for the scan all job.
ScanAllApi get_latest_scan_all_metrics GET /scans/all/metrics Get the metrics of the latest scan all process
ScanAllApi get_latest_scheduled_scan_all_metrics GET /scans/schedule/metrics Get the metrics of the latest scheduled scan all process
ScanAllApi get_scan_all_schedule GET /system/scanAll/schedule Get scan all's schedule.
ScanAllApi stop_scan_all POST /system/scanAll/stop Stop scanAll job execution
ScanAllApi update_scan_all_schedule PUT /system/scanAll/schedule Update scan all's schedule.
ScanDataExportApi download_scan_data GET /export/cve/download/{execution_id} Download the scan data export file
ScanDataExportApi export_scan_data POST /export/cve Export scan data for selected projects
ScanDataExportApi get_scan_data_export_execution GET /export/cve/execution/{execution_id} Get the specific scan data export execution
ScanDataExportApi get_scan_data_export_execution_list GET /export/cve/executions Get a list of specific scan data export execution jobs for a specified user
ScannerApi create_scanner POST /scanners Create a scanner registration
ScannerApi delete_scanner DELETE /scanners/{registration_id} Delete a scanner registration
ScannerApi get_scanner GET /scanners/{registration_id} Get a scanner registration details
ScannerApi get_scanner_metadata GET /scanners/{registration_id}/metadata Get the metadata of the specified scanner registration
ScannerApi list_scanners GET /scanners List scanner registrations
ScannerApi ping_scanner POST /scanners/ping Tests scanner registration settings
ScannerApi set_scanner_as_default PATCH /scanners/{registration_id} Set system default scanner registration
ScannerApi update_scanner PUT /scanners/{registration_id} Update a scanner registration
ScheduleApi get_schedule_paused GET /schedules/{job_type}/paused
ScheduleApi list_schedules GET /schedules
SearchApi search GET /search Search for projects, repositories and helm charts
StatisticApi get_statistic GET /statistics Get the statistic information about the projects and repositories
SysteminfoApi get_cert GET /systeminfo/getcert Get default root certificate.
SysteminfoApi get_system_info GET /systeminfo Get general system info
SysteminfoApi get_volumes GET /systeminfo/volumes Get system volume info (total/free size).
UserApi create_user POST /users Create a local user.
UserApi delete_user DELETE /users/{user_id} Mark a registered user as be removed.
UserApi get_current_user_info GET /users/current Get current user info.
UserApi get_current_user_permissions GET /users/current/permissions Get current user permissions.
UserApi get_user GET /users/{user_id} Get a user's profile.
UserApi list_users GET /users List users
UserApi search_users GET /users/search Search users by username
UserApi set_cli_secret PUT /users/{user_id}/cli_secret Set CLI secret for a user.
UserApi set_user_sys_admin PUT /users/{user_id}/sysadmin Update a registered user to change to be an administrator of Harbor.
UserApi update_user_password PUT /users/{user_id}/password Change the password on a user that already exists.
UserApi update_user_profile PUT /users/{user_id} Update user's profile.
UsergroupApi create_user_group POST /usergroups Create user group
UsergroupApi delete_user_group DELETE /usergroups/{group_id} Delete user group
UsergroupApi get_user_group GET /usergroups/{group_id} Get user group information
UsergroupApi list_user_groups GET /usergroups Get all user groups information
UsergroupApi search_user_groups GET /usergroups/search Search groups by groupname
UsergroupApi update_user_group PUT /usergroups/{group_id} Update group information
WebhookApi create_webhook_policy_of_project POST /projects/{project_name_or_id}/webhook/policies Create project webhook policy.
WebhookApi delete_webhook_policy_of_project DELETE /projects/{project_name_or_id}/webhook/policies/{webhook_policy_id} Delete webhook policy of a project
WebhookApi get_supported_event_types GET /projects/{project_name_or_id}/webhook/events Get supported event types and notify types.
WebhookApi get_webhook_policy_of_project GET /projects/{project_name_or_id}/webhook/policies/{webhook_policy_id} Get project webhook policy
WebhookApi last_trigger GET /projects/{project_name_or_id}/webhook/lasttrigger Get project webhook policy last trigger info
WebhookApi list_webhook_policies_of_project GET /projects/{project_name_or_id}/webhook/policies List project webhook policies.
WebhookApi update_webhook_policy_of_project PUT /projects/{project_name_or_id}/webhook/policies/{webhook_policy_id} Update webhook policy of a project.
WebhookjobApi list_webhook_jobs GET /projects/{project_name_or_id}/webhook/jobs List project webhook jobs

Documentation For Models

Documentation For Authorization

basic

  • Type: HTTP basic authentication

Author