Class: EmassClient::ArtifactsApi
- Inherits:
-
Object
- Object
- EmassClient::ArtifactsApi
- Defined in:
- lib/emass_client/api/artifacts_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#add_artifacts_by_system_id(system_id, filename, opts = {}) ⇒ ArtifactsResponsePutPost
Add one or many artifacts in a system <strong>Information About Adding Artifacts</strong>
The body of a request through the Artifacts POST endpoint accepts a single binary file. -
#add_artifacts_by_system_id_with_http_info(system_id, filename, opts = {}) ⇒ Array<(ArtifactsResponsePutPost, Integer, Hash)>
Add one or many artifacts in a system <strong>Information About Adding Artifacts</strong><br> The body of a request through the Artifacts POST endpoint accepts a single binary file.
-
#delete_artifact(system_id, artifacts_request_delete_body_inner, opts = {}) ⇒ ArtifactsResponseDel
Remove one or many artifacts in a system Remove the Artifact(s) matching ‘systemId` path parameter and request body artifact(s) file name
. -
#delete_artifact_with_http_info(system_id, artifacts_request_delete_body_inner, opts = {}) ⇒ Array<(ArtifactsResponseDel, Integer, Hash)>
Remove one or many artifacts in a system Remove the Artifact(s) matching `systemId` path parameter and request body artifact(s) file name<br><br>.
-
#get_system_artifacts(system_id, opts = {}) ⇒ ArtifactsResponseGet
Get one or many artifacts in a system Returns selected artifacts matching parameters to include the file name containing the artifacts.
-
#get_system_artifacts_with_http_info(system_id, opts = {}) ⇒ Array<(ArtifactsResponseGet, Integer, Hash)>
Get one or many artifacts in a system Returns selected artifacts matching parameters to include the file name containing the artifacts.
-
#initialize(api_client = ApiClient.default) ⇒ ArtifactsApi
constructor
A new instance of ArtifactsApi.
-
#update_artifact_by_system_id(system_id, artifacts_required_fields, opts = {}) ⇒ ArtifactsResponsePutPost
Update one or many artifacts in a system Updates an artifact for given ‘systemId` path parameter
**Request Body Required Fields** - `filename` - `isTemplate` - `type` - `category` The example request provides all optional fields <strong>Information About Updating Artifacts</strong>
The PUT request will replace all existing data with the field/value combinations included in the request body. -
#update_artifact_by_system_id_with_http_info(system_id, artifacts_required_fields, opts = {}) ⇒ Array<(ArtifactsResponsePutPost, Integer, Hash)>
Update one or many artifacts in a system Updates an artifact for given `systemId` path parameter<br><br> **Request Body Required Fields** - `filename` - `isTemplate` - `type` - `category` The example request provides all optional fields <strong>Information About Updating Artifacts</strong><br> The PUT request will replace all existing data with the field/value combinations included in the request body.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ ArtifactsApi
Returns a new instance of ArtifactsApi.
19 20 21 |
# File 'lib/emass_client/api/artifacts_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/emass_client/api/artifacts_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#add_artifacts_by_system_id(system_id, filename, opts = {}) ⇒ ArtifactsResponsePutPost
Add one or many artifacts in a system <strong>Information About Adding Artifacts</strong>
The body of a request through the Artifacts POST endpoint accepts a single binary file. Two Artifact POST methods are currently accepted: individual and bulk. Filename uniqueness within an eMASS system will be enforced by the API for both methods.
For POST requests that should result in a single artifact, the request should include the file.
For POST requests that should result in the creation of many artifacts, the request should include a single file with the extension ".zip" only and the parameter isBulk should be set to true. This .zip file should contain one or more files corresponding to existing artifacts or new artifacts that will be created upon successful receipt.
Upon successful receipt of one or many artifacts, if a file is matched via filename to an artifact existing within the application, the file associated with the artifact will be updated. If no artifact is matched via filename to the application, a new artifact will be created with the following default values. Any values not specified below will be null <ul> <li>isTemplate: false</li> <li>type: Other</li> <li>category: Evidence</li> </ul> To update values other than the file itself, please submit a PUT request.
<strong>Business Rules</strong>
Artifact cannot be saved if the fields below exceed the following character limits: <ul> <li>Filename - 1,000 characters</li> <li>Name - 100 characters</li> <li>Description - 10,000 characters</li> <li>Reference Page Number - 50 characters</li> </ul> Artifact version cannot be saved if an Artifact with the same file name (filename) already exist in the system. Artifact cannot be saved if the file size exceeds 30MB. Artifact cannot be saved if the following fields are missing data: <ul> <li>Filename (filename)</li> <li>Type (type)</li> <li>Category (category)</li> </ul> Artifact cannot be saved if the Last Review Date (‘lastReviewedDate`) is set in the future.
32 33 34 35 |
# File 'lib/emass_client/api/artifacts_api.rb', line 32 def add_artifacts_by_system_id(system_id, filename, opts = {}) data, _status_code, _headers = add_artifacts_by_system_id_with_http_info(system_id, filename, opts) data end |
#add_artifacts_by_system_id_with_http_info(system_id, filename, opts = {}) ⇒ Array<(ArtifactsResponsePutPost, Integer, Hash)>
Add one or many artifacts in a system <strong>Information About Adding Artifacts</strong><br> The body of a request through the Artifacts POST endpoint accepts a single binary file. Two Artifact POST methods are currently accepted: individual and bulk. Filename uniqueness within an eMASS system will be enforced by the API for both methods. <br><br> For POST requests that should result in a single artifact, the request should include the file. <br><br> For POST requests that should result in the creation of many artifacts, the request should include a single file with the extension ".zip" only and the parameter isBulk should be set to true. This .zip file should contain one or more files corresponding to existing artifacts or new artifacts that will be created upon successful receipt. <br><br> Upon successful receipt of one or many artifacts, if a file is matched via filename to an artifact existing within the application, the file associated with the artifact will be updated. If no artifact is matched via filename to the application, a new artifact will be created with the following default values. Any values not specified below will be null <ul> <li>isTemplate: false</li> <li>type: Other</li> <li>category: Evidence</li> </ul> To update values other than the file itself, please submit a PUT request.<br> <strong>Business Rules</strong><br> Artifact cannot be saved if the fields below exceed the following character limits: <ul> <li>Filename - 1,000 characters</li> <li>Name - 100 characters</li> <li>Description - 10,000 characters</li> <li>Reference Page Number - 50 characters</li> </ul> Artifact version cannot be saved if an Artifact with the same file name (filename) already exist in the system. Artifact cannot be saved if the file size exceeds 30MB. Artifact cannot be saved if the following fields are missing data: <ul> <li>Filename (filename)</li> <li>Type (type)</li> <li>Category (category)</li> </ul> Artifact cannot be saved if the Last Review Date (`lastReviewedDate`) is set in the future.
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 101 102 103 104 105 106 107 |
# File 'lib/emass_client/api/artifacts_api.rb', line 47 def add_artifacts_by_system_id_with_http_info(system_id, filename, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ArtifactsApi.add_artifacts_by_system_id ...' end # verify the required parameter 'system_id' is set if @api_client.config.client_side_validation && system_id.nil? fail ArgumentError, "Missing the required parameter 'system_id' when calling ArtifactsApi.add_artifacts_by_system_id" end # verify the required parameter 'filename' is set if @api_client.config.client_side_validation && filename.nil? fail ArgumentError, "Missing the required parameter 'filename' when calling ArtifactsApi.add_artifacts_by_system_id" end # resource path local_var_path = '/api/systems/{systemId}/artifacts'.sub('{' + 'systemId' + '}', CGI.escape(system_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'isBulk'] = opts[:'is_bulk'] if !opts[:'is_bulk'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['filename'] = filename form_params['isTemplate'] = opts[:'is_template'] if !opts[:'is_template'].nil? form_params['type'] = opts[:'type'] if !opts[:'type'].nil? form_params['category'] = opts[:'category'] if !opts[:'category'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ArtifactsResponsePutPost' # auth_names auth_names = opts[:debug_auth_names] || ['apiKey', 'mockType', 'userId'] = opts.merge( :operation => :"ArtifactsApi.add_artifacts_by_system_id", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ArtifactsApi#add_artifacts_by_system_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_artifact(system_id, artifacts_request_delete_body_inner, opts = {}) ⇒ ArtifactsResponseDel
Remove one or many artifacts in a system Remove the Artifact(s) matching ‘systemId` path parameter and request body artifact(s) file name
115 116 117 118 |
# File 'lib/emass_client/api/artifacts_api.rb', line 115 def delete_artifact(system_id, artifacts_request_delete_body_inner, opts = {}) data, _status_code, _headers = delete_artifact_with_http_info(system_id, artifacts_request_delete_body_inner, opts) data end |
#delete_artifact_with_http_info(system_id, artifacts_request_delete_body_inner, opts = {}) ⇒ Array<(ArtifactsResponseDel, Integer, Hash)>
Remove one or many artifacts in a system Remove the Artifact(s) matching `systemId` path parameter and request body artifact(s) file name<br><br>
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 173 174 175 176 177 178 179 180 181 |
# File 'lib/emass_client/api/artifacts_api.rb', line 126 def delete_artifact_with_http_info(system_id, artifacts_request_delete_body_inner, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ArtifactsApi.delete_artifact ...' end # verify the required parameter 'system_id' is set if @api_client.config.client_side_validation && system_id.nil? fail ArgumentError, "Missing the required parameter 'system_id' when calling ArtifactsApi.delete_artifact" end # verify the required parameter 'artifacts_request_delete_body_inner' is set if @api_client.config.client_side_validation && artifacts_request_delete_body_inner.nil? fail ArgumentError, "Missing the required parameter 'artifacts_request_delete_body_inner' when calling ArtifactsApi.delete_artifact" end # resource path local_var_path = '/api/systems/{systemId}/artifacts'.sub('{' + 'systemId' + '}', CGI.escape(system_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(artifacts_request_delete_body_inner) # return_type return_type = opts[:debug_return_type] || 'ArtifactsResponseDel' # auth_names auth_names = opts[:debug_auth_names] || ['apiKey', 'mockType', 'userId'] = opts.merge( :operation => :"ArtifactsApi.delete_artifact", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ArtifactsApi#delete_artifact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_system_artifacts(system_id, opts = {}) ⇒ ArtifactsResponseGet
Get one or many artifacts in a system Returns selected artifacts matching parameters to include the file name containing the artifacts.
193 194 195 196 |
# File 'lib/emass_client/api/artifacts_api.rb', line 193 def get_system_artifacts(system_id, opts = {}) data, _status_code, _headers = get_system_artifacts_with_http_info(system_id, opts) data end |
#get_system_artifacts_with_http_info(system_id, opts = {}) ⇒ Array<(ArtifactsResponseGet, Integer, Hash)>
Get one or many artifacts in a system Returns selected artifacts matching parameters to include the file name containing the artifacts.
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/emass_client/api/artifacts_api.rb', line 208 def get_system_artifacts_with_http_info(system_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ArtifactsApi.get_system_artifacts ...' end # verify the required parameter 'system_id' is set if @api_client.config.client_side_validation && system_id.nil? fail ArgumentError, "Missing the required parameter 'system_id' when calling ArtifactsApi.get_system_artifacts" end # resource path local_var_path = '/api/systems/{systemId}/artifacts'.sub('{' + 'systemId' + '}', CGI.escape(system_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'filename'] = opts[:'filename'] if !opts[:'filename'].nil? query_params[:'controlAcronyms'] = opts[:'control_acronyms'] if !opts[:'control_acronyms'].nil? query_params[:'assessmentProcedures'] = opts[:'assessment_procedures'] if !opts[:'assessment_procedures'].nil? query_params[:'ccis'] = opts[:'ccis'] if !opts[:'ccis'].nil? query_params[:'systemOnly'] = opts[:'system_only'] if !opts[:'system_only'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ArtifactsResponseGet' # auth_names auth_names = opts[:debug_auth_names] || ['apiKey', 'mockType', 'userId'] = opts.merge( :operation => :"ArtifactsApi.get_system_artifacts", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ArtifactsApi#get_system_artifacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_artifact_by_system_id(system_id, artifacts_required_fields, opts = {}) ⇒ ArtifactsResponsePutPost
Update one or many artifacts in a system Updates an artifact for given ‘systemId` path parameter
**Request Body Required Fields** - `filename` - `isTemplate` - `type` - `category` The example request provides all optional fields <strong>Information About Updating Artifacts</strong>
The PUT request will replace all existing data with the field/value combinations included in the request body. If any fields are not included, the absent fields will become null. The fields `name` and `isTemplate` are non-nullable fields. If not specified in the PUT command they will default to the following: - `name=filename` - `isTemplate=false` Also, note that one-to-many fields (`controls` and `ccis`) will also be replaced with the values specified in the PUT. If existing `control or cci` mappings exist in eMASS, the values in the PUT will not append, but rather replace all existing control and cci mappings with the values in the request body.
267 268 269 270 |
# File 'lib/emass_client/api/artifacts_api.rb', line 267 def update_artifact_by_system_id(system_id, artifacts_required_fields, opts = {}) data, _status_code, _headers = update_artifact_by_system_id_with_http_info(system_id, artifacts_required_fields, opts) data end |
#update_artifact_by_system_id_with_http_info(system_id, artifacts_required_fields, opts = {}) ⇒ Array<(ArtifactsResponsePutPost, Integer, Hash)>
Update one or many artifacts in a system Updates an artifact for given `systemId` path parameter<br><br> **Request Body Required Fields** - `filename` - `isTemplate` - `type` - `category` The example request provides all optional fields <strong>Information About Updating Artifacts</strong><br> The PUT request will replace all existing data with the field/value combinations included in the request body. If any fields are not included, the absent fields will become null. The fields `name` and `isTemplate` are non-nullable fields. If not specified in the PUT command they will default to the following: - `name=filename` - `isTemplate=false` Also, note that one-to-many fields (`controls` and `ccis`) will also be replaced with the values specified in the PUT. If existing `control or cci` mappings exist in eMASS, the values in the PUT will not append, but rather replace all existing control and cci mappings with the values in the request body.
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
# File 'lib/emass_client/api/artifacts_api.rb', line 278 def update_artifact_by_system_id_with_http_info(system_id, artifacts_required_fields, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ArtifactsApi.update_artifact_by_system_id ...' end # verify the required parameter 'system_id' is set if @api_client.config.client_side_validation && system_id.nil? fail ArgumentError, "Missing the required parameter 'system_id' when calling ArtifactsApi.update_artifact_by_system_id" end # verify the required parameter 'artifacts_required_fields' is set if @api_client.config.client_side_validation && artifacts_required_fields.nil? fail ArgumentError, "Missing the required parameter 'artifacts_required_fields' when calling ArtifactsApi.update_artifact_by_system_id" end # resource path local_var_path = '/api/systems/{systemId}/artifacts'.sub('{' + 'systemId' + '}', CGI.escape(system_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(artifacts_required_fields) # return_type return_type = opts[:debug_return_type] || 'ArtifactsResponsePutPost' # auth_names auth_names = opts[:debug_auth_names] || ['apiKey', 'mockType', 'userId'] = opts.merge( :operation => :"ArtifactsApi.update_artifact_by_system_id", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ArtifactsApi#update_artifact_by_system_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |