Skip to content

Latest commit

 

History

History
752 lines (531 loc) · 29.1 KB

ProjectApi.md

File metadata and controls

752 lines (531 loc) · 29.1 KB

Harbor2Client::ProjectApi

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

Method HTTP request Description
create_project POST /projects Create a new project.
delete_project DELETE /projects/{project_name_or_id} Delete project by projectID
get_logs GET /projects/{project_name}/logs Get recent logs of the projects
get_project GET /projects/{project_name_or_id} Return specific project detail information
get_project_deletable GET /projects/{project_name_or_id}/_deletable Get the deletable status of the project
get_project_summary GET /projects/{project_name_or_id}/summary Get summary of the project.
get_scanner_of_project GET /projects/{project_name_or_id}/scanner Get project level scanner
head_project HEAD /projects Check if the project name user provided already exists.
list_projects GET /projects List projects
list_scanner_candidates_of_project GET /projects/{project_name_or_id}/scanner/candidates Get scanner registration candidates for configurating project level scanner
set_scanner_of_project PUT /projects/{project_name_or_id}/scanner Configure scanner for the specified project
update_project PUT /projects/{project_name_or_id} Update properties for a selected project.

create_project

create_project(project, opts)

Create a new project.

This endpoint is for user to create a new project.

Example

# 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::ProjectApi.new

project = Harbor2Client::ProjectReq.new # ProjectReq | New created project.

opts = { 
  x_request_id: 'x_request_id_example' # String | An unique ID for the request
  x_resource_name_in_location: false # BOOLEAN | The flag to indicate whether to return the name of the resource in Location. When X-Resource-Name-In-Location is true, the Location will return the name of the resource.
}

begin
  #Create a new project.
  api_instance.create_project(project, opts)
rescue Harbor2Client::ApiError => e
  puts "Exception when calling ProjectApi->create_project: #{e}"
end

Parameters

Name Type Description Notes
project ProjectReq New created project.
x_request_id String An unique ID for the request [optional]
x_resource_name_in_location BOOLEAN The flag to indicate whether to return the name of the resource in Location. When X-Resource-Name-In-Location is true, the Location will return the name of the resource. [optional] [default to false]

Return type

nil (empty response body)

Authorization

basic

HTTP request headers

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

delete_project

delete_project(project_name_or_id, opts)

Delete project by projectID

This endpoint is aimed to delete project by project ID.

Example

# 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::ProjectApi.new

project_name_or_id = 'project_name_or_id_example' # String | The name or id of the project

opts = { 
  x_request_id: 'x_request_id_example' # String | An unique ID for the request
  x_is_resource_name: false # BOOLEAN | The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.
}

begin
  #Delete project by projectID
  api_instance.delete_project(project_name_or_id, opts)
rescue Harbor2Client::ApiError => e
  puts "Exception when calling ProjectApi->delete_project: #{e}"
end

Parameters

Name Type Description Notes
project_name_or_id String The name or id of the project
x_request_id String An unique ID for the request [optional]
x_is_resource_name BOOLEAN The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. [optional] [default to false]

Return type

nil (empty response body)

Authorization

basic

HTTP request headers

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

get_logs

Array<AuditLog> get_logs(project_name, opts)

Get recent logs of the projects

Get recent logs of the projects

Example

# 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::ProjectApi.new

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

opts = { 
  x_request_id: 'x_request_id_example' # String | An unique ID for the request
  q: 'q_example', # String | 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]
  sort: 'sort_example', # String | 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\"
  page: 1, # Integer | The page number
  page_size: 10, # Integer | The size of per page
}

begin
  #Get recent logs of the projects
  result = api_instance.get_logs(project_name, opts)
  p result
rescue Harbor2Client::ApiError => e
  puts "Exception when calling ProjectApi->get_logs: #{e}"
end

Parameters

Name Type Description Notes
project_name String The name of the project
x_request_id String An unique ID for the request [optional]
q String Query string to query resources. Supported query patterns are &quot;exact match(k=v)&quot;, &quot;fuzzy match(k=v)&quot;, &quot;range(k=[minmax])&quot;, &quot;list with union releationship(k={v1 v2 v3})&quot; and &quot;list with intersetion relationship(k=(v1 v2 v3))&quot;. The value of range and list can be string(enclosed by &quot; or '), integer or time(in format &quot;2020-04-09 02:36:00&quot;). All of these query patterns should be put in the query string &quot;q=xxx&quot; and splitted by &quot;,&quot;. e.g. q=k1=v1,k2=v2,k3=[minmax] [optional]
sort String Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with &quot;sort=field1,-field2&quot; [optional]
page Integer The page number [optional] [default to 1]
page_size Integer The size of per page [optional] [default to 10]

Return type

Array<AuditLog>

Authorization

basic

HTTP request headers

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

get_project

Project get_project(project_name_or_id, opts)

Return specific project detail information

This endpoint returns specific project information by project ID.

Example

# 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::ProjectApi.new

project_name_or_id = 'project_name_or_id_example' # String | The name or id of the project

opts = { 
  x_request_id: 'x_request_id_example' # String | An unique ID for the request
  x_is_resource_name: false # BOOLEAN | The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.
}

begin
  #Return specific project detail information
  result = api_instance.get_project(project_name_or_id, opts)
  p result
rescue Harbor2Client::ApiError => e
  puts "Exception when calling ProjectApi->get_project: #{e}"
end

Parameters

Name Type Description Notes
project_name_or_id String The name or id of the project
x_request_id String An unique ID for the request [optional]
x_is_resource_name BOOLEAN The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. [optional] [default to false]

Return type

Project

Authorization

basic

HTTP request headers

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

get_project_deletable

ProjectDeletable get_project_deletable(project_name_or_id, opts)

Get the deletable status of the project

Get the deletable status of the project

Example

# 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::ProjectApi.new

project_name_or_id = 'project_name_or_id_example' # String | The name or id of the project

opts = { 
  x_request_id: 'x_request_id_example' # String | An unique ID for the request
  x_is_resource_name: false # BOOLEAN | The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.
}

begin
  #Get the deletable status of the project
  result = api_instance.get_project_deletable(project_name_or_id, opts)
  p result
rescue Harbor2Client::ApiError => e
  puts "Exception when calling ProjectApi->get_project_deletable: #{e}"
end

Parameters

Name Type Description Notes
project_name_or_id String The name or id of the project
x_request_id String An unique ID for the request [optional]
x_is_resource_name BOOLEAN The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. [optional] [default to false]

Return type

ProjectDeletable

Authorization

basic

HTTP request headers

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

get_project_summary

ProjectSummary get_project_summary(project_name_or_id, opts)

Get summary of the project.

Get summary of the project.

Example

# 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::ProjectApi.new

project_name_or_id = 'project_name_or_id_example' # String | The name or id of the project

opts = { 
  x_request_id: 'x_request_id_example' # String | An unique ID for the request
  x_is_resource_name: false # BOOLEAN | The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.
}

begin
  #Get summary of the project.
  result = api_instance.get_project_summary(project_name_or_id, opts)
  p result
rescue Harbor2Client::ApiError => e
  puts "Exception when calling ProjectApi->get_project_summary: #{e}"
end

Parameters

Name Type Description Notes
project_name_or_id String The name or id of the project
x_request_id String An unique ID for the request [optional]
x_is_resource_name BOOLEAN The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. [optional] [default to false]

Return type

ProjectSummary

Authorization

basic

HTTP request headers

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

get_scanner_of_project

ScannerRegistration get_scanner_of_project(project_name_or_id, opts)

Get project level scanner

Get the scanner registration of the specified project. If no scanner registration is configured for the specified project, the system default scanner registration will be returned.

Example

# 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::ProjectApi.new

project_name_or_id = 'project_name_or_id_example' # String | The name or id of the project

opts = { 
  x_request_id: 'x_request_id_example' # String | An unique ID for the request
  x_is_resource_name: false # BOOLEAN | The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.
}

begin
  #Get project level scanner
  result = api_instance.get_scanner_of_project(project_name_or_id, opts)
  p result
rescue Harbor2Client::ApiError => e
  puts "Exception when calling ProjectApi->get_scanner_of_project: #{e}"
end

Parameters

Name Type Description Notes
project_name_or_id String The name or id of the project
x_request_id String An unique ID for the request [optional]
x_is_resource_name BOOLEAN The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. [optional] [default to false]

Return type

ScannerRegistration

Authorization

basic

HTTP request headers

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

head_project

head_project(project_name, opts)

Check if the project name user provided already exists.

This endpoint is used to check if the project name provided already exist.

Example

# 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::ProjectApi.new

project_name = 'project_name_example' # String | Project name for checking exists.

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

begin
  #Check if the project name user provided already exists.
  api_instance.head_project(project_name, opts)
rescue Harbor2Client::ApiError => e
  puts "Exception when calling ProjectApi->head_project: #{e}"
end

Parameters

Name Type Description Notes
project_name String Project name for checking exists.
x_request_id String An unique ID for the request [optional]

Return type

nil (empty response body)

Authorization

basic

HTTP request headers

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

list_projects

Array<Project> list_projects(opts)

List projects

This endpoint returns projects created by Harbor.

Example

# 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::ProjectApi.new

opts = { 
  x_request_id: 'x_request_id_example' # String | An unique ID for the request
  q: 'q_example', # String | 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]
  page: 1, # Integer | The page number
  page_size: 10, # Integer | The size of per page
  sort: 'sort_example', # String | 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\"
  name: 'name_example', # String | The name of project.
  public: true, # BOOLEAN | The project is public or private.
  owner: 'owner_example', # String | The name of project owner.
  with_detail: true # BOOLEAN | Bool value indicating whether return detailed information of the project
}

begin
  #List projects
  result = api_instance.list_projects(opts)
  p result
rescue Harbor2Client::ApiError => e
  puts "Exception when calling ProjectApi->list_projects: #{e}"
end

Parameters

Name Type Description Notes
x_request_id String An unique ID for the request [optional]
q String Query string to query resources. Supported query patterns are &quot;exact match(k=v)&quot;, &quot;fuzzy match(k=v)&quot;, &quot;range(k=[minmax])&quot;, &quot;list with union releationship(k={v1 v2 v3})&quot; and &quot;list with intersetion relationship(k=(v1 v2 v3))&quot;. The value of range and list can be string(enclosed by &quot; or '), integer or time(in format &quot;2020-04-09 02:36:00&quot;). All of these query patterns should be put in the query string &quot;q=xxx&quot; and splitted by &quot;,&quot;. e.g. q=k1=v1,k2=v2,k3=[minmax] [optional]
page Integer The page number [optional] [default to 1]
page_size Integer The size of per page [optional] [default to 10]
sort String Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with &quot;sort=field1,-field2&quot; [optional]
name String The name of project. [optional]
public BOOLEAN The project is public or private. [optional]
owner String The name of project owner. [optional]
with_detail BOOLEAN Bool value indicating whether return detailed information of the project [optional] [default to true]

Return type

Array<Project>

Authorization

basic

HTTP request headers

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

list_scanner_candidates_of_project

Array<ScannerRegistration> list_scanner_candidates_of_project(project_name_or_id, opts)

Get scanner registration candidates for configurating project level scanner

Retrieve the system configured scanner registrations as candidates of setting project level scanner.

Example

# 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::ProjectApi.new

project_name_or_id = 'project_name_or_id_example' # String | The name or id of the project

opts = { 
  x_request_id: 'x_request_id_example' # String | An unique ID for the request
  x_is_resource_name: false # BOOLEAN | The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.
  q: 'q_example', # String | 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]
  sort: 'sort_example', # String | 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\"
  page: 1, # Integer | The page number
  page_size: 10, # Integer | The size of per page
}

begin
  #Get scanner registration candidates for configurating project level scanner
  result = api_instance.list_scanner_candidates_of_project(project_name_or_id, opts)
  p result
rescue Harbor2Client::ApiError => e
  puts "Exception when calling ProjectApi->list_scanner_candidates_of_project: #{e}"
end

Parameters

Name Type Description Notes
project_name_or_id String The name or id of the project
x_request_id String An unique ID for the request [optional]
x_is_resource_name BOOLEAN The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. [optional] [default to false]
q String Query string to query resources. Supported query patterns are &quot;exact match(k=v)&quot;, &quot;fuzzy match(k=v)&quot;, &quot;range(k=[minmax])&quot;, &quot;list with union releationship(k={v1 v2 v3})&quot; and &quot;list with intersetion relationship(k=(v1 v2 v3))&quot;. The value of range and list can be string(enclosed by &quot; or '), integer or time(in format &quot;2020-04-09 02:36:00&quot;). All of these query patterns should be put in the query string &quot;q=xxx&quot; and splitted by &quot;,&quot;. e.g. q=k1=v1,k2=v2,k3=[minmax] [optional]
sort String Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with &quot;sort=field1,-field2&quot; [optional]
page Integer The page number [optional] [default to 1]
page_size Integer The size of per page [optional] [default to 10]

Return type

Array<ScannerRegistration>

Authorization

basic

HTTP request headers

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

set_scanner_of_project

set_scanner_of_project(project_name_or_idpayload, opts)

Configure scanner for the specified project

Set one of the system configured scanner registration as the indepndent scanner of the specified project.

Example

# 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::ProjectApi.new

project_name_or_id = 'project_name_or_id_example' # String | The name or id of the project

payload = Harbor2Client::ProjectScanner.new # ProjectScanner | 

opts = { 
  x_request_id: 'x_request_id_example' # String | An unique ID for the request
  x_is_resource_name: false # BOOLEAN | The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.
}

begin
  #Configure scanner for the specified project
  api_instance.set_scanner_of_project(project_name_or_idpayload, opts)
rescue Harbor2Client::ApiError => e
  puts "Exception when calling ProjectApi->set_scanner_of_project: #{e}"
end

Parameters

Name Type Description Notes
project_name_or_id String The name or id of the project
payload ProjectScanner
x_request_id String An unique ID for the request [optional]
x_is_resource_name BOOLEAN The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. [optional] [default to false]

Return type

nil (empty response body)

Authorization

basic

HTTP request headers

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

update_project

update_project(project_name_or_idproject, opts)

Update properties for a selected project.

This endpoint is aimed to update the properties of a project.

Example

# 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::ProjectApi.new

project_name_or_id = 'project_name_or_id_example' # String | The name or id of the project

project = Harbor2Client::ProjectReq.new # ProjectReq | Updates of project.

opts = { 
  x_request_id: 'x_request_id_example' # String | An unique ID for the request
  x_is_resource_name: false # BOOLEAN | The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.
}

begin
  #Update properties for a selected project.
  api_instance.update_project(project_name_or_idproject, opts)
rescue Harbor2Client::ApiError => e
  puts "Exception when calling ProjectApi->update_project: #{e}"
end

Parameters

Name Type Description Notes
project_name_or_id String The name or id of the project
project ProjectReq Updates of project.
x_request_id String An unique ID for the request [optional]
x_is_resource_name BOOLEAN The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. [optional] [default to false]

Return type

nil (empty response body)

Authorization

basic

HTTP request headers

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