class Harbor2Client::RepositoryApi
Attributes
Public Class Methods
# File lib/harbor2_client/api/repository_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Delete repository Delete the repository specified by name @param project_name The name of the project @param repository_name The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [nil]
# File lib/harbor2_client/api/repository_api.rb, line 29 def delete_repository(project_name, repository_name, opts = {}) delete_repository_with_http_info(project_name, repository_name, opts) nil end
Delete repository Delete the repository specified by name @param project_name The name of the project @param repository_name The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
# File lib/harbor2_client/api/repository_api.rb, line 41 def delete_repository_with_http_info(project_name, repository_name, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RepositoryApi.delete_repository ...' end # verify the required parameter 'project_name' is set if @api_client.config.client_side_validation && project_name.nil? fail ArgumentError, "Missing the required parameter 'project_name' when calling RepositoryApi.delete_repository" end # verify the required parameter 'repository_name' is set if @api_client.config.client_side_validation && repository_name.nil? fail ArgumentError, "Missing the required parameter 'repository_name' when calling RepositoryApi.delete_repository" end if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling RepositoryApi.delete_repository, the character length must be great than or equal to 1.' end # resource path local_var_path = '/projects/{project_name}/repositories/{repository_name}'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil? # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['basic'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: RepositoryApi#delete_repository\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get repository Get the repository specified by name @param project_name The name of the project @param repository_name The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [Repository]
# File lib/harbor2_client/api/repository_api.rb, line 95 def get_repository(project_name, repository_name, opts = {}) data, _status_code, _headers = get_repository_with_http_info(project_name, repository_name, opts) data end
Get repository Get the repository specified by name @param project_name The name of the project @param repository_name The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [Array<(Repository
, Fixnum, Hash)>] Repository
data, response status code and response headers
# File lib/harbor2_client/api/repository_api.rb, line 107 def get_repository_with_http_info(project_name, repository_name, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RepositoryApi.get_repository ...' end # verify the required parameter 'project_name' is set if @api_client.config.client_side_validation && project_name.nil? fail ArgumentError, "Missing the required parameter 'project_name' when calling RepositoryApi.get_repository" end # verify the required parameter 'repository_name' is set if @api_client.config.client_side_validation && repository_name.nil? fail ArgumentError, "Missing the required parameter 'repository_name' when calling RepositoryApi.get_repository" end if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling RepositoryApi.get_repository, the character length must be great than or equal to 1.' end # resource path local_var_path = '/projects/{project_name}/repositories/{repository_name}'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil? # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['basic'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Repository') if @api_client.config.debugging @api_client.config.logger.debug "API called: RepositoryApi#get_repository\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List repositories List repositories of the specified project @param project_name The name of the project @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @option opts [String] :q 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= @option opts [Integer] :page The page number (default to 1) @option opts [Integer] :page_size The size of per page (default to 10) @return [Array<Repository>]
# File lib/harbor2_client/api/repository_api.rb, line 164 def list_repositories(project_name, opts = {}) data, _status_code, _headers = list_repositories_with_http_info(project_name, opts) data end
List repositories List repositories of the specified project @param project_name The name of the project @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @option opts [String] :q 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= @option opts [Integer] :page The page number @option opts [Integer] :page_size The size of per page @return [Array<(Array<Repository>, Fixnum, Hash)>] Array<Repository> data, response status code and response headers
# File lib/harbor2_client/api/repository_api.rb, line 178 def list_repositories_with_http_info(project_name, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RepositoryApi.list_repositories ...' end # verify the required parameter 'project_name' is set if @api_client.config.client_side_validation && project_name.nil? fail ArgumentError, "Missing the required parameter 'project_name' when calling RepositoryApi.list_repositories" end if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling RepositoryApi.list_repositories, the character length must be great than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling RepositoryApi.list_repositories, must be smaller than or equal to 100.' end # resource path local_var_path = '/projects/{project_name}/repositories'.sub('{' + 'project_name' + '}', project_name.to_s) # query parameters query_params = {} query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil? # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['basic'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Array<Repository>') if @api_client.config.debugging @api_client.config.logger.debug "API called: RepositoryApi#list_repositories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update repository Update the repository specified by name @param project_name The name of the project @param repository_name The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb @param repository The JSON object of repository. @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [nil]
# File lib/harbor2_client/api/repository_api.rb, line 237 def update_repository(project_name, repository_name, repository, opts = {}) update_repository_with_http_info(project_name, repository_name, repository, opts) nil end
Update repository Update the repository specified by name @param project_name The name of the project @param repository_name The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb @param repository The JSON object of repository. @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
# File lib/harbor2_client/api/repository_api.rb, line 250 def update_repository_with_http_info(project_name, repository_name, repository, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RepositoryApi.update_repository ...' end # verify the required parameter 'project_name' is set if @api_client.config.client_side_validation && project_name.nil? fail ArgumentError, "Missing the required parameter 'project_name' when calling RepositoryApi.update_repository" end # verify the required parameter 'repository_name' is set if @api_client.config.client_side_validation && repository_name.nil? fail ArgumentError, "Missing the required parameter 'repository_name' when calling RepositoryApi.update_repository" end # verify the required parameter 'repository' is set if @api_client.config.client_side_validation && repository.nil? fail ArgumentError, "Missing the required parameter 'repository' when calling RepositoryApi.update_repository" end if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling RepositoryApi.update_repository, the character length must be great than or equal to 1.' end # resource path local_var_path = '/projects/{project_name}/repositories/{repository_name}'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil? # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(repository) auth_names = ['basic'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: RepositoryApi#update_repository\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end