Skip to content

liger1978/ruby-harbor2_client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

harbor2_client

Harbor2Client - the Ruby gem for the Harbor API

These APIs provide services for manipulating Harbor project.

This SDK is automatically generated by the Swagger Codegen project:

  • API version: 2.0
  • Package version: 2.3.3.4
  • Build package: io.swagger.codegen.languages.RubyClientCodegen

Installation

Build a gem

To build the Ruby code into a gem:

gem build harbor2_client.gemspec

Then either install the gem locally:

gem install ./harbor2_client-2.3.3.4.gem

(for development, run gem install --dev ./harbor2_client-2.3.3.4.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'harbor2_client', '~> 2.3.3.4'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'harbor2_client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'harbor2_client'

# Setup authorization
Harbor2Client.configure do |config|
  # Configure HTTP basic authorization: basic
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'
end

api_instance = Harbor2Client::ArtifactApi.new

project_name = 'project_name_example' # String | The name of the project

repository_name = 'repository_name_example' # String | The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb

reference = 'reference_example' # String | The reference of the artifact, can be digest or tag

label = Harbor2Client::Label.new # Label | The label that added to the artifact. Only the ID property is needed.

opts = { 
  x_request_id: 'x_request_id_example' # String | An unique ID for the request
}

begin
  #Add label to artifact
  api_instance.add_label(project_namerepository_name, reference, label, opts)
rescue Harbor2Client::ApiError => e
  puts "Exception when calling ArtifactApi->add_label: #{e}"
end

Documentation for API Endpoints

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

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