Class: EmassClient::ArtifactsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/emass_client/api/artifacts_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_clientObject

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, zipper, opts = {}) ⇒ ArtifactsResponsePutPost

Add one or many artifacts in a system <strong>Information</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 cannot be saved if the file does not have an allowable file extension/type: .docx,.doc,.txt,.rtf,.xfdl,.xml,.mht,.mh,tml,.html,.htm,.pdf,.mdb,.accdb,.ppt, .pptx,.xls,.xlsx,.csv,.log,.jpeg,.jpg,.tiff,.bmp,.tif,.png,.gif,.zip,.rar,.msg, .vsd,.vsw,.vdx,.z#,.ckl,.avi,.vsdx Artifact version cannot be saved if an Artifact with the same file name 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</li> <li>Type</li> <li>Category</li> </ul> Artifact cannot be saved if the Last Review Date (‘lastReviewedDate`) is set in the future.

Parameters:

  • system_id (Integer)

    **System Id**: The unique system record identifier.

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

    the optional parameters

Options Hash (opts):

  • :is_bulk (Boolean)

    **Is Bulk**: If no value is specified, the default is false, and an individual artifact file is expected. When set to true, a .zip file is expected which can contain multiple artifact files&quot; (default to false)

  • :is_template (Boolean)
  • :type (String)
  • :category (String)

Returns:



32
33
34
35
# File 'lib/emass_client/api/artifacts_api.rb', line 32

def add_artifacts_by_system_id(system_id, zipper, opts = {})
  data, _status_code, _headers = add_artifacts_by_system_id_with_http_info(system_id, zipper, opts)
  data
end

#add_artifacts_by_system_id_with_http_info(system_id, zipper, opts = {}) ⇒ Array<(ArtifactsResponsePutPost, Integer, Hash)>

Add one or many artifacts in a system &lt;strong&gt;Information&lt;/strong&gt;&lt;br&gt; 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. &lt;br&gt;&lt;br&gt; For POST requests that should result in a single artifact, the request should include the file. &lt;br&gt;&lt;br&gt; For POST requests that should result in the creation of many artifacts, the request should include a single file with the extension &quot;.zip&quot; 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. &lt;br&gt;&lt;br&gt; 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 &lt;ul&gt; &lt;li&gt;isTemplate: false&lt;/li&gt; &lt;li&gt;type: Other&lt;/li&gt; &lt;li&gt;category: Evidence&lt;/li&gt; &lt;/ul&gt; To update values other than the file itself, please submit a PUT request.&lt;br&gt; &lt;strong&gt;Business Rules&lt;/strong&gt;&lt;br&gt; Artifact cannot be saved if the fields below exceed the following character limits: &lt;ul&gt; &lt;li&gt;Filename - 1,000 characters&lt;/li&gt; &lt;li&gt;Name - 100 characters&lt;/li&gt; &lt;li&gt;Description - 10,000 characters&lt;/li&gt; &lt;li&gt;Reference Page Number - 50 characters&lt;/li&gt; &lt;/ul&gt; Artifact cannot be saved if the file does not have an allowable file extension/type: .docx,.doc,.txt,.rtf,.xfdl,.xml,.mht,.mh,tml,.html,.htm,.pdf,.mdb,.accdb,.ppt, .pptx,.xls,.xlsx,.csv,.log,.jpeg,.jpg,.tiff,.bmp,.tif,.png,.gif,.zip,.rar,.msg, .vsd,.vsw,.vdx,.z#,.ckl,.avi,.vsdx Artifact version cannot be saved if an Artifact with the same file name 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: &lt;ul&gt; &lt;li&gt;Filename&lt;/li&gt; &lt;li&gt;Type&lt;/li&gt; &lt;li&gt;Category&lt;/li&gt; &lt;/ul&gt; Artifact cannot be saved if the Last Review Date (&#x60;lastReviewedDate&#x60;) is set in the future.

Parameters:

  • system_id (Integer)

    **System Id**: The unique system record identifier.

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

    the optional parameters

Options Hash (opts):

  • :is_bulk (Boolean)

    **Is Bulk**: If no value is specified, the default is false, and an individual artifact file is expected. When set to true, a .zip file is expected which can contain multiple artifact files&quot; (default to false)

  • :is_template (Boolean)
  • :type (String)
  • :category (String)

Returns:

  • (Array<(ArtifactsResponsePutPost, Integer, Hash)>)

    ArtifactsResponsePutPost data, response status code and response headers



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
108
109
110
111
112
113
114
115
# File 'lib/emass_client/api/artifacts_api.rb', line 47

def add_artifacts_by_system_id_with_http_info(system_id, zipper, 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 'zipper' is set
  if @api_client.config.client_side_validation && zipper.nil?
    fail ArgumentError, "Missing the required parameter 'zipper' when calling ArtifactsApi.add_artifacts_by_system_id"
  end
  allowable_values = ["Procedure", "Diagram", "Policy", "Labor", "Document", "Image", "Other", "Scan Result", "Auditor Report", "unknown_default_open_api"]
  if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])
    fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}"
  end
  allowable_values = ["Implementation Guidance", "Evidence", "unknown_default_open_api"]
  if @api_client.config.client_side_validation && opts[:'category'] && !allowable_values.include?(opts[:'category'])
    fail ArgumentError, "invalid value for \"category\", must be one of #{allowable_values}"
  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'])
  # 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['Zipper'] = zipper
  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']

  new_options = 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, new_options)
  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
Note: Multiple files can be deleted by providing multiple file names at the CL (comma delimited) Example: –files file1.txt, file2.txt

Parameters:

  • system_id (Integer)

    **System Id**: The unique system record identifier.

  • artifacts_request_delete_body_inner (Array<ArtifactsRequestDeleteBodyInner>)

    Delete artifact files for the given System Id

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

    the optional parameters

Returns:



123
124
125
126
# File 'lib/emass_client/api/artifacts_api.rb', line 123

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 &#x60;systemId&#x60; path parameter and request body artifact(s) file name&lt;br&gt;&lt;br&gt; &lt;b&gt;Note:&lt;/b&gt; Multiple files can be deleted by providing multiple file names at the CL (comma delimited) Example: –files file1.txt, file2.txt

Parameters:

  • system_id (Integer)

    **System Id**: The unique system record identifier.

  • artifacts_request_delete_body_inner (Array<ArtifactsRequestDeleteBodyInner>)

    Delete artifact files for the given System Id

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

    the optional parameters

Returns:

  • (Array<(ArtifactsResponseDel, Integer, Hash)>)

    ArtifactsResponseDel data, response status code and response headers



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
182
183
184
185
186
187
188
189
# File 'lib/emass_client/api/artifacts_api.rb', line 134

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'])
  # 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']

  new_options = 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, new_options)
  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.

Parameters:

  • system_id (Integer)

    **System Id**: The unique system record identifier.

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

    the optional parameters

Options Hash (opts):

  • :filename (String)

    **File Name**: The file name (to include file-extension).

  • :control_acronyms (String)

    **System Acronym**: Filter query by given system acronym (single or comma separated).

  • :ccis (String)

    **CCI System**: Filter query by Control Correlation Identifiers (CCIs) (single or comma separated).

  • :system_only (Boolean)

    **Systems Only**: Indicates that only system(s) information is retrieved. (default to true)

Returns:



200
201
202
203
# File 'lib/emass_client/api/artifacts_api.rb', line 200

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.

Parameters:

  • system_id (Integer)

    **System Id**: The unique system record identifier.

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

    the optional parameters

Options Hash (opts):

  • :filename (String)

    **File Name**: The file name (to include file-extension).

  • :control_acronyms (String)

    **System Acronym**: Filter query by given system acronym (single or comma separated).

  • :ccis (String)

    **CCI System**: Filter query by Control Correlation Identifiers (CCIs) (single or comma separated).

  • :system_only (Boolean)

    **Systems Only**: Indicates that only system(s) information is retrieved. (default to true)

Returns:

  • (Array<(ArtifactsResponseGet, Integer, Hash)>)

    ArtifactsResponseGet data, response status code and response headers



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
260
261
262
263
264
# File 'lib/emass_client/api/artifacts_api.rb', line 214

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[:'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'])

  # 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']

  new_options = 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, new_options)
  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, request_body, 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`

Parameters:

  • system_id (Integer)

    **System Id**: The unique system record identifier.

  • request_body (Array<Object>)

    See &#x60;information&#x60; above for additional instructions

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

    the optional parameters

Returns:



272
273
274
275
# File 'lib/emass_client/api/artifacts_api.rb', line 272

def update_artifact_by_system_id(system_id, request_body, opts = {})
  data, _status_code, _headers = update_artifact_by_system_id_with_http_info(system_id, request_body, opts)
  data
end

#update_artifact_by_system_id_with_http_info(system_id, request_body, opts = {}) ⇒ Array<(ArtifactsResponsePutPost, Integer, Hash)>

Update one or many artifacts in a system Updates an artifact for given &#x60;systemId&#x60; path parameter&lt;br&gt;&lt;br&gt; **Request Body Required Fields** - &#x60;filename&#x60; - &#x60;isTemplate&#x60; - &#x60;type&#x60; - &#x60;category&#x60;

Parameters:

  • system_id (Integer)

    **System Id**: The unique system record identifier.

  • request_body (Array<Object>)

    See &#x60;information&#x60; above for additional instructions

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

    the optional parameters

Returns:

  • (Array<(ArtifactsResponsePutPost, Integer, Hash)>)

    ArtifactsResponsePutPost data, response status code and response headers



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
334
335
336
337
338
# File 'lib/emass_client/api/artifacts_api.rb', line 283

def update_artifact_by_system_id_with_http_info(system_id, request_body, 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 'request_body' is set
  if @api_client.config.client_side_validation && request_body.nil?
    fail ArgumentError, "Missing the required parameter 'request_body' 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'])
  # 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(request_body)

  # return_type
  return_type = opts[:debug_return_type] || 'ArtifactsResponsePutPost'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apiKey', 'mockType', 'userId']

  new_options = 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, new_options)
  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