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, 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.

Parameters:

  • system_id (Integer)

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

  • filename (File)

    The file to upload. Must be a .zip file if isBulk is set to true, otherwise any acceptable artifact file. Max 30MB per artifact.

  • 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. (default to false)

  • :is_template (Boolean)

    Is the artifact a template? Indicates whether an artifact is a template

  • :type (String)

    The type of artifact. Possible values are: Procedure, Diagram, Policy, Labor, Document, Image, Other, Scan Result, Auditor Report. May also accept custom artifact type values set by system administrators.

  • :category (String)

    The category of artifact. Possible values are: Implementation Guidance, Evidence. May also accept custom artifact category values set by system administrators.

Returns:



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 &lt;strong&gt;Information About Adding Artifacts&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 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: &lt;ul&gt; &lt;li&gt;Filename (filename)&lt;/li&gt; &lt;li&gt;Type (type)&lt;/li&gt; &lt;li&gt;Category (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.

  • filename (File)

    The file to upload. Must be a .zip file if isBulk is set to true, otherwise any acceptable artifact file. Max 30MB per artifact.

  • 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. (default to false)

  • :is_template (Boolean)

    Is the artifact a template? Indicates whether an artifact is a template

  • :type (String)

    The type of artifact. Possible values are: Procedure, Diagram, Policy, Labor, Document, Image, Other, Scan Result, Auditor Report. May also accept custom artifact type values set by system administrators.

  • :category (String)

    The category of artifact. Possible values are: Implementation Guidance, Evidence. May also accept custom artifact category values set by system administrators.

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

  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

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:



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 &#x60;systemId&#x60; path parameter and request body artifact(s) file name&lt;br&gt;&lt;br&gt;

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



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

  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)

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

  • :assessment_procedures (String)

    **Assessment Procedure**: Filter query by given Security Control Assessment Procedure (single value or comma separated).

  • :ccis (String)

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

  • :system_only (Boolean)

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

Returns:



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.

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)

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

  • :assessment_procedures (String)

    **Assessment Procedure**: Filter query by given Security Control Assessment Procedure (single value or comma separated).

  • :ccis (String)

    **CCI System**: Filter query by Control Correlation Identifiers (CCIs) (single value 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



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

  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, 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.

Parameters:

  • system_id (Integer)

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

  • artifacts_required_fields (Array<ArtifactsRequiredFields>)

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

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

    the optional parameters

Returns:



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 &#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; The example request provides all optional fields &lt;strong&gt;Information About Updating Artifacts&lt;/strong&gt;&lt;br&gt; 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 &#x60;name&#x60; and &#x60;isTemplate&#x60; are non-nullable fields. If not specified in the PUT command they will default to the following: - &#x60;name&#x3D;filename&#x60; - &#x60;isTemplate&#x3D;false&#x60; Also, note that one-to-many fields (&#x60;controls&#x60; and &#x60;ccis&#x60;) will also be replaced with the values specified in the PUT. If existing &#x60;control or cci&#x60; 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.

Parameters:

  • system_id (Integer)

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

  • artifacts_required_fields (Array<ArtifactsRequiredFields>)

    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



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

  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