class Harbor2Client::ArtifactApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/harbor2_client/api/artifact_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

add_label(project_name, repository_name, reference, label, opts = {}) click to toggle source

Add label to artifact Add label to the specified artiact. @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 reference The reference of the artifact, can be digest or tag @param label The label that added to the artifact. Only the ID property is needed. @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/artifact_api.rb, line 31
def add_label(project_name, repository_name, reference, label, opts = {})
  add_label_with_http_info(project_name, repository_name, reference, label, opts)
  nil
end
add_label_with_http_info(project_name, repository_name, reference, label, opts = {}) click to toggle source

Add label to artifact Add label to the specified artiact. @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 -&gt; a%252Fb @param reference The reference of the artifact, can be digest or tag @param label The label that added to the artifact. Only the ID property is needed. @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/artifact_api.rb, line 45
def add_label_with_http_info(project_name, repository_name, reference, label, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArtifactApi.add_label ...'
  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 ArtifactApi.add_label"
  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 ArtifactApi.add_label"
  end
  # verify the required parameter 'reference' is set
  if @api_client.config.client_side_validation && reference.nil?
    fail ArgumentError, "Missing the required parameter 'reference' when calling ArtifactApi.add_label"
  end
  # verify the required parameter 'label' is set
  if @api_client.config.client_side_validation && label.nil?
    fail ArgumentError, "Missing the required parameter 'label' when calling ArtifactApi.add_label"
  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 ArtifactApi.add_label, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/labels'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s).sub('{' + 'reference' + '}', reference.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(label)
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:POST, 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: ArtifactApi#add_label\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
copy_artifact(project_name, repository_name, from, opts = {}) click to toggle source

Copy artifact Copy the artifact specified in the "from" parameter to the repository. @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 -&gt; a%252Fb @param from The artifact from which the new artifact is copied from, the format should be "project/repository:tag&quot; or "project/repository@digest&quot;. @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/artifact_api.rb, line 108
def copy_artifact(project_name, repository_name, from, opts = {})
  copy_artifact_with_http_info(project_name, repository_name, from, opts)
  nil
end
copy_artifact_with_http_info(project_name, repository_name, from, opts = {}) click to toggle source

Copy artifact Copy the artifact specified in the "from&quot; parameter to the repository. @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 -&gt; a%252Fb @param from The artifact from which the new artifact is copied from, the format should be "project/repository:tag&quot; or "project/repository@digest&quot;. @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/artifact_api.rb, line 121
def copy_artifact_with_http_info(project_name, repository_name, from, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArtifactApi.copy_artifact ...'
  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 ArtifactApi.copy_artifact"
  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 ArtifactApi.copy_artifact"
  end
  # verify the required parameter 'from' is set
  if @api_client.config.client_side_validation && from.nil?
    fail ArgumentError, "Missing the required parameter 'from' when calling ArtifactApi.copy_artifact"
  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 ArtifactApi.copy_artifact, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/projects/{project_name}/repositories/{repository_name}/artifacts'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s)

  # query parameters
  query_params = {}
  query_params[:'from'] = from

  # 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(:POST, 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: ArtifactApi#copy_artifact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
create_tag(project_name, repository_name, reference, tag, opts = {}) click to toggle source

Create tag Create a tag for the specified artifact @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 -&gt; a%252Fb @param reference The reference of the artifact, can be digest or tag @param tag The JSON object of tag. @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/artifact_api.rb, line 182
def create_tag(project_name, repository_name, reference, tag, opts = {})
  create_tag_with_http_info(project_name, repository_name, reference, tag, opts)
  nil
end
create_tag_with_http_info(project_name, repository_name, reference, tag, opts = {}) click to toggle source

Create tag Create a tag for the specified artifact @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 -&gt; a%252Fb @param reference The reference of the artifact, can be digest or tag @param tag The JSON object of tag. @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/artifact_api.rb, line 196
def create_tag_with_http_info(project_name, repository_name, reference, tag, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArtifactApi.create_tag ...'
  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 ArtifactApi.create_tag"
  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 ArtifactApi.create_tag"
  end
  # verify the required parameter 'reference' is set
  if @api_client.config.client_side_validation && reference.nil?
    fail ArgumentError, "Missing the required parameter 'reference' when calling ArtifactApi.create_tag"
  end
  # verify the required parameter 'tag' is set
  if @api_client.config.client_side_validation && tag.nil?
    fail ArgumentError, "Missing the required parameter 'tag' when calling ArtifactApi.create_tag"
  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 ArtifactApi.create_tag, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tags'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s).sub('{' + 'reference' + '}', reference.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(tag)
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:POST, 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: ArtifactApi#create_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_artifact(project_name, repository_name, reference, opts = {}) click to toggle source

Delete the specific artifact Delete the artifact specified by the reference under the project and repository. The reference can be digest or tag @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 -&gt; a%252Fb @param reference The reference of the artifact, can be digest or tag @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/artifact_api.rb, line 259
def delete_artifact(project_name, repository_name, reference, opts = {})
  delete_artifact_with_http_info(project_name, repository_name, reference, opts)
  nil
end
delete_artifact_with_http_info(project_name, repository_name, reference, opts = {}) click to toggle source

Delete the specific artifact Delete the artifact specified by the reference under the project and repository. The reference can be digest or tag @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 -&gt; a%252Fb @param reference The reference of the artifact, can be digest or tag @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/artifact_api.rb, line 272
def delete_artifact_with_http_info(project_name, repository_name, reference, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArtifactApi.delete_artifact ...'
  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 ArtifactApi.delete_artifact"
  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 ArtifactApi.delete_artifact"
  end
  # verify the required parameter 'reference' is set
  if @api_client.config.client_side_validation && reference.nil?
    fail ArgumentError, "Missing the required parameter 'reference' when calling ArtifactApi.delete_artifact"
  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 ArtifactApi.delete_artifact, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s).sub('{' + 'reference' + '}', reference.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: ArtifactApi#delete_artifact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_tag(project_name, repository_name, reference, tag_name, opts = {}) click to toggle source

Delete tag Delete the tag of the specified artifact @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 -&gt; a%252Fb @param reference The reference of the artifact, can be digest or tag @param tag_name The name of the tag @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/artifact_api.rb, line 332
def delete_tag(project_name, repository_name, reference, tag_name, opts = {})
  delete_tag_with_http_info(project_name, repository_name, reference, tag_name, opts)
  nil
end
delete_tag_with_http_info(project_name, repository_name, reference, tag_name, opts = {}) click to toggle source

Delete tag Delete the tag of the specified artifact @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 -&gt; a%252Fb @param reference The reference of the artifact, can be digest or tag @param tag_name The name of the tag @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/artifact_api.rb, line 346
def delete_tag_with_http_info(project_name, repository_name, reference, tag_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArtifactApi.delete_tag ...'
  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 ArtifactApi.delete_tag"
  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 ArtifactApi.delete_tag"
  end
  # verify the required parameter 'reference' is set
  if @api_client.config.client_side_validation && reference.nil?
    fail ArgumentError, "Missing the required parameter 'reference' when calling ArtifactApi.delete_tag"
  end
  # verify the required parameter 'tag_name' is set
  if @api_client.config.client_side_validation && tag_name.nil?
    fail ArgumentError, "Missing the required parameter 'tag_name' when calling ArtifactApi.delete_tag"
  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 ArtifactApi.delete_tag, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tags/{tag_name}'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s).sub('{' + 'reference' + '}', reference.to_s).sub('{' + 'tag_name' + '}', tag_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: ArtifactApi#delete_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_addition(project_name, repository_name, reference, addition, opts = {}) click to toggle source

Get the addition of the specific artifact Get the addition of the artifact specified by the reference under the project and repository. @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 -&gt; a%252Fb @param reference The reference of the artifact, can be digest or tag @param addition The type of addition. @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [String]

# File lib/harbor2_client/api/artifact_api.rb, line 410
def get_addition(project_name, repository_name, reference, addition, opts = {})
  data, _status_code, _headers = get_addition_with_http_info(project_name, repository_name, reference, addition, opts)
  data
end
get_addition_with_http_info(project_name, repository_name, reference, addition, opts = {}) click to toggle source

Get the addition of the specific artifact Get the addition of the artifact specified by the reference under the project and repository. @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 -&gt; a%252Fb @param reference The reference of the artifact, can be digest or tag @param addition The type of addition. @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers

# File lib/harbor2_client/api/artifact_api.rb, line 424
def get_addition_with_http_info(project_name, repository_name, reference, addition, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArtifactApi.get_addition ...'
  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 ArtifactApi.get_addition"
  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 ArtifactApi.get_addition"
  end
  # verify the required parameter 'reference' is set
  if @api_client.config.client_side_validation && reference.nil?
    fail ArgumentError, "Missing the required parameter 'reference' when calling ArtifactApi.get_addition"
  end
  # verify the required parameter 'addition' is set
  if @api_client.config.client_side_validation && addition.nil?
    fail ArgumentError, "Missing the required parameter 'addition' when calling ArtifactApi.get_addition"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['build_history', 'values.yaml', 'readme.md', 'dependencies', 'vulnerabilities'].include?(addition)
    fail ArgumentError, "invalid value for 'addition', must be one of build_history, values.yaml, readme.md, dependencies, vulnerabilities"
  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 ArtifactApi.get_addition, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/additions/{addition}'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s).sub('{' + 'reference' + '}', reference.to_s).sub('{' + 'addition' + '}', addition.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 => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ArtifactApi#get_addition\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_artifact(project_name, repository_name, reference, opts = {}) click to toggle source

Get the specific artifact Get the artifact specified by the reference under the project and repository. The reference can be digest or tag. @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 -&gt; a%252Fb @param reference The reference of the artifact, can be digest or tag @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @option opts [Integer] :page The page number (default to 1) @option opts [Integer] :page_size The size of per page (default to 10) @option opts [BOOLEAN] :with_tag Specify whether the tags are inclued inside the returning artifacts (default to true) @option opts [BOOLEAN] :with_label Specify whether the labels are inclued inside the returning artifacts (default to false) @option opts [BOOLEAN] :with_scan_overview Specify whether the scan overview is inclued inside the returning artifacts (default to false) @option opts [BOOLEAN] :with_signature Specify whether the signature is inclued inside the returning artifacts (default to false) @option opts [BOOLEAN] :with_immutable_status Specify whether the immutable status is inclued inside the tags of the returning artifacts. Only works when setting "with_tag&#x3D;true&quot; (default to false) @return [Artifact]

# File lib/harbor2_client/api/artifact_api.rb, line 499
def get_artifact(project_name, repository_name, reference, opts = {})
  data, _status_code, _headers = get_artifact_with_http_info(project_name, repository_name, reference, opts)
  data
end
get_artifact_with_http_info(project_name, repository_name, reference, opts = {}) click to toggle source

Get the specific artifact Get the artifact specified by the reference under the project and repository. The reference can be digest or tag. @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 -&gt; a%252Fb @param reference The reference of the artifact, can be digest or tag @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @option opts [Integer] :page The page number @option opts [Integer] :page_size The size of per page @option opts [BOOLEAN] :with_tag Specify whether the tags are inclued inside the returning artifacts @option opts [BOOLEAN] :with_label Specify whether the labels are inclued inside the returning artifacts @option opts [BOOLEAN] :with_scan_overview Specify whether the scan overview is inclued inside the returning artifacts @option opts [BOOLEAN] :with_signature Specify whether the signature is inclued inside the returning artifacts @option opts [BOOLEAN] :with_immutable_status Specify whether the immutable status is inclued inside the tags of the returning artifacts. Only works when setting "with_tag&#x3D;true&quot; @return [Array<(Artifact, Fixnum, Hash)>] Artifact data, response status code and response headers

# File lib/harbor2_client/api/artifact_api.rb, line 519
def get_artifact_with_http_info(project_name, repository_name, reference, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArtifactApi.get_artifact ...'
  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 ArtifactApi.get_artifact"
  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 ArtifactApi.get_artifact"
  end
  # verify the required parameter 'reference' is set
  if @api_client.config.client_side_validation && reference.nil?
    fail ArgumentError, "Missing the required parameter 'reference' when calling ArtifactApi.get_artifact"
  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 ArtifactApi.get_artifact, 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 ArtifactApi.get_artifact, must be smaller than or equal to 100.'
  end

  # resource path
  local_var_path = '/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s).sub('{' + 'reference' + '}', reference.to_s)

  # query parameters
  query_params = {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'with_tag'] = opts[:'with_tag'] if !opts[:'with_tag'].nil?
  query_params[:'with_label'] = opts[:'with_label'] if !opts[:'with_label'].nil?
  query_params[:'with_scan_overview'] = opts[:'with_scan_overview'] if !opts[:'with_scan_overview'].nil?
  query_params[:'with_signature'] = opts[:'with_signature'] if !opts[:'with_signature'].nil?
  query_params[:'with_immutable_status'] = opts[:'with_immutable_status'] if !opts[:'with_immutable_status'].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 => 'Artifact')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ArtifactApi#get_artifact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_artifacts(project_name, repository_name, opts = {}) click to toggle source

List artifacts List artifacts under the specific project and repository. Except the basic properties, the other supported queries in "q" includes "tags=*" to list only tagged artifacts, "tags=nil" to list only untagged artifacts, "tags=~v" to list artifacts whose tag fuzzy matches "v", "tags=v" to list artifact whose tag exactly matches "v", "labels=(id1, id2)" to list artifacts that both labels with id1 and id2 are added to @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 -&gt; a%252Fb @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&#x3D;v)", "fuzzy match(k&#x3D;~v)", "range(k=[min~max])", "list with union releationship(k&#x3D;{v1 v2 v3})" and "list with intersetion relationship(k&#x3D;(v1 v2 v3))". The value of range and list can be string(enclosed by " or &#39;), integer or time(in format "2020-04-09 02:36:00&quot;). All of these query patterns should be put in the query string "q&#x3D;xxx&quot; and splitted by ",&quot;. 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) @option opts [BOOLEAN] :with_tag Specify whether the tags are included inside the returning artifacts (default to true) @option opts [BOOLEAN] :with_label Specify whether the labels are included inside the returning artifacts (default to false) @option opts [BOOLEAN] :with_scan_overview Specify whether the scan overview is included inside the returning artifacts (default to false) @option opts [BOOLEAN] :with_signature Specify whether the signature is included inside the tags of the returning artifacts. Only works when setting "with_tag&#x3D;true&quot; (default to false) @option opts [BOOLEAN] :with_immutable_status Specify whether the immutable status is included inside the tags of the returning artifacts. Only works when setting "with_tag&#x3D;true&quot; (default to false) @return [Array<Artifact>]

# File lib/harbor2_client/api/artifact_api.rb, line 597
def list_artifacts(project_name, repository_name, opts = {})
  data, _status_code, _headers = list_artifacts_with_http_info(project_name, repository_name, opts)
  data
end
list_artifacts_with_http_info(project_name, repository_name, opts = {}) click to toggle source

List artifacts List artifacts under the specific project and repository. Except the basic properties, the other supported queries in "q&quot; includes "tags&#x3D;*&quot; to list only tagged artifacts, "tags&#x3D;nil&quot; to list only untagged artifacts, "tags&#x3D;~v&quot; to list artifacts whose tag fuzzy matches "v&quot;, "tags&#x3D;v&quot; to list artifact whose tag exactly matches "v&quot;, "labels&#x3D;(id1, id2)" to list artifacts that both labels with id1 and id2 are added to @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 -&gt; a%252Fb @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&#x3D;v)", "fuzzy match(k&#x3D;~v)", "range(k=[min~max])", "list with union releationship(k&#x3D;{v1 v2 v3})" and "list with intersetion relationship(k&#x3D;(v1 v2 v3))". The value of range and list can be string(enclosed by " or &#39;), integer or time(in format "2020-04-09 02:36:00&quot;). All of these query patterns should be put in the query string "q&#x3D;xxx&quot; and splitted by ",&quot;. 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 @option opts [BOOLEAN] :with_tag Specify whether the tags are included inside the returning artifacts @option opts [BOOLEAN] :with_label Specify whether the labels are included inside the returning artifacts @option opts [BOOLEAN] :with_scan_overview Specify whether the scan overview is included inside the returning artifacts @option opts [BOOLEAN] :with_signature Specify whether the signature is included inside the tags of the returning artifacts. Only works when setting "with_tag&#x3D;true&quot; @option opts [BOOLEAN] :with_immutable_status Specify whether the immutable status is included inside the tags of the returning artifacts. Only works when setting "with_tag&#x3D;true&quot; @return [Array<(Array<Artifact>, Fixnum, Hash)>] Array<Artifact> data, response status code and response headers

# File lib/harbor2_client/api/artifact_api.rb, line 617
def list_artifacts_with_http_info(project_name, repository_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArtifactApi.list_artifacts ...'
  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 ArtifactApi.list_artifacts"
  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 ArtifactApi.list_artifacts"
  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 ArtifactApi.list_artifacts, 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 ArtifactApi.list_artifacts, must be smaller than or equal to 100.'
  end

  # resource path
  local_var_path = '/projects/{project_name}/repositories/{repository_name}/artifacts'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_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?
  query_params[:'with_tag'] = opts[:'with_tag'] if !opts[:'with_tag'].nil?
  query_params[:'with_label'] = opts[:'with_label'] if !opts[:'with_label'].nil?
  query_params[:'with_scan_overview'] = opts[:'with_scan_overview'] if !opts[:'with_scan_overview'].nil?
  query_params[:'with_signature'] = opts[:'with_signature'] if !opts[:'with_signature'].nil?
  query_params[:'with_immutable_status'] = opts[:'with_immutable_status'] if !opts[:'with_immutable_status'].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<Artifact>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ArtifactApi#list_artifacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_tags(project_name, repository_name, reference, opts = {}) click to toggle source

List tags List tags of the specific artifact @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 -&gt; a%252Fb @param reference The reference of the artifact, can be digest or tag @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&#x3D;v)", "fuzzy match(k&#x3D;~v)", "range(k=[min~max])", "list with union releationship(k&#x3D;{v1 v2 v3})" and "list with intersetion relationship(k&#x3D;(v1 v2 v3))". The value of range and list can be string(enclosed by " or &#39;), integer or time(in format "2020-04-09 02:36:00&quot;). All of these query patterns should be put in the query string "q&#x3D;xxx&quot; and splitted by ",&quot;. 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) @option opts [BOOLEAN] :with_signature Specify whether the signature is included inside the returning tags (default to false) @option opts [BOOLEAN] :with_immutable_status Specify whether the immutable status is included inside the returning tags (default to false) @return [Array<Tag>]

# File lib/harbor2_client/api/artifact_api.rb, line 690
def list_tags(project_name, repository_name, reference, opts = {})
  data, _status_code, _headers = list_tags_with_http_info(project_name, repository_name, reference, opts)
  data
end
list_tags_with_http_info(project_name, repository_name, reference, opts = {}) click to toggle source

List tags List tags of the specific artifact @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 -&gt; a%252Fb @param reference The reference of the artifact, can be digest or tag @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&#x3D;v)", "fuzzy match(k&#x3D;~v)", "range(k=[min~max])", "list with union releationship(k&#x3D;{v1 v2 v3})" and "list with intersetion relationship(k&#x3D;(v1 v2 v3))". The value of range and list can be string(enclosed by " or &#39;), integer or time(in format "2020-04-09 02:36:00&quot;). All of these query patterns should be put in the query string "q&#x3D;xxx&quot; and splitted by ",&quot;. 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 @option opts [BOOLEAN] :with_signature Specify whether the signature is included inside the returning tags @option opts [BOOLEAN] :with_immutable_status Specify whether the immutable status is included inside the returning tags @return [Array<(Array<Tag>, Fixnum, Hash)>] Array<Tag> data, response status code and response headers

# File lib/harbor2_client/api/artifact_api.rb, line 708
def list_tags_with_http_info(project_name, repository_name, reference, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArtifactApi.list_tags ...'
  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 ArtifactApi.list_tags"
  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 ArtifactApi.list_tags"
  end
  # verify the required parameter 'reference' is set
  if @api_client.config.client_side_validation && reference.nil?
    fail ArgumentError, "Missing the required parameter 'reference' when calling ArtifactApi.list_tags"
  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 ArtifactApi.list_tags, 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 ArtifactApi.list_tags, must be smaller than or equal to 100.'
  end

  # resource path
  local_var_path = '/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tags'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s).sub('{' + 'reference' + '}', reference.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?
  query_params[:'with_signature'] = opts[:'with_signature'] if !opts[:'with_signature'].nil?
  query_params[:'with_immutable_status'] = opts[:'with_immutable_status'] if !opts[:'with_immutable_status'].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<Tag>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ArtifactApi#list_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
remove_label(project_name, repository_name, reference, label_id, opts = {}) click to toggle source

Remove label from artifact Remove the label from the specified artiact. @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 -&gt; a%252Fb @param reference The reference of the artifact, can be digest or tag @param label_id The ID of the label that removed from the artifact. @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/artifact_api.rb, line 778
def remove_label(project_name, repository_name, reference, label_id, opts = {})
  remove_label_with_http_info(project_name, repository_name, reference, label_id, opts)
  nil
end
remove_label_with_http_info(project_name, repository_name, reference, label_id, opts = {}) click to toggle source

Remove label from artifact Remove the label from the specified artiact. @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 -&gt; a%252Fb @param reference The reference of the artifact, can be digest or tag @param label_id The ID of the label that removed from the artifact. @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/artifact_api.rb, line 792
def remove_label_with_http_info(project_name, repository_name, reference, label_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArtifactApi.remove_label ...'
  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 ArtifactApi.remove_label"
  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 ArtifactApi.remove_label"
  end
  # verify the required parameter 'reference' is set
  if @api_client.config.client_side_validation && reference.nil?
    fail ArgumentError, "Missing the required parameter 'reference' when calling ArtifactApi.remove_label"
  end
  # verify the required parameter 'label_id' is set
  if @api_client.config.client_side_validation && label_id.nil?
    fail ArgumentError, "Missing the required parameter 'label_id' when calling ArtifactApi.remove_label"
  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 ArtifactApi.remove_label, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/labels/{label_id}'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s).sub('{' + 'reference' + '}', reference.to_s).sub('{' + 'label_id' + '}', label_id.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: ArtifactApi#remove_label\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end