Class: SwaggerClient::ScanApi

Inherits:
Object
  • Object
show all
Defined in:
lib/harbor_swagger_client/api/scan_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ScanApi

Returns a new instance of ScanApi.



19
20
21
# File 'lib/harbor_swagger_client/api/scan_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/harbor_swagger_client/api/scan_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_report_log(project_name, repository_name, reference, report_id, opts = {}) ⇒ String

Get the log of the scan report Get the log of the scan report

Parameters:

  • project_name

    The name of the project

  • repository_name

    The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb

  • reference

    The reference of the artifact, can be digest or tag

  • report_id

    The report id to get the log

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (String)


31
32
33
34
# File 'lib/harbor_swagger_client/api/scan_api.rb', line 31

def get_report_log(project_name, repository_name, reference, report_id, opts = {})
  data, _status_code, _headers = get_report_log_with_http_info(project_name, repository_name, reference, report_id, opts)
  data
end

#get_report_log_with_http_info(project_name, repository_name, reference, report_id, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Get the log of the scan report Get the log of the scan report

Parameters:

  • project_name

    The name of the project

  • repository_name

    The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -&gt; a%252Fb

  • reference

    The reference of the artifact, can be digest or tag

  • report_id

    The report id to get the log

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/harbor_swagger_client/api/scan_api.rb', line 45

def get_report_log_with_http_info(project_name, repository_name, reference, report_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScanApi.get_report_log ...'
  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 ScanApi.get_report_log"
  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 ScanApi.get_report_log"
  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 ScanApi.get_report_log"
  end
  # verify the required parameter 'report_id' is set
  if @api_client.config.client_side_validation && report_id.nil?
    fail ArgumentError, "Missing the required parameter 'report_id' when calling ScanApi.get_report_log"
  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 ScanApi.get_report_log, 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}/scan/{report_id}/log'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s).sub('{' + 'reference' + '}', reference.to_s).sub('{' + 'report_id' + '}', report_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/plain'])
  # 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: ScanApi#get_report_log\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#scan_artifact(project_name, repository_name, reference, opts = {}) ⇒ nil

Scan the artifact Scan the specified artifact

Parameters:

  • project_name

    The name of the project

  • repository_name

    The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -&gt; a%252Fb

  • reference

    The reference of the artifact, can be digest or tag

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


109
110
111
112
# File 'lib/harbor_swagger_client/api/scan_api.rb', line 109

def scan_artifact(project_name, repository_name, reference, opts = {})
  scan_artifact_with_http_info(project_name, repository_name, reference, opts)
  nil
end

#scan_artifact_with_http_info(project_name, repository_name, reference, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Scan the artifact Scan the specified artifact

Parameters:

  • project_name

    The name of the project

  • repository_name

    The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -&gt; a%252Fb

  • reference

    The reference of the artifact, can be digest or tag

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/harbor_swagger_client/api/scan_api.rb', line 122

def scan_artifact_with_http_info(project_name, repository_name, reference, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScanApi.scan_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 ScanApi.scan_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 ScanApi.scan_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 ScanApi.scan_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 ScanApi.scan_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}/scan'.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(: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: ScanApi#scan_artifact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end