harbor2_client
Harbor2Client - the Ruby gem for the Harbor 2 API.
These APIs provide services for manipulating Harbor projects.
This SDK is automatically generated by the Swagger Codegen project:
- API version: 2.0
- Package version: 0.2.0
- 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-0.2.0.gem
(for development, run gem install --dev ./harbor2_client-0.2.0.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', '~> 0.2.0'
Install from Git
If the Ruby gem is hosted at a git repository: https://github.com/YOUR_GIT_USERNAME/YOUR_GIT_REPO, then add the following in the Gemfile:
gem 'harbor2_client', :git => 'https://github.com/YOUR_GIT_USERNAME/YOUR_GIT_REPO.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 | 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::IconApi | get_icon | GET /icons/digest | Get artifact icon |
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_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_id | Return specific project detail information |
Harbor2Client::ProjectApi | get_project_deletable | GET /projects/project_id/_deletable | Get the deletable status of the project |
Harbor2Client::ProjectApi | get_project_summary | GET /projects/project_id/summary | Get summary of the project. |
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 | update_project | PUT /projects/project_id | Update properties for a selected project. |
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_repositories | GET /projects/project_name/repositories | List repositories |
Harbor2Client::RepositoryApi | update_repository | PUT /projects/project_name/repositories/repository_name | Update repository |
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 |
Documentation for Models
- Harbor2Client::AdditionLink
- Harbor2Client::AdditionLinks
- Harbor2Client::Annotations
- Harbor2Client::Artifact
- Harbor2Client::AuditLog
- Harbor2Client::CVEAllowlist
- Harbor2Client::CVEAllowlistItem
- Harbor2Client::Error
- Harbor2Client::Errors
- Harbor2Client::Execution
- Harbor2Client::ExtraAttrs
- Harbor2Client::Icon
- Harbor2Client::Instance
- Harbor2Client::Label
- Harbor2Client::Metadata
- Harbor2Client::Metrics
- Harbor2Client::NativeReportSummary
- Harbor2Client::Platform
- Harbor2Client::PreheatPolicy
- Harbor2Client::Project
- Harbor2Client::ProjectDeletable
- Harbor2Client::ProjectMetadata
- Harbor2Client::ProjectReq
- Harbor2Client::ProjectSummary
- Harbor2Client::ProjectSummaryQuota
- Harbor2Client::ProviderUnderProject
- Harbor2Client::Reference
- Harbor2Client::Registry
- Harbor2Client::RegistryCredential
- Harbor2Client::Repository
- Harbor2Client::ResourceList
- Harbor2Client::ScanOverview
- Harbor2Client::Tag
- Harbor2Client::Task
- Harbor2Client::VulnerabilitySummary
Documentation for Authorization
basic
- Type: HTTP basic authentication