Class: Harbor2Client::ScanApi
- Inherits:
-
Object
- Object
- Harbor2Client::ScanApi
- Defined in:
- lib/harbor2_client/api/scan_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#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.
-
#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.
-
#initialize(api_client = ApiClient.default) ⇒ ScanApi
constructor
A new instance of ScanApi.
-
#scan_artifact(project_name, repository_name, reference, opts = {}) ⇒ nil
Scan the artifact Scan the specified artifact.
-
#scan_artifact_with_http_info(project_name, repository_name, reference, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>
Scan the artifact Scan the specified artifact.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ ScanApi
Returns a new instance of ScanApi.
19 20 21 |
# File 'lib/harbor2_client/api/scan_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/harbor2_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
31 32 33 34 |
# File 'lib/harbor2_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
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/harbor2_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
109 110 111 112 |
# File 'lib/harbor2_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
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/harbor2_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 |