emasser 3.4.1 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.dockerignore +8 -8
  3. data/.env-example +12 -12
  4. data/.github/release-drafter.yml +15 -15
  5. data/.github/workflows/codeql-analysis.yml +70 -70
  6. data/.github/workflows/draft-release.yml +15 -15
  7. data/.github/workflows/gh-pages.yml +32 -32
  8. data/.github/workflows/push-to-docker-mail.yml +28 -28
  9. data/.github/workflows/push-to-docker.yml +35 -35
  10. data/.github/workflows/release.yml +42 -42
  11. data/.github/workflows/rubocop.yml +23 -23
  12. data/.github/workflows/test-cli.yml +39 -72
  13. data/.gitignore +19 -19
  14. data/.mergify.yml +25 -25
  15. data/.rubocop.yml +83 -80
  16. data/.rubocop_todo.yml +27 -27
  17. data/CHANGELOG.md +16 -16
  18. data/Dockerfile +44 -44
  19. data/Gemfile +8 -8
  20. data/Gemfile.lock +108 -104
  21. data/LICENSE.md +15 -15
  22. data/README.md +178 -178
  23. data/Rakefile +18 -18
  24. data/_config.yml +1 -1
  25. data/docs/features.md +1501 -1436
  26. data/docs/redoc/index.html +1230 -1230
  27. data/emasser.gemspec +44 -44
  28. data/exe/emasser +5 -5
  29. data/lib/emasser/cli.rb +37 -37
  30. data/lib/emasser/configuration.rb +49 -49
  31. data/lib/emasser/constants.rb +26 -26
  32. data/lib/emasser/delete.rb +148 -148
  33. data/lib/emasser/errors.rb +14 -14
  34. data/lib/emasser/get.rb +1194 -949
  35. data/lib/emasser/help/approvalCac_post_mapper.md +20 -20
  36. data/lib/emasser/help/approvalPac_post_mapper.md +20 -20
  37. data/lib/emasser/help/artifacts_del_mapper.md +9 -9
  38. data/lib/emasser/help/artifacts_post_mapper.md +59 -59
  39. data/lib/emasser/help/artifacts_put_mapper.md +34 -34
  40. data/lib/emasser/help/cloudresource_post_mapper.md +62 -62
  41. data/lib/emasser/help/cmmc_get_mapper.md +4 -4
  42. data/lib/emasser/help/container_post_mapper.md +44 -44
  43. data/lib/emasser/help/controls_put_mapper.md +74 -74
  44. data/lib/emasser/help/milestone_del_mapper.md +11 -11
  45. data/lib/emasser/help/milestone_post_mapper.md +14 -14
  46. data/lib/emasser/help/milestone_put_mapper.md +23 -23
  47. data/lib/emasser/help/poam_del_mapper.md +5 -5
  48. data/lib/emasser/help/poam_post_mapper.md +93 -93
  49. data/lib/emasser/help/poam_put_mapper.md +107 -107
  50. data/lib/emasser/help/staticcode_clear_mapper.md +16 -16
  51. data/lib/emasser/help/staticcode_post_mapper.md +21 -21
  52. data/lib/emasser/help/testresults_post_mapper.md +21 -21
  53. data/lib/emasser/help.rb +11 -11
  54. data/lib/emasser/input_converters.rb +21 -21
  55. data/lib/emasser/options_parser.rb +20 -20
  56. data/lib/emasser/output_converters.rb +115 -111
  57. data/lib/emasser/post.rb +830 -830
  58. data/lib/emasser/put.rb +588 -588
  59. data/lib/emasser/version.rb +5 -5
  60. data/lib/emasser.rb +19 -19
  61. metadata +16 -10
data/lib/emasser/get.rb CHANGED
@@ -1,949 +1,1194 @@
1
- # frozen_string_literal: true
2
-
3
- # rubocop:disable Naming/MethodName
4
-
5
- # Hack class that properly formats the CLI help
6
- class SubCommandBase < Thor
7
- include OptionsParser
8
- include InputConverters
9
- include OutputConverters
10
-
11
- # We do not control the method declaration for the banner
12
-
13
- # rubocop:disable Style/OptionalBooleanParameter
14
- def self.banner(command, _namespace = nil, subcommand = false)
15
- # Use the $thor_runner (declared by the Thor CLI framework)
16
- # to properly format the help text of sub-sub-commands.
17
-
18
- # rubocop:disable Style/GlobalVars
19
- if ancestors[0].to_s.include? '::Get'
20
- "#{basename} #{command.formatted_usage(self, $thor_runner, subcommand)}"
21
- else
22
- "#{basename} get #{command.formatted_usage(self, $thor_runner, subcommand)}"
23
- end
24
- # rubocop:enable Style/GlobalVars
25
- end
26
- # rubocop:enable Style/OptionalBooleanParameter
27
- end
28
-
29
- module Emasser
30
- # The Test Connection endpoint is provided by eMASS to verify and troubleshoot the
31
- # connection to the web service.
32
- #
33
- # Endpoint:
34
- # /api - Test connection to the API
35
- class Test < SubCommandBase
36
- def self.exit_on_failure?
37
- true
38
- end
39
-
40
- desc 'connection', 'Test connection to the API'
41
-
42
- def connection
43
- result = EmassClient::TestApi.new.test_connection
44
- puts to_output_hash(result).green
45
- rescue EmassClient::ApiError => e
46
- puts 'Exception when calling TestApi->test_connection'.red
47
- puts to_output_hash(e).yellow
48
- end
49
- end
50
-
51
- # The Systems endpoints provide the ability to view system information.
52
- #
53
- # Endpoint:
54
- # /api/systems - Get system information
55
- # /api/systems/{systemId} - Get system information for a specific system
56
- class System < SubCommandBase
57
- def self.exit_on_failure?
58
- true
59
- end
60
-
61
- desc 'id [--system_name [SYSTEM_NAME]] [--system_owner [SYSTEM_OWNER]]',
62
- 'Attempts to provide system ID of a system with name [NAME] and owner [SYSTEM_OWNER]'
63
-
64
- # Required parameters/fields
65
- option :system_name
66
- option :system_owner
67
-
68
- def id
69
- if options[:system_name].nil? && options[:system_owner].nil?
70
- raise ArgumentError,
71
- 'SYSTEM_NAME or SYSTEM_OWNER is required'
72
- end
73
-
74
- begin
75
- results = EmassClient::SystemsApi.new.get_systems
76
- results = filter_systems(results, options[:system_name], options[:system_owner])
77
- results.each { |result| puts "#{result[:systemId]} - #{result[:systemOwner]} - #{result[:name]}" }
78
- rescue EmassClient::ApiError => e
79
- puts 'Exception when calling SystemsApi->get_systems'
80
- puts to_output_hash(e).yellow
81
- end
82
- end
83
-
84
- # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
85
- no_commands do
86
- def filter_systems(results, system_name = nil, system_owner = nil)
87
- results = results.to_body if results.respond_to?(:to_body)
88
- if system_owner.nil?
89
- results[:data].filter { |result| result[:name].eql?(system_name) }
90
- elsif system_name.nil?
91
- results[:data].filter { |result| result[:systemOwner].eql?(system_owner) }
92
- else
93
- results[:data].filter { |result| result[:name].eql?(system_name) && result[:systemOwner].eql?(system_owner) }
94
- end
95
- end
96
- end
97
- # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
98
-
99
- desc "byId \[options\]", 'Retrieve a system - filtered by [options] params'
100
- option :systemId, type: :numeric, required: true,
101
- desc: 'A numeric value representing the system identification'
102
- option :includePackage, type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
103
- option :policy, type: :string, required: false, enum: %w[diacap rmf reporting]
104
-
105
- def byId
106
- optional_options_keys = optional_options(@_initializer).keys
107
- optional_options = to_input_hash(optional_options_keys, options)
108
- # optional_options.merge!(Emasser::GET_SYSTEM_RETURN_TYPE)
109
-
110
- begin
111
- # Get system information matching provided parameters
112
- result = EmassClient::SystemsApi.new.get_system(options[:systemId], optional_options)
113
- puts to_output_hash(result).green
114
- rescue EmassClient::ApiError => e
115
- puts 'Exception when calling SystemsApi->get_system'.red
116
- puts to_output_hash(e).yellow
117
- end
118
- end
119
- end
120
-
121
- class Systems < SubCommandBase
122
- def self.exit_on_failure?
123
- true
124
- end
125
-
126
- desc "all \[options\]", 'Retrieves all available system(s) - filtered by [options] params'
127
- # Optional parameters/fields
128
- option :registrationType,
129
- type: :string, required: false,
130
- enum: %w[assessAndAuthorize assessOnly guest regular functional cloudServiceProvider commonControlProvider]
131
- option :ditprId, type: :string, required: false,
132
- desc: 'DoD Information Technology (IT) Portfolio Repository (DITPR) string Id'
133
- option :coamsId, type: :string, required: false,
134
- desc: 'Cyber Operational Attributes Management System (COAMS) string Id'
135
- option :policy, type: :string, required: false, enum: %w[diacap rmf reporting]
136
-
137
- option :includePackage, type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
138
- option :includeDitprMetrics, type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
139
- option :includeDecommissioned, type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
140
- option :reportsForScorecard, type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
141
-
142
- def all
143
- optional_options_keys = optional_options(@_initializer).keys
144
- optional_options = to_input_hash(optional_options_keys, options)
145
- # optional_options.merge!(Emasser::GET_SYSTEM_RETURN_TYPE)
146
-
147
- begin
148
- # Get system information matching provided parameters
149
- result = EmassClient::SystemsApi.new.get_systems(optional_options)
150
- puts to_output_hash(result).green
151
- rescue EmassClient::ApiError => e
152
- puts 'Exception when calling SystemsApi->get_systems'.red
153
- puts to_output_hash(e).yellow
154
- end
155
- end
156
- end
157
-
158
- # The System Roles endpoints provides the ability to access user data assigned to systems.
159
- # Notes:
160
- # The endpoint can access three different role categories: PAC, CAC, and Other.
161
- # If a system is dual-policy enabled, the returned system role information will default
162
- # to the RMF policy information unless otherwise specified.
163
- #
164
- # Endpoint:
165
- # /api/system-roles - Get all available roles
166
- # /api/system-roles/{roleCategory} - Get system roles for provided role catgory
167
- class Roles < SubCommandBase
168
- def self.exit_on_failure?
169
- true
170
- end
171
-
172
- desc 'all', 'Retrieves all available system roles'
173
-
174
- def all
175
- result = EmassClient::SystemRolesApi.new.get_system_roles
176
- puts to_output_hash(result).green
177
- rescue EmassClient::ApiError => e
178
- puts 'Exception when calling SystemRolesApi->get_system_roles'.red
179
- puts to_output_hash(e).yellow
180
- end
181
-
182
- desc "byCategory \[options\]", 'Retrieves role(s) - filtered by [options] params'
183
- # Required parameters/fields
184
- option :roleCategory, type: :string, required: true, enum: %w[PAC CAC Other]
185
- option :role, type: :string, required: true,
186
- enum: ['AO', 'Auditor', 'Artifact Manager', 'C&A Team', 'IAO',
187
- 'ISSO', 'PM/IAM', 'SCA', 'User Rep', 'Validator']
188
- # Optional parameters/fields
189
- option :policy, type: :string, required: false, default: 'rmf', enum: %w[diacap rmf reporting]
190
- option :includeDecommissioned, type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
191
-
192
- def byCategory
193
- optional_options_keys = optional_options(@_initializer).keys
194
- optional_options = to_input_hash(optional_options_keys, options)
195
-
196
- begin
197
- result = EmassClient::SystemRolesApi.new.get_system_roles_by_category_id(options[:roleCategory],
198
- options[:role], optional_options)
199
- puts to_output_hash(result).green
200
- rescue EmassClient::ApiError => e
201
- puts 'Exception when calling SystemRolesApi->get_system_by_role_category_id'.red
202
- puts to_output_hash(e).yellow
203
- end
204
- end
205
- end
206
-
207
- # The Controls endpoints provide the ability to view Security Control information
208
- # of a system for both the Implementation Plan and Risk Assessment.
209
- #
210
- # Endpoint:
211
- # /api/systems/{systemId}/controls - Get control information in a system for one or many controls
212
- class Controls < SubCommandBase
213
- def self.exit_on_failure?
214
- true
215
- end
216
-
217
- desc 'forSystem', 'Get control information in a system for one or many controls (acronym)'
218
- # Required parameters/fields
219
- option :systemId, type: :numeric, required: true,
220
- desc: 'A numeric value representing the system identification'
221
- # Optional parameters/fields
222
- option :acronyms, type: :string, required: false,
223
- desc: 'The system acronym(s) e.g "AC-1, AC-2" - if not provided all controls for systemId are' \
224
- ' returned'
225
-
226
- def forSystem
227
- optional_options_keys = optional_options(@_initializer).keys
228
- optional_options = to_input_hash(optional_options_keys, options)
229
-
230
- begin
231
- result = EmassClient::ControlsApi.new.get_system_controls(options[:systemId], optional_options)
232
- puts to_output_hash(result).green
233
- rescue EmassClient::ApiError => e
234
- puts 'Exception when calling ControlsApi->get_system_controls'.red
235
- puts to_output_hash(e).yellow
236
- end
237
- end
238
- end
239
-
240
- # The Test Results endpoints provide the ability to view test results for a
241
- # system's Assessment Procedures (CCIs) which determine Security Control compliance.
242
- #
243
- # Endpoint:
244
- # /api/systems/{systemId}/test-results - Get one or many test results in a system
245
- class TestResults < SubCommandBase
246
- def self.exit_on_failure?
247
- true
248
- end
249
-
250
- desc 'forSystem', 'Get one or many test results in a system'
251
- # Required parameters/fields
252
- option :systemId, type: :numeric, required: true,
253
- desc: 'A numeric value representing the system identification'
254
- # Optional parameters/fields
255
- option :controlAcronyms, type: :string, required: false, desc: 'The system acronym(s) e.g "AC-1, AC-2"'
256
- option :ccis, type: :string, required: false, desc: 'The system CCIS string numerical value'
257
- option :latestOnly, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
258
-
259
- def forSystem
260
- optional_options_keys = optional_options(@_initializer).keys
261
- optional_options = to_input_hash(optional_options_keys, options)
262
-
263
- begin
264
- result = EmassClient::TestResultsApi.new.get_system_test_results(options[:systemId], optional_options)
265
- puts to_output_hash(result).green
266
- rescue EmassClient::ApiError => e
267
- puts 'Exception when calling TestResultsApi->get_system_test_results'.red
268
- puts to_output_hash(e).yellow
269
- end
270
- end
271
- end
272
-
273
- # The POA&Ms endpoints provide the ability to view Plan of Action and Milestones (POA&M)
274
- # items and associated milestones for a system.
275
- #
276
- # Endpoint:
277
- # /api/systems/{systemId}/poams - Get one or many POA&M items in a system
278
- # /api/systems/{systemId}/poams/{poamId} - Get POA&M item by ID in a system
279
- class Poams < SubCommandBase
280
- def self.exit_on_failure?
281
- true
282
- end
283
-
284
- # BY SYSTEM ID ------------------------------------------------------------------
285
- desc 'forSystem', 'Get one or many POA&M items in a system'
286
- # Required parameters/fields
287
- option :systemId, type: :numeric, required: true,
288
- desc: 'A numeric value representing the system identification'
289
- # Optional parameters/fields
290
- option :scheduledCompletionDateStart, type: :numeric, required: false,
291
- desc: 'The schedule completion start date - Unix time format.'
292
- option :scheduledCompletionDateEnd, type: :numeric, required: false,
293
- desc: 'The scheduled completion end date - Unix time format.'
294
- option :controlAcronyms, type: :string, required: false, desc: 'The system acronym(s) e.g "AC-1" or "AC-1, AC-2"'
295
- option :ccis, type: :string, required: false, desc: 'The system CCIS string numerical value e.g "000123" or "000123,000069"'
296
- option :systemOnly, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
297
-
298
- def forSystem
299
- optional_options_keys = optional_options(@_initializer).keys
300
- optional_options = to_input_hash(optional_options_keys, options)
301
-
302
- begin
303
- result = EmassClient::POAMApi.new.get_system_poams(options[:systemId], optional_options)
304
- puts to_output_hash(result).green
305
- rescue EmassClient::ApiError => e
306
- puts 'Exception when calling POAMApi->get_system_poams'.red
307
- puts to_output_hash(e).yellow
308
- end
309
- end
310
-
311
- # BY POAM ID --------------------------------------------------------------
312
- desc 'byPoamId', 'Get POA&M item for given systemId and poamId'
313
- # Required parameters/fields
314
- option :systemId, type: :numeric, required: true,
315
- desc: 'A numeric value representing the system identification'
316
- option :poamId, type: :numeric, required: true,
317
- desc: 'A numeric value representing the poam identification'
318
-
319
- def byPoamId
320
- result = EmassClient::POAMApi.new.get_system_poams_by_poam_id(options[:systemId], options[:poamId])
321
- puts to_output_hash(result).green
322
- rescue EmassClient::ApiError => e
323
- puts 'Exception when calling POAMApi->get_system_poams_by_poam_id'.red
324
- puts to_output_hash(e).yellow
325
- end
326
- end
327
-
328
- # The Milestones endpoints provide the ability to view milestones that are associated
329
- # with Plan of Action and Milestones (POA&M) items for a system.
330
- #
331
- # /api/systems/{systemId}/poams/{poamId}/milestones - Get milestones in one or many POA&M items in a system
332
- # /api/systems/{systemId}/poams/{poamId}/milestones/{milestoneId} - Get milestone by ID in POA&M item in a system
333
- class Milestones < SubCommandBase
334
- def self.exit_on_failure?
335
- true
336
- end
337
- # MILSTONES by SYSTEM and POAM ID -----------------------------------------
338
- desc 'byPoamId', 'Get milestone(s) for given specified system and poam'
339
- # Required parameters/fields
340
- option :systemId, type: :numeric, required: true,
341
- desc: 'A numeric value representing the system identification'
342
- option :poamId, type: :numeric, required: true,
343
- desc: 'A numeric value representing the poam identification'
344
- # Optional parameters/fields
345
- option :scheduledCompletionDateStart, type: :numeric, required: false,
346
- desc: 'The schedule completion start date - Unix time format.'
347
- option :scheduledCompletionDateEnd, type: :numeric, required: false,
348
- desc: 'The scheduled completion end date - Unix time format.'
349
-
350
- def byPoamId
351
- optional_options_keys = optional_options(@_initializer).keys
352
- optional_options = to_input_hash(optional_options_keys, options)
353
-
354
- begin
355
- # Get milestones in one or many poa&m items in a system
356
- result = EmassClient::MilestonesApi.new.get_system_milestones_by_poam_id(options[:systemId],
357
- options[:poamId], optional_options)
358
- puts to_output_hash(result).green
359
- rescue EmassClient::ApiError => e
360
- puts 'Exception when calling MilestonesApi->get_system_milestones_by_poam_id'.red
361
- puts to_output_hash(e).yellow
362
- end
363
- end
364
-
365
- # MILSTONES by SYSTEM, POAM, and MILESTONE ID -----------------------------------------
366
- desc 'byMilestoneId', 'Get milestone(s) for given specified system, poam, and milestone Id'
367
- # Required parameters/fields
368
- option :systemId, type: :numeric, required: true,
369
- desc: 'A numeric value representing the system identification'
370
- option :poamId, type: :numeric, required: true,
371
- desc: 'A numeric value representing the poam identification'
372
- option :milestoneId, type: :numeric, required: true,
373
- desc: 'A numeric value representing the milestone identification'
374
-
375
- def byMilestoneId
376
- result = EmassClient::MilestonesApi.new.get_system_milestones_by_poam_id_and_milestone_id(
377
- options[:systemId], options[:poamId], options[:milestoneId]
378
- )
379
- puts to_output_hash(result).green
380
- rescue EmassClient::ApiError => e
381
- puts 'Exception when calling MilestonesApi->get_system_milestones_by_poam_id_and_milestone_id'.red
382
- puts to_output_hash(e).yellow
383
- end
384
- end
385
-
386
- # The Artifact endpoints provide the ability to add new Artifacts
387
- # (supporting documentation/evidence for Security Control Assessments
388
- # and system Authorization activities) to a system.
389
- #
390
- # Endpoints:
391
- # /api/systems/{systemId}/artifacts - Get one or many artifacts in a system
392
- # /api/systems/{systemId}/artifacts-export - Get the file of an artifact in a system
393
- class Artifacts < SubCommandBase
394
- def self.exit_on_failure?
395
- true
396
- end
397
-
398
- desc 'forSystem', 'Get all system artifacts for a system Id'
399
- # Required parameters/fields
400
- option :systemId, type: :numeric, required: true,
401
- desc: 'A numeric value representing the system identification'
402
- # Optional parameters/fields
403
- option :filename, type: :string, required: false, desc: 'The artifact file name'
404
- option :controlAcronyms, type: :string, required: false, desc: 'The system acronym(s) e.g "AC-1, AC-2"'
405
- option :ccis, type: :string, required: false, desc: 'The system CCIS string numerical value'
406
- option :systemOnly, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
407
-
408
- def forSystem
409
- optional_options_keys = optional_options(@_initializer).keys
410
- optional_options = to_input_hash(optional_options_keys, options)
411
-
412
- begin
413
- # Get one or many artifacts in a system
414
- result = EmassClient::ArtifactsApi.new.get_system_artifacts(options[:systemId],
415
- optional_options)
416
- puts to_output_hash(result).green
417
- rescue EmassClient::ApiError => e
418
- puts 'Exception when calling ArtifactsApi->get_system_artifacts'.red
419
- puts to_output_hash(e).yellow
420
- end
421
- end
422
-
423
- desc 'export', 'Get artifact binary file associated with given filename'
424
- # Required parameters/fields
425
- option :systemId, type: :numeric, required: true,
426
- desc: 'A numeric value representing the system identification'
427
- option :filename, type: :string, required: true, desc: 'The artifact file name'
428
- option :compress, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
429
- # NOTE: compress is a required parameter, however Thor does not allow a boolean type to be required because it
430
- # automatically creates a --no-compress option, which is confusing in the help output:
431
- # [--compress], [--no-compress] # BOOLEAN - true or false.
432
-
433
- def export
434
- optional_options_keys = optional_options(@_initializer).keys
435
- optional_options = to_input_hash(optional_options_keys, options)
436
- optional_options.merge!(Emasser::GET_ARTIFACTS_RETURN_TYPE)
437
-
438
- result = EmassClient::ArtifactsExportApi.new.get_system_artifacts_export(
439
- options[:systemId], options[:filename], optional_options
440
- )
441
- if options[:compress]
442
- pp result
443
- else
444
- begin
445
- puts JSON.pretty_generate(JSON.parse(result)).green
446
- rescue StandardError
447
- puts result.red
448
- end
449
- end
450
- rescue EmassClient::ApiError => e
451
- puts 'Exception when calling ArtifactsApi->get_system_artifacts_export'.red
452
- puts to_output_hash(e).yellow
453
- end
454
- end
455
-
456
- # The Control Approval Chain (CAC) endpoints provide the ability to view the status of
457
- # Security Controls and submit them to the second stage in the Control Approval Chain
458
- # Note:
459
- # POST requests will only yield successful results if the Security Control is at the first
460
- # stage of the CAC. If the control is not at the first stage, an error will be returned.
461
- #
462
- # Endpoints:
463
- # /api/systems/{systemId}/approval/cac - Get location of one or many controls in CAC
464
- class CAC < SubCommandBase
465
- def self.exit_on_failure?
466
- true
467
- end
468
-
469
- desc 'controls', 'Get location of one or many controls in CAC'
470
- # Required parameters/fields
471
- option :systemId, type: :numeric, required: true,
472
- desc: 'A numeric value representing the system identification'
473
- # Optional parameters/fields
474
- option :controlAcronyms, type: :string, required: false,
475
- desc: 'The system acronym(s) e.g "AC-1, AC-2" - if not provided all CACs for systemId' \
476
- ' are returned'
477
-
478
- def controls
479
- optional_options_keys = optional_options(@_initializer).keys
480
- optional_options = to_input_hash(optional_options_keys, options)
481
-
482
- begin
483
- # Get location of one or many controls in CAC
484
- result = EmassClient::CACApi.new.get_system_cac(options[:systemId], optional_options)
485
- puts to_output_hash(result).green
486
- rescue EmassClient::ApiError => e
487
- puts 'Exception when calling ApprovalChainApi->get_system_cac'.red
488
- puts to_output_hash(e).yellow
489
- end
490
- end
491
- end
492
-
493
- # The Package Approval Chain (PAC) endpoints provide the ability to view the
494
- # status of existing workflows and initiate new workflows for a system.
495
- #
496
- # Notes:
497
- # - If the indicated system has any active workflows, the response will include
498
- # information such as the workflow type and the current stage of each workflow.
499
- # - If there are no active workflows, then a null data member will be returned.
500
- #
501
- # Endpoints:
502
- # /api/systems/{systemId}/approval/pac - Get location of system package in PAC
503
- class PAC < SubCommandBase
504
- def self.exit_on_failure?
505
- true
506
- end
507
-
508
- desc 'package', 'Get location of system package in PAC'
509
- # Required parameters/fields
510
- option :systemId, type: :numeric, required: true,
511
- desc: 'A numeric value representing the system identification'
512
-
513
- def package
514
- # Get location of system package in PAC
515
- result = EmassClient::PACApi.new.get_system_pac(options[:systemId])
516
- puts to_output_hash(result).green
517
- rescue EmassClient::ApiError => e
518
- puts 'Exception when calling ApprovalChainApi->get_system_'.red
519
- puts to_output_hash(e).yellow
520
- end
521
- end
522
-
523
- # The Cybersecurity Maturity Model Certification (CMMC) Assessments endpoint provides
524
- # the ability to view CMMC assessment information. It is available to CMMC eMASS only.
525
- #
526
- # Endpoints:
527
- # /api/cmmc-assessments - Get CMMC assessment information
528
- class CMMC < SubCommandBase
529
- def self.exit_on_failure?
530
- true
531
- end
532
-
533
- desc 'assessments', 'Get CMMC assessment information'
534
- long_desc Help.text(:cmmc_get_mapper)
535
-
536
- # Required parameters/fields
537
- option :sinceDate, type: :string, required: true, desc: 'The CMMC date. Unix date format'
538
-
539
- def assessments
540
- result = EmassClient::CMMCAssessmentsApi.new.get_cmmc_assessments(options[:sinceDate])
541
- puts to_output_hash(result).green
542
- rescue EmassClient::ApiError => e
543
- puts 'Exception when calling ApprovalChainApi->get_cmmc_assessments'.red
544
- puts to_output_hash(e).yellow
545
- end
546
- end
547
-
548
- # The Workflow Definitions endpoint provides the ability to view all workflow schemas
549
- # available on the eMASS instance. Every transition for each workflow stage is included.
550
- #
551
- # Endpoints:
552
- # /api/workflow-definitions - Get workflow definitions in a site
553
- class WorkflowDefinitions < SubCommandBase
554
- def self.exit_on_failure?
555
- true
556
- end
557
-
558
- desc 'forSite', 'Get location of system package in PAC'
559
-
560
- # Optional parameters/fields
561
- option :includeInactive, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
562
- option :registrationType,
563
- type: :string, required: false,
564
- enum: %w[assessAndAuthorize assessOnly guest regular functional cloudServiceProvider commonControlProvider]
565
-
566
- def forSite
567
- optional_options_keys = optional_options(@_initializer).keys
568
- optional_options = to_input_hash(optional_options_keys, options)
569
-
570
- result = EmassClient::WorkflowDefinitionsApi.new.get_workflow_definitions(optional_options)
571
- puts to_output_hash(result).green
572
- rescue EmassClient::ApiError => e
573
- puts 'Exception when calling ApprovalChainApi->get_workflow_definitions'.red
574
- puts to_output_hash(e).yellow
575
- end
576
- end
577
-
578
- # The Workflow Instances endpoint provides the ability to view detailed information on all
579
- # active and historical workflows for a system.
580
- #
581
- # Endpoints:
582
- # /api/workflows/instances - Get workflow instances in a site
583
- # /api/workflows/instances/{workflowInstanceId} - Get workflow instance by ID
584
- class WorkflowInstances < SubCommandBase
585
- def self.exit_on_failure?
586
- true
587
- end
588
-
589
- desc 'all', 'Get workflow instances in a site'
590
-
591
- # Optional parameters/fields
592
- option :includeComments, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
593
- option :pageIndex, type: :numeric, required: false, desc: 'The page number to be returned'
594
- option :sinceDate, type: :string, required: false, desc: 'The workflow instance date. Unix date format'
595
- option :status, type: :string, required: false, enum: %w[active inactive all]
596
-
597
- def all
598
- optional_options_keys = optional_options(@_initializer).keys
599
- optional_options = to_input_hash(optional_options_keys, options)
600
-
601
- result = EmassClient::WorkflowInstancesApi.new.get_system_workflow_instances(optional_options)
602
- puts to_output_hash(result).green
603
- rescue EmassClient::ApiError => e
604
- puts 'Exception when calling ApprovalChainApi->get_system_workflow_instances'.red
605
- puts to_output_hash(e).yellow
606
- end
607
-
608
- # Workflow by workflowInstanceId ---------------------------------------------------------
609
- desc 'byInstanceId', 'Get workflow instance by ID'
610
-
611
- # Required parameters/fields
612
- option :workflowInstanceId, type: :numeric, required: true,
613
- desc: 'A numeric value representing the workflowInstance identification'
614
-
615
- def byInstanceId
616
- opts = Emasser::GET_WORKFLOWINSTANCES_RETURN_TYPE
617
- result = EmassClient::WorkflowInstancesApi.new
618
- .get_system_workflow_instances_by_workflow_instance_id(options[:workflowInstanceId], opts)
619
- puts to_output_hash(result).green
620
- rescue EmassClient::ApiError => e
621
- puts 'Exception when calling ApprovalChainApi->get_system_workflow_instances_by_workflow_instance_id'.red
622
- puts to_output_hash(e).yellow
623
- end
624
- end
625
-
626
- # The Dashboards endpoints provide the ability to view data contained in dashboard exports.
627
- # In the eMASS front end, these dashboard exports are generated as Excel exports.
628
- # Each dashboard dataset available from the API is automatically updated with the current
629
- # configuration of the dashboard and the instance of eMASS as the dashboard changes.
630
- #
631
- # Endpoints:
632
- # /api/dashboards/system-status-details - Get systems status detail dashboard information
633
- # /api/dashboards/system-control-compliance-summary - Get systems control compliance summary dashboard information
634
- # /api/dashboards/system-security-controls-details - Get systems security control details dashboard information
635
- # /api/dashboards/system-assessment-procedures-details - Get systems assessment procedures details dashboard information
636
- # /api/dashboards/system-poam-summary - Get systems POA&Ms summary dashboard information
637
- # /api/dashboards/system-poam-details - Get system POA&Ms details dashboard information
638
- # /api/dashboards/system-hardware-summary - Get system hardware summary dashboard information
639
- # /api/dashboards/system-hardware-details - Get system hardware details dashboard information
640
- # /api/dashboards/system-associations-details - Get system associations details dashboard information
641
- # /api/dashboards/user-system-assignments-details - Get user system assignments details dashboard information
642
- # /api/dashboards/system-privacy-summary - Get user system privacy summary dashboard information
643
- # /api/dashboards/va-omb-fisma-saop-summary - Get VA OMB-FISMA SAOP summary dashboard information
644
- # /api/dashboards/va-system-aa-summary - Get VA system A&A summary dashboard information
645
- # /api/dashboards/va-system-a2-summary - Get VA system A2.0 summary dashboard information
646
- # /api/dashboards/va-system-pl-109-reporting-summary - Get VA System P.L. 109 reporting summary dashboard information
647
- # /api/dashboards/va-system-fisma-inventory-summary - Get VA system FISMA inventory summary dashboard information
648
- class Dashboards < SubCommandBase
649
- def self.exit_on_failure?
650
- true
651
- end
652
-
653
- # Required parameters/fields
654
- class_option :orgId, type: :numeric, required: true,
655
- desc: 'A numeric value representing the system identification'
656
-
657
- # Optional parameters/fields
658
- class_option :pageIndex, type: :numeric, required: false, desc: 'The page number to be returned, if not specified starts at page 0'
659
- class_option :pageSize, type: :numeric, required: false, desc: 'The total entries per page, default is 20,000'
660
-
661
- # /api/dashboards/system-status-details
662
- desc 'status_details', 'Get systems status detail dashboard information'
663
- def status_details
664
- optional_options_keys = optional_options(@_initializer).keys
665
- optional_options = to_input_hash(optional_options_keys, options)
666
-
667
- result = EmassClient::DashboardsApi.new.get_system_status_details(
668
- options[:orgId], optional_options
669
- )
670
- puts to_output_hash(result).green
671
- rescue EmassClient::ApiError => e
672
- puts 'Exception when calling DashboardsApi->get_system_status_details'.red
673
- puts to_output_hash(e).yellow
674
- end
675
-
676
- # /api/dashboards/system-control-compliance-summary
677
- desc 'control_compliance_summary', 'Get systems control compliance summary dashboard information'
678
- def control_compliance_summary
679
- optional_options_keys = optional_options(@_initializer).keys
680
- optional_options = to_input_hash(optional_options_keys, options)
681
-
682
- result = EmassClient::DashboardsApi.new.get_system_control_compliance_summary(
683
- options[:orgId], optional_options
684
- )
685
- puts to_output_hash(result).green
686
- rescue EmassClient::ApiError => e
687
- puts 'Exception when calling DashboardsApi->get_system_control_compliance_summary'.red
688
- puts to_output_hash(e).yellow
689
- end
690
-
691
- # /api/dashboards/system-security-controls-details
692
- desc 'security_control_details', 'Get systems security control details dashboard information'
693
- def security_control_details
694
- optional_options_keys = optional_options(@_initializer).keys
695
- optional_options = to_input_hash(optional_options_keys, options)
696
-
697
- result = EmassClient::DashboardsApi.new.get_system_security_control_details(
698
- options[:orgId], optional_options
699
- )
700
- puts to_output_hash(result).green
701
- rescue EmassClient::ApiError => e
702
- puts 'Exception when calling DashboardsApi->get_system_security_control_details'.red
703
- puts to_output_hash(e).yellow
704
- end
705
-
706
- # /api/dashboards/system-security-controls-details
707
- desc 'assessment_procedures_details', 'Get systems assessment procedures details dashboard information'
708
- def assessment_procedures_details
709
- optional_options_keys = optional_options(@_initializer).keys
710
- optional_options = to_input_hash(optional_options_keys, options)
711
-
712
- result = EmassClient::DashboardsApi.new.get_system_assessment_procedures_details(
713
- options[:orgId], optional_options
714
- )
715
- puts to_output_hash(result).green
716
- rescue EmassClient::ApiError => e
717
- puts 'Exception when calling DashboardsApi->get_system_assessment_procedures_details'.red
718
- puts to_output_hash(e).yellow
719
- end
720
-
721
- # /api/dashboards/system-poam-summary
722
- desc 'poam_summary', 'Get systems POA&Ms summary dashboard information'
723
- def poam_summary
724
- optional_options_keys = optional_options(@_initializer).keys
725
- optional_options = to_input_hash(optional_options_keys, options)
726
-
727
- result = EmassClient::DashboardsApi.new.get_system_poam_summary(
728
- options[:orgId], optional_options
729
- )
730
- puts to_output_hash(result).green
731
- rescue EmassClient::ApiError => e
732
- puts 'Exception when calling DashboardsApi->get_system_poam_summary'.red
733
- puts to_output_hash(e).yellow
734
- end
735
-
736
- # /api/dashboards/system-poam-details
737
- desc 'poam_details', 'Get system POA&Ms details dashboard information'
738
- def poam_details
739
- optional_options_keys = optional_options(@_initializer).keys
740
- optional_options = to_input_hash(optional_options_keys, options)
741
-
742
- result = EmassClient::DashboardsApi.new.get_system_poam_details(
743
- options[:orgId], optional_options
744
- )
745
- puts to_output_hash(result).green
746
- rescue EmassClient::ApiError => e
747
- puts 'Exception when calling DashboardsApi->get_system_poam_details'.red
748
- puts to_output_hash(e).yellow
749
- end
750
-
751
- # /api/dashboards/system-hardware-summary
752
- desc 'hardware_summary', 'Get system hardware summary dashboard information'
753
- def hardware_summary
754
- optional_options_keys = optional_options(@_initializer).keys
755
- optional_options = to_input_hash(optional_options_keys, options)
756
-
757
- result = EmassClient::DashboardsApi.new.get_system_hardware_summary(
758
- options[:orgId], optional_options
759
- )
760
- puts to_output_hash(result).green
761
- rescue EmassClient::ApiError => e
762
- puts 'Exception when calling DashboardsApi->get_system_hardware_summary'.red
763
- puts to_output_hash(e).yellow
764
- end
765
-
766
- # /api/dashboards/system-hardware-details
767
- desc 'hardware_details', 'Get system hardware details dashboard information'
768
- def hardware_details
769
- optional_options_keys = optional_options(@_initializer).keys
770
- optional_options = to_input_hash(optional_options_keys, options)
771
-
772
- result = EmassClient::DashboardsApi.new.get_system_hardware_details(
773
- options[:orgId], optional_options
774
- )
775
- puts to_output_hash(result).green
776
- rescue EmassClient::ApiError => e
777
- puts 'Exception when calling DashboardsApi->get_system_hardware_details'.red
778
- puts to_output_hash(e).yellow
779
- end
780
-
781
- # /api/dashboards/system-associations-details
782
- desc 'associations_details', 'Get system associations details dashboard information'
783
- def associations_details
784
- optional_options_keys = optional_options(@_initializer).keys
785
- optional_options = to_input_hash(optional_options_keys, options)
786
-
787
- result = EmassClient::DashboardsApi.new.get_system_associations_details(
788
- options[:orgId], optional_options
789
- )
790
- puts to_output_hash(result).green
791
- rescue EmassClient::ApiError => e
792
- puts 'Exception when calling DashboardsApi->get_system_associations_details'.red
793
- puts to_output_hash(e).yellow
794
- end
795
-
796
- # /api/dashboards/user-system-assignments-details
797
- desc 'assignments_details', 'Get user system assignments details dashboard information'
798
- def assignments_details
799
- optional_options_keys = optional_options(@_initializer).keys
800
- optional_options = to_input_hash(optional_options_keys, options)
801
-
802
- result = EmassClient::DashboardsApi.new.get_user_system_assignments_details(
803
- options[:orgId], optional_options
804
- )
805
- puts to_output_hash(result).green
806
- rescue EmassClient::ApiError => e
807
- puts 'Exception when calling DashboardsApi->get_user_system_assignments_details'.red
808
- puts to_output_hash(e).yellow
809
- end
810
-
811
- # /api/dashboards/system-privacy-summary
812
- desc 'privacy_summary', 'Get user system privacy summary dashboard information'
813
- def privacy_summary
814
- optional_options_keys = optional_options(@_initializer).keys
815
- optional_options = to_input_hash(optional_options_keys, options)
816
-
817
- result = EmassClient::DashboardsApi.new.get_system_privacy_summary(
818
- options[:orgId], optional_options
819
- )
820
- puts to_output_hash(result).green
821
- rescue EmassClient::ApiError => e
822
- puts 'Exception when calling DashboardsApi->get_system_privacy_summary'.red
823
- puts to_output_hash(e).yellow
824
- end
825
-
826
- # /api/dashboards/va-omb-fisma-saop-summary
827
- desc 'fisma_saop_summary', 'Get VA OMB-FISMA SAOP summary dashboard information'
828
- def fisma_saop_summary
829
- optional_options_keys = optional_options(@_initializer).keys
830
- optional_options = to_input_hash(optional_options_keys, options)
831
-
832
- result = EmassClient::DashboardsApi.new.get_va_omb_fsma_saop_summary(
833
- options[:orgId], optional_options
834
- )
835
- puts to_output_hash(result).green
836
- rescue EmassClient::ApiError => e
837
- puts 'Exception when calling DashboardsApi->get_va_omb_fsma_saop_summary'.red
838
- puts to_output_hash(e).yellow
839
- end
840
-
841
- # /api/dashboards/va-system-aa-summary
842
- desc 'va_aa_summary', 'Get VA system A&A summary dashboard information'
843
- def va_aa_summary
844
- optional_options_keys = optional_options(@_initializer).keys
845
- optional_options = to_input_hash(optional_options_keys, options)
846
-
847
- result = EmassClient::DashboardsApi.new.get_va_system_aa_summary(
848
- options[:orgId], optional_options
849
- )
850
- puts to_output_hash(result).green
851
- rescue EmassClient::ApiError => e
852
- puts 'Exception when calling DashboardsApi->get_va_system_aa_summary'.red
853
- puts to_output_hash(e).yellow
854
- end
855
-
856
- # /api/dashboards/va-system-a2-summary
857
- desc 'va_a2_summary', 'Get VA system A2.0 summary dashboard information'
858
- def va_a2_summary
859
- optional_options_keys = optional_options(@_initializer).keys
860
- optional_options = to_input_hash(optional_options_keys, options)
861
-
862
- result = EmassClient::DashboardsApi.new.get_va_system_a2_summary(
863
- options[:orgId], optional_options
864
- )
865
- puts to_output_hash(result).green
866
- rescue EmassClient::ApiError => e
867
- puts 'Exception when calling DashboardsApi->get_va_system_a2_summary'.red
868
- puts to_output_hash(e).yellow
869
- end
870
-
871
- # /api/dashboards/va-system-pl-109-reporting-summary
872
- desc 'va_pl_109_summary', 'Get VA System P.L. 109 reporting summary dashboard information'
873
- def va_pl_109_summary
874
- optional_options_keys = optional_options(@_initializer).keys
875
- optional_options = to_input_hash(optional_options_keys, options)
876
-
877
- result = EmassClient::DashboardsApi.new.get_va_system_pl109_reporting_summary(
878
- options[:orgId], optional_options
879
- )
880
- puts to_output_hash(result).green
881
- rescue EmassClient::ApiError => e
882
- puts 'Exception when calling DashboardsApi->get_va_system_pl109_reporting_summary'.red
883
- puts to_output_hash(e).yellow
884
- end
885
-
886
- # /api/dashboards/va-system-fisma-inventory-summary
887
- desc 'fisma_inventory_summary', 'Get VA system FISMA inventory summary dashboard information'
888
- def fisma_inventory_summary
889
- optional_options_keys = optional_options(@_initializer).keys
890
- optional_options = to_input_hash(optional_options_keys, options)
891
-
892
- result = EmassClient::DashboardsApi.new.get_va_system_fisma_invetory_summary(
893
- options[:orgId], optional_options
894
- )
895
- puts to_output_hash(result).green
896
- rescue EmassClient::ApiError => e
897
- puts 'Exception when calling DashboardsApi->get_va_system_fisma_invetory_summary'.red
898
- puts to_output_hash(e).yellow
899
- end
900
- end
901
-
902
- class Get < SubCommandBase
903
- desc 'test', 'Test connection to the configured eMASS server'
904
- subcommand 'test', Test
905
-
906
- desc 'system', 'Get a system ID given name/owner, or get a system by ID'
907
- subcommand 'system', System
908
-
909
- desc 'systems', 'Get all systems'
910
- subcommand 'systems', Systems
911
-
912
- desc 'roles', 'Get all system roles or by category Id'
913
- subcommand 'roles', Roles
914
-
915
- desc 'controls', 'Get system Controls'
916
- subcommand 'controls', Controls
917
-
918
- desc 'test_results', 'Get system Test Results'
919
- subcommand 'test_results', TestResults
920
-
921
- desc 'poams', 'Get system Poams'
922
- subcommand 'poams', Poams
923
-
924
- desc 'milestones', 'Get system Milestones'
925
- subcommand 'milestones', Milestones
926
-
927
- desc 'artifacts', 'Get system Artifacts'
928
- subcommand 'artifacts', Artifacts
929
-
930
- desc 'cac', 'Get location of one or many controls in CAC'
931
- subcommand 'cac', CAC
932
-
933
- desc 'pac', 'Get status of active workflows in a system'
934
- subcommand 'pac', PAC
935
-
936
- desc 'cmmc', 'Get CMMC assessment information'
937
- subcommand 'cmmc', CMMC
938
-
939
- desc 'workflow_definitions', 'Get workflow definitions in a site'
940
- subcommand 'workflow_definitions', WorkflowDefinitions
941
-
942
- desc 'workflow_instances', 'Get workflow instance by system and/or ID in a system'
943
- subcommand 'workflow_instances', WorkflowInstances
944
-
945
- desc 'dashboards', 'Get dashboard information'
946
- subcommand 'dashboards', Dashboards
947
- end
948
- end
949
- # rubocop:enable Naming/MethodName
1
+ # frozen_string_literal: true
2
+
3
+ # rubocop:disable Naming/MethodName
4
+
5
+ # Hack class that properly formats the CLI help
6
+ class SubCommandBase < Thor
7
+ include OptionsParser
8
+ include InputConverters
9
+ include OutputConverters
10
+
11
+ # We do not control the method declaration for the banner
12
+
13
+ # rubocop:disable Style/OptionalBooleanParameter
14
+ def self.banner(command, _namespace = nil, subcommand = false)
15
+ # Use the $thor_runner (declared by the Thor CLI framework)
16
+ # to properly format the help text of sub-sub-commands.
17
+
18
+ # rubocop:disable Style/GlobalVars
19
+ if ancestors[0].to_s.include? '::Get'
20
+ "#{basename} #{command.formatted_usage(self, $thor_runner, subcommand)}"
21
+ else
22
+ "#{basename} get #{command.formatted_usage(self, $thor_runner, subcommand)}"
23
+ end
24
+ # rubocop:enable Style/GlobalVars
25
+ end
26
+ # rubocop:enable Style/OptionalBooleanParameter
27
+ end
28
+
29
+ module Emasser
30
+ # The Test Connection endpoint is provided by eMASS to verify and troubleshoot the
31
+ # connection to the web service.
32
+ #
33
+ # Endpoint:
34
+ # /api - Test connection to the API
35
+ class Test < SubCommandBase
36
+ def self.exit_on_failure?
37
+ true
38
+ end
39
+
40
+ desc 'connection', 'Test connection to the API'
41
+
42
+ def connection
43
+ result = EmassClient::TestApi.new.test_connection
44
+ puts to_output_hash(result).green
45
+ rescue EmassClient::ApiError => e
46
+ puts 'Exception when calling TestApi->test_connection'.red
47
+ puts to_output_hash(e).yellow
48
+ end
49
+ end
50
+
51
+ # The Systems endpoints provide the ability to view system information.
52
+ #
53
+ # Endpoint:
54
+ # /api/systems - Get system information
55
+ # /api/systems/{systemId} - Get system information for a specific system
56
+ class System < SubCommandBase
57
+ def self.exit_on_failure?
58
+ true
59
+ end
60
+
61
+ desc 'id [--system_name [SYSTEM_NAME]] [--system_owner [SYSTEM_OWNER]]',
62
+ 'Attempts to provide system ID of a system with name [NAME] and owner [SYSTEM_OWNER]'
63
+
64
+ # Required parameters/fields
65
+ option :system_name
66
+ option :system_owner
67
+
68
+ def id
69
+ if options[:system_name].nil? && options[:system_owner].nil?
70
+ raise ArgumentError,
71
+ 'SYSTEM_NAME or SYSTEM_OWNER is required'
72
+ end
73
+
74
+ begin
75
+ results = EmassClient::SystemsApi.new.get_systems
76
+ results = filter_systems(results, options[:system_name], options[:system_owner])
77
+ results.each { |result| puts "#{result[:systemId]} - #{result[:systemOwner]} - #{result[:name]}" }
78
+ rescue EmassClient::ApiError => e
79
+ puts 'Exception when calling SystemsApi->get_systems'
80
+ puts to_output_hash(e).yellow
81
+ end
82
+ end
83
+
84
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
85
+ no_commands do
86
+ def filter_systems(results, system_name = nil, system_owner = nil)
87
+ results = results.to_body if results.respond_to?(:to_body)
88
+ if system_owner.nil?
89
+ results[:data].filter { |result| result[:name].eql?(system_name) }
90
+ elsif system_name.nil?
91
+ results[:data].filter { |result| result[:systemOwner].eql?(system_owner) }
92
+ else
93
+ results[:data].filter { |result| result[:name].eql?(system_name) && result[:systemOwner].eql?(system_owner) }
94
+ end
95
+ end
96
+ end
97
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
98
+
99
+ desc 'byId [options]', 'Retrieve a system - filtered by [options] params'
100
+ option :systemId, type: :numeric, required: true,
101
+ desc: 'A numeric value representing the system identification'
102
+ option :includePackage, type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
103
+ option :policy, type: :string, required: false, enum: %w[diacap rmf reporting]
104
+
105
+ def byId
106
+ optional_options_keys = optional_options(@_initializer).keys
107
+ optional_options = to_input_hash(optional_options_keys, options)
108
+ # optional_options.merge!(Emasser::GET_SYSTEM_RETURN_TYPE)
109
+
110
+ begin
111
+ # Get system information matching provided parameters
112
+ result = EmassClient::SystemsApi.new.get_system(options[:systemId], optional_options)
113
+ puts to_output_hash(result).green
114
+ rescue EmassClient::ApiError => e
115
+ puts 'Exception when calling SystemsApi->get_system'.red
116
+ puts to_output_hash(e).yellow
117
+ end
118
+ end
119
+ end
120
+
121
+ class Systems < SubCommandBase
122
+ def self.exit_on_failure?
123
+ true
124
+ end
125
+
126
+ desc 'all [options]', 'Retrieves all available system(s) - filtered by [options] params'
127
+ # Optional parameters/fields
128
+ option :registrationType,
129
+ type: :string, required: false,
130
+ enum: %w[assessAndAuthorize assessOnly guest regular functional cloudServiceProvider commonControlProvider]
131
+ option :ditprId, type: :string, required: false,
132
+ desc: 'DoD Information Technology (IT) Portfolio Repository (DITPR) string Id'
133
+ option :coamsId, type: :string, required: false,
134
+ desc: 'Cyber Operational Attributes Management System (COAMS) string Id'
135
+ option :policy, type: :string, required: false, enum: %w[diacap rmf reporting]
136
+
137
+ option :includePackage, type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
138
+ option :includeDitprMetrics, type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
139
+ option :includeDecommissioned, type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
140
+ option :reportsForScorecard, type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
141
+
142
+ def all
143
+ optional_options_keys = optional_options(@_initializer).keys
144
+ optional_options = to_input_hash(optional_options_keys, options)
145
+ # optional_options.merge!(Emasser::GET_SYSTEM_RETURN_TYPE)
146
+
147
+ begin
148
+ # Get system information matching provided parameters
149
+ result = EmassClient::SystemsApi.new.get_systems(optional_options)
150
+ puts to_output_hash(result).green
151
+ rescue EmassClient::ApiError => e
152
+ puts 'Exception when calling SystemsApi->get_systems'.red
153
+ puts to_output_hash(e).yellow
154
+ end
155
+ end
156
+ end
157
+
158
+ # The System Roles endpoints provides the ability to access user data assigned to systems.
159
+ # Notes:
160
+ # The endpoint can access three different role categories: PAC, CAC, and Other.
161
+ # If a system is dual-policy enabled, the returned system role information will default
162
+ # to the RMF policy information unless otherwise specified.
163
+ #
164
+ # Endpoint:
165
+ # /api/system-roles - Get all available roles
166
+ # /api/system-roles/{roleCategory} - Get system roles for provided role catgory
167
+ class Roles < SubCommandBase
168
+ def self.exit_on_failure?
169
+ true
170
+ end
171
+
172
+ desc 'all', 'Retrieves all available system roles'
173
+
174
+ def all
175
+ result = EmassClient::SystemRolesApi.new.get_system_roles
176
+ puts to_output_hash(result).green
177
+ rescue EmassClient::ApiError => e
178
+ puts 'Exception when calling SystemRolesApi->get_system_roles'.red
179
+ puts to_output_hash(e).yellow
180
+ end
181
+
182
+ desc 'byCategory [options]', 'Retrieves role(s) - filtered by [options] params'
183
+ # Required parameters/fields
184
+ option :roleCategory, type: :string, required: true, enum: %w[PAC CAC Other]
185
+ option :role, type: :string, required: true,
186
+ enum: ['AO', 'Auditor', 'Artifact Manager', 'C&A Team', 'IAO',
187
+ 'ISSO', 'PM/IAM', 'SCA', 'User Rep', 'Validator']
188
+ # Optional parameters/fields
189
+ option :policy, type: :string, required: false, default: 'rmf', enum: %w[diacap rmf reporting]
190
+ option :includeDecommissioned, type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
191
+
192
+ def byCategory
193
+ optional_options_keys = optional_options(@_initializer).keys
194
+ optional_options = to_input_hash(optional_options_keys, options)
195
+
196
+ begin
197
+ result = EmassClient::SystemRolesApi.new.get_system_roles_by_category_id(options[:roleCategory],
198
+ options[:role], optional_options)
199
+ puts to_output_hash(result).green
200
+ rescue EmassClient::ApiError => e
201
+ puts 'Exception when calling SystemRolesApi->get_system_by_role_category_id'.red
202
+ puts to_output_hash(e).yellow
203
+ end
204
+ end
205
+ end
206
+
207
+ # The Controls endpoints provide the ability to view Security Control information
208
+ # of a system for both the Implementation Plan and Risk Assessment.
209
+ #
210
+ # Endpoint:
211
+ # /api/systems/{systemId}/controls - Get control information in a system for one or many controls
212
+ class Controls < SubCommandBase
213
+ def self.exit_on_failure?
214
+ true
215
+ end
216
+
217
+ desc 'forSystem', 'Get control information in a system for one or many controls (acronym)'
218
+ # Required parameters/fields
219
+ option :systemId, type: :numeric, required: true,
220
+ desc: 'A numeric value representing the system identification'
221
+ # Optional parameters/fields
222
+ option :acronyms, type: :string, required: false,
223
+ desc: 'The system acronym(s) e.g "AC-1, AC-2" - if not provided all controls for systemId are returned'
224
+
225
+ def forSystem
226
+ optional_options_keys = optional_options(@_initializer).keys
227
+ optional_options = to_input_hash(optional_options_keys, options)
228
+
229
+ begin
230
+ result = EmassClient::ControlsApi.new.get_system_controls(options[:systemId], optional_options)
231
+ puts to_output_hash(result).green
232
+ rescue EmassClient::ApiError => e
233
+ puts 'Exception when calling ControlsApi->get_system_controls'.red
234
+ puts to_output_hash(e).yellow
235
+ end
236
+ end
237
+ end
238
+
239
+ # The Test Results endpoints provide the ability to view test results for a
240
+ # system's Assessment Procedures (CCIs) which determine Security Control compliance.
241
+ #
242
+ # Endpoint:
243
+ # /api/systems/{systemId}/test-results - Get one or many test results in a system
244
+ class TestResults < SubCommandBase
245
+ def self.exit_on_failure?
246
+ true
247
+ end
248
+
249
+ desc 'forSystem', 'Get one or many test results in a system'
250
+ # Required parameters/fields
251
+ option :systemId, type: :numeric, required: true,
252
+ desc: 'A numeric value representing the system identification'
253
+ # Optional parameters/fields
254
+ option :controlAcronyms, type: :string, required: false, desc: 'The system acronym(s) e.g "AC-1, AC-2"'
255
+ option :ccis, type: :string, required: false, desc: 'The system CCIS string numerical value'
256
+ option :latestOnly, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
257
+
258
+ def forSystem
259
+ optional_options_keys = optional_options(@_initializer).keys
260
+ optional_options = to_input_hash(optional_options_keys, options)
261
+
262
+ begin
263
+ result = EmassClient::TestResultsApi.new.get_system_test_results(options[:systemId], optional_options)
264
+ puts to_output_hash(result).green
265
+ rescue EmassClient::ApiError => e
266
+ puts 'Exception when calling TestResultsApi->get_system_test_results'.red
267
+ puts to_output_hash(e).yellow
268
+ end
269
+ end
270
+ end
271
+
272
+ # The POA&Ms endpoints provide the ability to view Plan of Action and Milestones (POA&M)
273
+ # items and associated milestones for a system.
274
+ #
275
+ # Endpoint:
276
+ # /api/systems/{systemId}/poams - Get one or many POA&M items in a system
277
+ # /api/systems/{systemId}/poams/{poamId} - Get POA&M item by ID in a system
278
+ class Poams < SubCommandBase
279
+ def self.exit_on_failure?
280
+ true
281
+ end
282
+
283
+ # BY SYSTEM ID ------------------------------------------------------------------
284
+ desc 'forSystem', 'Get one or many POA&M items in a system'
285
+ # Required parameters/fields
286
+ option :systemId, type: :numeric, required: true,
287
+ desc: 'A numeric value representing the system identification'
288
+ # Optional parameters/fields
289
+ option :scheduledCompletionDateStart, type: :numeric, required: false,
290
+ desc: 'The schedule completion start date - Unix time format.'
291
+ option :scheduledCompletionDateEnd, type: :numeric, required: false,
292
+ desc: 'The scheduled completion end date - Unix time format.'
293
+ option :controlAcronyms, type: :string, required: false, desc: 'The system acronym(s) e.g "AC-1" or "AC-1, AC-2"'
294
+ option :ccis, type: :string, required: false, desc: 'The system CCIS string numerical value e.g "000123" or "000123,000069"'
295
+ option :systemOnly, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
296
+
297
+ def forSystem
298
+ optional_options_keys = optional_options(@_initializer).keys
299
+ optional_options = to_input_hash(optional_options_keys, options)
300
+
301
+ begin
302
+ result = EmassClient::POAMApi.new.get_system_poams(options[:systemId], optional_options)
303
+ puts to_output_hash(result).green
304
+ rescue EmassClient::ApiError => e
305
+ puts 'Exception when calling POAMApi->get_system_poams'.red
306
+ puts to_output_hash(e).yellow
307
+ end
308
+ end
309
+
310
+ # BY POAM ID --------------------------------------------------------------
311
+ desc 'byPoamId', 'Get POA&M item for given systemId and poamId'
312
+ # Required parameters/fields
313
+ option :systemId, type: :numeric, required: true,
314
+ desc: 'A numeric value representing the system identification'
315
+ option :poamId, type: :numeric, required: true,
316
+ desc: 'A numeric value representing the poam identification'
317
+
318
+ def byPoamId
319
+ result = EmassClient::POAMApi.new.get_system_poams_by_poam_id(options[:systemId], options[:poamId])
320
+ puts to_output_hash(result).green
321
+ rescue EmassClient::ApiError => e
322
+ puts 'Exception when calling POAMApi->get_system_poams_by_poam_id'.red
323
+ puts to_output_hash(e).yellow
324
+ end
325
+ end
326
+
327
+ # The Milestones endpoints provide the ability to view milestones that are associated
328
+ # with Plan of Action and Milestones (POA&M) items for a system.
329
+ #
330
+ # /api/systems/{systemId}/poams/{poamId}/milestones - Get milestones in one or many POA&M items in a system
331
+ # /api/systems/{systemId}/poams/{poamId}/milestones/{milestoneId} - Get milestone by ID in POA&M item in a system
332
+ class Milestones < SubCommandBase
333
+ def self.exit_on_failure?
334
+ true
335
+ end
336
+ # MILSTONES by SYSTEM and POAM ID -----------------------------------------
337
+ desc 'byPoamId', 'Get milestone(s) for given specified system and poam'
338
+ # Required parameters/fields
339
+ option :systemId, type: :numeric, required: true,
340
+ desc: 'A numeric value representing the system identification'
341
+ option :poamId, type: :numeric, required: true,
342
+ desc: 'A numeric value representing the poam identification'
343
+ # Optional parameters/fields
344
+ option :scheduledCompletionDateStart, type: :numeric, required: false,
345
+ desc: 'The schedule completion start date - Unix time format.'
346
+ option :scheduledCompletionDateEnd, type: :numeric, required: false,
347
+ desc: 'The scheduled completion end date - Unix time format.'
348
+
349
+ def byPoamId
350
+ optional_options_keys = optional_options(@_initializer).keys
351
+ optional_options = to_input_hash(optional_options_keys, options)
352
+
353
+ begin
354
+ # Get milestones in one or many poa&m items in a system
355
+ result = EmassClient::MilestonesApi.new.get_system_milestones_by_poam_id(options[:systemId],
356
+ options[:poamId], optional_options)
357
+ puts to_output_hash(result).green
358
+ rescue EmassClient::ApiError => e
359
+ puts 'Exception when calling MilestonesApi->get_system_milestones_by_poam_id'.red
360
+ puts to_output_hash(e).yellow
361
+ end
362
+ end
363
+
364
+ # MILSTONES by SYSTEM, POAM, and MILESTONE ID -----------------------------------------
365
+ desc 'byMilestoneId', 'Get milestone(s) for given specified system, poam, and milestone Id'
366
+ # Required parameters/fields
367
+ option :systemId, type: :numeric, required: true,
368
+ desc: 'A numeric value representing the system identification'
369
+ option :poamId, type: :numeric, required: true,
370
+ desc: 'A numeric value representing the poam identification'
371
+ option :milestoneId, type: :numeric, required: true,
372
+ desc: 'A numeric value representing the milestone identification'
373
+
374
+ def byMilestoneId
375
+ result = EmassClient::MilestonesApi.new.get_system_milestones_by_poam_id_and_milestone_id(
376
+ options[:systemId], options[:poamId], options[:milestoneId]
377
+ )
378
+ puts to_output_hash(result).green
379
+ rescue EmassClient::ApiError => e
380
+ puts 'Exception when calling MilestonesApi->get_system_milestones_by_poam_id_and_milestone_id'.red
381
+ puts to_output_hash(e).yellow
382
+ end
383
+ end
384
+
385
+ # The Artifact endpoints provide the ability to add new Artifacts
386
+ # (supporting documentation/evidence for Security Control Assessments
387
+ # and system Authorization activities) to a system.
388
+ #
389
+ # Endpoints:
390
+ # /api/systems/{systemId}/artifacts - Get one or many artifacts in a system
391
+ # /api/systems/{systemId}/artifacts-export - Get the file of an artifact in a system
392
+ class Artifacts < SubCommandBase
393
+ def self.exit_on_failure?
394
+ true
395
+ end
396
+
397
+ desc 'forSystem', 'Get all system artifacts for a system Id'
398
+ # Required parameters/fields
399
+ option :systemId, type: :numeric, required: true,
400
+ desc: 'A numeric value representing the system identification'
401
+ # Optional parameters/fields
402
+ option :filename, type: :string, required: false, desc: 'The artifact file name'
403
+ option :controlAcronyms, type: :string, required: false, desc: 'The system acronym(s) e.g "AC-1, AC-2"'
404
+ option :ccis, type: :string, required: false, desc: 'The system CCIS string numerical value'
405
+ option :systemOnly, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
406
+
407
+ def forSystem
408
+ optional_options_keys = optional_options(@_initializer).keys
409
+ optional_options = to_input_hash(optional_options_keys, options)
410
+
411
+ begin
412
+ # Get one or many artifacts in a system
413
+ result = EmassClient::ArtifactsApi.new.get_system_artifacts(options[:systemId],
414
+ optional_options)
415
+ puts to_output_hash(result).green
416
+ rescue EmassClient::ApiError => e
417
+ puts 'Exception when calling ArtifactsApi->get_system_artifacts'.red
418
+ puts to_output_hash(e).yellow
419
+ end
420
+ end
421
+
422
+ desc 'export', 'Get artifact binary file associated with given filename'
423
+ # Required parameters/fields
424
+ option :systemId, type: :numeric, required: true,
425
+ desc: 'A numeric value representing the system identification'
426
+ option :filename, type: :string, required: true, desc: 'The artifact file name'
427
+ option :compress, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
428
+ # NOTE: compress is a required parameter, however Thor does not allow a boolean type to be required because it
429
+ # automatically creates a --no-compress option, which is confusing in the help output:
430
+ # [--compress], [--no-compress] # BOOLEAN - true or false.
431
+
432
+ def export
433
+ optional_options_keys = optional_options(@_initializer).keys
434
+ optional_options = to_input_hash(optional_options_keys, options)
435
+ optional_options.merge!(Emasser::GET_ARTIFACTS_RETURN_TYPE)
436
+
437
+ result = EmassClient::ArtifactsExportApi.new.get_system_artifacts_export(
438
+ options[:systemId], options[:filename], optional_options
439
+ )
440
+ if options[:compress]
441
+ pp result
442
+ else
443
+ begin
444
+ puts JSON.pretty_generate(JSON.parse(result)).green
445
+ rescue StandardError
446
+ puts result.red
447
+ end
448
+ end
449
+ rescue EmassClient::ApiError => e
450
+ puts 'Exception when calling ArtifactsApi->get_system_artifacts_export'.red
451
+ puts to_output_hash(e).yellow
452
+ end
453
+ end
454
+
455
+ # The Control Approval Chain (CAC) endpoints provide the ability to view the status of
456
+ # Security Controls and submit them to the second stage in the Control Approval Chain
457
+ # Note:
458
+ # POST requests will only yield successful results if the Security Control is at the first
459
+ # stage of the CAC. If the control is not at the first stage, an error will be returned.
460
+ #
461
+ # Endpoints:
462
+ # /api/systems/{systemId}/approval/cac - Get location of one or many controls in CAC
463
+ class CAC < SubCommandBase
464
+ def self.exit_on_failure?
465
+ true
466
+ end
467
+
468
+ desc 'controls', 'Get location of one or many controls in CAC'
469
+ # Required parameters/fields
470
+ option :systemId, type: :numeric, required: true,
471
+ desc: 'A numeric value representing the system identification'
472
+ # Optional parameters/fields
473
+ option :controlAcronyms, type: :string, required: false,
474
+ desc: 'The system acronym(s) e.g "AC-1, AC-2" - if not provided all CACs for systemId are returned'
475
+
476
+ def controls
477
+ optional_options_keys = optional_options(@_initializer).keys
478
+ optional_options = to_input_hash(optional_options_keys, options)
479
+
480
+ begin
481
+ # Get location of one or many controls in CAC
482
+ result = EmassClient::CACApi.new.get_system_cac(options[:systemId], optional_options)
483
+ puts to_output_hash(result).green
484
+ rescue EmassClient::ApiError => e
485
+ puts 'Exception when calling ApprovalChainApi->get_system_cac'.red
486
+ puts to_output_hash(e).yellow
487
+ end
488
+ end
489
+ end
490
+
491
+ # The Package Approval Chain (PAC) endpoints provide the ability to view the
492
+ # status of existing workflows and initiate new workflows for a system.
493
+ #
494
+ # Notes:
495
+ # - If the indicated system has any active workflows, the response will include
496
+ # information such as the workflow type and the current stage of each workflow.
497
+ # - If there are no active workflows, then a null data member will be returned.
498
+ #
499
+ # Endpoints:
500
+ # /api/systems/{systemId}/approval/pac - Get location of system package in PAC
501
+ class PAC < SubCommandBase
502
+ def self.exit_on_failure?
503
+ true
504
+ end
505
+
506
+ desc 'package', 'Get location of system package in PAC'
507
+ # Required parameters/fields
508
+ option :systemId, type: :numeric, required: true,
509
+ desc: 'A numeric value representing the system identification'
510
+
511
+ def package
512
+ # Get location of system package in PAC
513
+ result = EmassClient::PACApi.new.get_system_pac(options[:systemId])
514
+ puts to_output_hash(result).green
515
+ rescue EmassClient::ApiError => e
516
+ puts 'Exception when calling ApprovalChainApi->get_system_'.red
517
+ puts to_output_hash(e).yellow
518
+ end
519
+ end
520
+
521
+ # The Cybersecurity Maturity Model Certification (CMMC) Assessments endpoint provides
522
+ # the ability to view CMMC assessment information. It is available to CMMC eMASS only.
523
+ #
524
+ # Endpoints:
525
+ # /api/cmmc-assessments - Get CMMC assessment information
526
+ class CMMC < SubCommandBase
527
+ def self.exit_on_failure?
528
+ true
529
+ end
530
+
531
+ desc 'assessments', 'Get CMMC assessment information'
532
+ long_desc Help.text(:cmmc_get_mapper)
533
+
534
+ # Required parameters/fields
535
+ option :sinceDate, type: :string, required: true, desc: 'The CMMC date. Unix date format'
536
+
537
+ def assessments
538
+ result = EmassClient::CMMCAssessmentsApi.new.get_cmmc_assessments(options[:sinceDate])
539
+ puts to_output_hash(result).green
540
+ rescue EmassClient::ApiError => e
541
+ puts 'Exception when calling ApprovalChainApi->get_cmmc_assessments'.red
542
+ puts to_output_hash(e).yellow
543
+ end
544
+ end
545
+
546
+ # The Workflow Definitions endpoint provides the ability to view all workflow schemas
547
+ # available on the eMASS instance. Every transition for each workflow stage is included.
548
+ #
549
+ # Endpoints:
550
+ # /api/workflow-definitions - Get workflow definitions in a site
551
+ class WorkflowDefinitions < SubCommandBase
552
+ def self.exit_on_failure?
553
+ true
554
+ end
555
+
556
+ desc 'forSite', 'Get location of system package in PAC'
557
+
558
+ # Optional parameters/fields
559
+ option :includeInactive, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
560
+ option :registrationType,
561
+ type: :string, required: false,
562
+ enum: %w[assessAndAuthorize assessOnly guest regular functional cloudServiceProvider commonControlProvider]
563
+
564
+ def forSite
565
+ optional_options_keys = optional_options(@_initializer).keys
566
+ optional_options = to_input_hash(optional_options_keys, options)
567
+
568
+ result = EmassClient::WorkflowDefinitionsApi.new.get_workflow_definitions(optional_options)
569
+ puts to_output_hash(result).green
570
+ rescue EmassClient::ApiError => e
571
+ puts 'Exception when calling ApprovalChainApi->get_workflow_definitions'.red
572
+ puts to_output_hash(e).yellow
573
+ end
574
+ end
575
+
576
+ # The Workflow Instances endpoint provides the ability to view detailed information on all
577
+ # active and historical workflows for a system.
578
+ #
579
+ # Endpoints:
580
+ # /api/workflows/instances - Get workflow instances in a site
581
+ # /api/workflows/instances/{workflowInstanceId} - Get workflow instance by ID
582
+ class WorkflowInstances < SubCommandBase
583
+ def self.exit_on_failure?
584
+ true
585
+ end
586
+
587
+ desc 'all', 'Get workflow instances in a site'
588
+
589
+ # Optional parameters/fields
590
+ option :includeComments, type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
591
+ option :pageIndex, type: :numeric, required: false, desc: 'The page number to be returned'
592
+ option :sinceDate, type: :string, required: false, desc: 'The workflow instance date. Unix date format'
593
+ option :status, type: :string, required: false, enum: %w[active inactive all]
594
+
595
+ def all
596
+ optional_options_keys = optional_options(@_initializer).keys
597
+ optional_options = to_input_hash(optional_options_keys, options)
598
+
599
+ result = EmassClient::WorkflowInstancesApi.new.get_system_workflow_instances(optional_options)
600
+ puts to_output_hash(result).green
601
+ rescue EmassClient::ApiError => e
602
+ puts 'Exception when calling ApprovalChainApi->get_system_workflow_instances'.red
603
+ puts to_output_hash(e).yellow
604
+ end
605
+
606
+ # Workflow by workflowInstanceId ---------------------------------------------------------
607
+ desc 'byInstanceId', 'Get workflow instance by ID'
608
+
609
+ # Required parameters/fields
610
+ option :workflowInstanceId, type: :numeric, required: true,
611
+ desc: 'A numeric value representing the workflowInstance identification'
612
+
613
+ def byInstanceId
614
+ opts = Emasser::GET_WORKFLOWINSTANCES_RETURN_TYPE
615
+ result = EmassClient::WorkflowInstancesApi.new
616
+ .get_system_workflow_instances_by_workflow_instance_id(options[:workflowInstanceId], opts)
617
+ puts to_output_hash(result).green
618
+ rescue EmassClient::ApiError => e
619
+ puts 'Exception when calling ApprovalChainApi->get_system_workflow_instances_by_workflow_instance_id'.red
620
+ puts to_output_hash(e).yellow
621
+ end
622
+ end
623
+
624
+ # The Dashboards endpoints provide the ability to view data contained in dashboard exports.
625
+ # In the eMASS front end, these dashboard exports are generated as Excel exports.
626
+ # Each dashboard dataset available from the API is automatically updated with the current
627
+ # configuration of the dashboard and the instance of eMASS as the dashboard changes.
628
+ #
629
+ # Endpoints:
630
+ # /api/dashboards/system-status-details - Get systems status detail dashboard information
631
+ # /api/dashboards/system-control-compliance-summary - Get systems control compliance summary dashboard information
632
+ # /api/dashboards/system-security-controls-details - Get systems security control details dashboard information
633
+ # /api/dashboards/system-assessment-procedures-details - Get systems assessement procdures details dashboard information
634
+ # /api/dashboards/system-poam-summary - Get systems POA&Ms summary dashboard information
635
+ # /api/dashboards/system-poam-details - Get system POA&Ms details dashboard information
636
+ # /api/dashboards/system-artifacts-summary - Get system Artifacts summary information.
637
+ # /api/dashboards/system-artifacts-details - Get system Artifacts details information.
638
+ # /api/dashboards/system-hardware-summary - Get system hardware summary dashboard information
639
+ # /api/dashboards/system-hardware-details - Get system hardware details dashboard information
640
+ # /api/dashboards/system-sensor-hardware-summary - Get system sensor hardware summary dashboard information
641
+ # /api/dashboards/system-sensor-hardware-details - Get system sensor hardware details dashboard information
642
+ # /api/dashboards/system-software-summary - Get system software summary dashboard information
643
+ # /api/dashboards/system-software-details - Get system ssoftware details dashboard information
644
+ # /api/dashboards/system-ports-protocols-summary - Get system ports and protocols summary dashboard information
645
+ # /api/dashboards/system-ports-protocols-details - Get system ports and protocols details dashboard information
646
+ # /api/dashboards/system-conmon-integration-status-summary - Get system conmon integration status summary dashboard information
647
+ # /api/dashboards/system-associations-details - Get system associations details dashboard information
648
+ # /api/dashboards/user-system-assignments-details - Get user system assignments details dashboard information
649
+ # /api/dashboards/system-privacy-summary - Get user system privacy summary dashboard information
650
+ # /api/dashboards/va-omb-fisma-saop-summary - Get VA OMB-FISMA SAOP summary dashboard information
651
+ # /api/dashboards/va-system-aa-summary - Get VA system A&A summary dashboard information
652
+ # /api/dashboards/va-system-a2-summary - Get VA system A2.0 summary dashboard information
653
+ # /api/dashboards/va-system-pl-109-reporting-summary - Get workflow instance by ID in a system
654
+ # /api/dashboards/va-system-fisma-inventory-summary - Get VA system FISMA inventory summary dashboard information
655
+ # /api/dashboards/va-system-fisma-inventory-crypto-summary - Get VA system FISMA inventory crypto summary dashboard information
656
+ # /api/dashboards/va-system-threat-risks-summary - Get VA System Threat Risks Summary dashboard information
657
+ # /api/dashboards/va-system-threat-sources-details - Get VA System Threat Sources Details dashboard information
658
+ # /api/dashboards/va-system-threat-architecture-details - Get VA System Threat Architecture Details dashboard information
659
+
660
+ class Dashboards < SubCommandBase
661
+ def self.exit_on_failure?
662
+ true
663
+ end
664
+
665
+ # Required parameters/fields
666
+ class_option :orgId, aliases: '-o', type: :numeric,
667
+ desc: 'A numeric value representing the system identification'
668
+
669
+ # Optional parameters/fields
670
+ class_option :excludeinherited, aliases: '-I', type: :boolean, required: false, default: false,
671
+ desc: 'BOOLEAN - true or false, default false.'
672
+ class_option :pageIndex, aliases: '-i', type: :numeric, required: false,
673
+ desc: 'The page number to be returned, if not specified starts at page 0'
674
+ class_option :pageSize, aliases: '-s', type: :numeric, required: false,
675
+ desc: 'The total entries per page, default is 20,000'
676
+
677
+ #--------------------------------------------------------------------------
678
+ # System Status Dashboard
679
+ # /api/dashboards/system-status-details
680
+ desc 'status_details', 'Get systems status detail dashboard information'
681
+ def status_details
682
+ optional_options_keys = optional_options(@_initializer).keys
683
+ optional_options = to_input_hash(optional_options_keys, options)
684
+
685
+ result = EmassClient::DashboardsApi.new.get_system_status_details(
686
+ options[:orgId], optional_options
687
+ )
688
+ puts to_output_hash(result).green
689
+ rescue EmassClient::ApiError => e
690
+ puts 'Exception when calling DashboardsApi->get_system_status_details'.red
691
+ puts to_output_hash(e)
692
+ end
693
+
694
+ #--------------------------------------------------------------------------
695
+ # Enterprise Security Controls Dashboard
696
+ # /api/dashboards/system-control-compliance-summary
697
+ desc 'control_compliance_summary', 'Get systems control compliance summary dashboard information'
698
+ def control_compliance_summary
699
+ optional_options_keys = optional_options(@_initializer).keys
700
+ optional_options = to_input_hash(optional_options_keys, options)
701
+
702
+ result = EmassClient::DashboardsApi.new.get_system_control_compliance_summary(
703
+ options[:orgId], optional_options
704
+ )
705
+ puts to_output_hash(result).green
706
+ rescue EmassClient::ApiError => e
707
+ puts 'Exception when calling DashboardsApi->get_system_control_compliance_summary'.red
708
+ puts to_output_hash(e)
709
+ end
710
+
711
+ # /api/dashboards/system-security-controls-details
712
+ desc 'security_control_details', 'Get systems security control details dashboard information'
713
+ def security_control_details
714
+ optional_options_keys = optional_options(@_initializer).keys
715
+ optional_options = to_input_hash(optional_options_keys, options)
716
+
717
+ result = EmassClient::DashboardsApi.new.get_system_security_control_details(
718
+ options[:orgId], optional_options
719
+ )
720
+ puts to_output_hash(result).green
721
+ rescue EmassClient::ApiError => e
722
+ puts 'Exception when calling DashboardsApi->get_system_security_control_details'.red
723
+ puts to_output_hash(e)
724
+ end
725
+
726
+ # /api/dashboards/system-assessment-procedures-details
727
+ desc 'assessment_procedures_details', 'Get systems assessement procdures details dashboard information'
728
+ def assessment_procedures_details
729
+ optional_options_keys = optional_options(@_initializer).keys
730
+ optional_options = to_input_hash(optional_options_keys, options)
731
+
732
+ result = EmassClient::DashboardsApi.new.get_system_assessment_procedures_details(
733
+ options[:orgId], optional_options
734
+ )
735
+ puts to_output_hash(result).green
736
+ rescue EmassClient::ApiError => e
737
+ puts 'Exception when calling DashboardsApi->get_system_assessment_procedures_details'.red
738
+ puts to_output_hash(e)
739
+ end
740
+
741
+ #--------------------------------------------------------------------------
742
+ # Enterprise POA&M Dashboard
743
+ # /api/dashboards/system-poam-summary
744
+ desc 'poam_summary', 'Get systems POA&Ms summary dashboard information'
745
+ def poam_summary
746
+ optional_options_keys = optional_options(@_initializer).keys
747
+ optional_options = to_input_hash(optional_options_keys, options)
748
+
749
+ result = EmassClient::DashboardsApi.new.get_system_poam_summary(
750
+ options[:orgId], optional_options
751
+ )
752
+ puts to_output_hash(result).green
753
+ rescue EmassClient::ApiError => e
754
+ puts 'Exception when calling DashboardsApi->get_system_poam_summary'.red
755
+ puts to_output_hash(e)
756
+ end
757
+
758
+ # /api/dashboards/system-poam-details
759
+ desc 'poam_details', 'Get system POA&Ms details dashboard information'
760
+ def poam_details
761
+ optional_options_keys = optional_options(@_initializer).keys
762
+ optional_options = to_input_hash(optional_options_keys, options)
763
+
764
+ result = EmassClient::DashboardsApi.new.get_system_poam_details(
765
+ options[:orgId], optional_options
766
+ )
767
+ puts to_output_hash(result).green
768
+ rescue EmassClient::ApiError => e
769
+ puts 'Exception when calling DashboardsApi->get_system_poam_details'.red
770
+ puts to_output_hash(e)
771
+ end
772
+
773
+ #--------------------------------------------------------------------------
774
+ # Enterprise Artifacts Dashboard
775
+ # /api/dashboards/system-artifacts-summary
776
+ desc 'artifacts_summary', 'Get systems artifacts summary dashboard information'
777
+ def artifacts_summary
778
+ optional_options_keys = optional_options(@_initializer).keys
779
+ optional_options = to_input_hash(optional_options_keys, options)
780
+
781
+ result = EmassClient::DashboardsApi.new.get_system_artifacts_summary(
782
+ options[:orgId], optional_options
783
+ )
784
+ puts to_output_hash(result).green
785
+ rescue EmassClient::ApiError => e
786
+ puts 'Exception when calling DashboardsApi->get_system_artifacts_summary'.red
787
+ puts to_output_hash(e)
788
+ end
789
+
790
+ # /api/dashboards/system-artifacts-details
791
+ desc 'artifacts_details', 'Get systems artifacts summary dashboard information'
792
+ def artifacts_details
793
+ optional_options_keys = optional_options(@_initializer).keys
794
+ optional_options = to_input_hash(optional_options_keys, options)
795
+
796
+ result = EmassClient::DashboardsApi.new.get_system_artifacts_details(
797
+ options[:orgId], optional_options
798
+ )
799
+ puts to_output_hash(result).green
800
+ rescue EmassClient::ApiError => e
801
+ puts 'Exception when calling DashboardsApi->get_system_artifacts_details'.red
802
+ puts to_output_hash(e)
803
+ end
804
+
805
+ #--------------------------------------------------------------------------
806
+ # Hardware Baseline Dashboard
807
+ # /api/dashboards/system-hardware-summary
808
+ desc 'hardware_summary', 'Get system hardware summary dashboard information'
809
+ def hardware_summary
810
+ optional_options_keys = optional_options(@_initializer).keys
811
+ optional_options = to_input_hash(optional_options_keys, options)
812
+
813
+ result = EmassClient::DashboardsApi.new.get_system_hardware_summary(
814
+ options[:orgId], optional_options
815
+ )
816
+ puts to_output_hash(result).green
817
+ rescue EmassClient::ApiError => e
818
+ puts 'Exception when calling DashboardsApi->get_system_hardware_summary'.red
819
+ puts to_output_hash(e)
820
+ end
821
+
822
+ # /api/dashboards/system-hardware-details
823
+ desc 'hardware_details', 'Get system hardware details dashboard information'
824
+ def hardware_details
825
+ optional_options_keys = optional_options(@_initializer).keys
826
+ optional_options = to_input_hash(optional_options_keys, options)
827
+
828
+ result = EmassClient::DashboardsApi.new.get_system_hardware_details(
829
+ options[:orgId], optional_options
830
+ )
831
+ puts to_output_hash(result).green
832
+ rescue EmassClient::ApiError => e
833
+ puts 'Exception when calling DashboardsApi->get_system_hardware_details'.red
834
+ puts to_output_hash(e)
835
+ end
836
+
837
+ #--------------------------------------------------------------------------
838
+ # Enterprise Sensor-based Hardware Resources Dashboard
839
+ # /api/dashboards/system-sensor-hardware-summary
840
+ desc 'sensor_hardware_summary', 'Get system sensor hardware summary dashboard information'
841
+ def sensor_hardware_summary
842
+ optional_options_keys = optional_options(@_initializer).keys
843
+ optional_options = to_input_hash(optional_options_keys, options)
844
+
845
+ result = EmassClient::DashboardsApi.new.get_system_sensor_hardware_summary(
846
+ options[:orgId], optional_options
847
+ )
848
+ puts to_output_hash(result).green
849
+ rescue EmassClient::ApiError => e
850
+ puts 'Exception when calling DashboardsApi->get_system_sensor_hardware_summary'.red
851
+ puts to_output_hash(e)
852
+ end
853
+
854
+ # /api/dashboards/system-sensor-hardware-details
855
+ desc 'sensor_hardware_details', 'Get system sensor hardware details dashboard information'
856
+ def sensor_hardware_details
857
+ optional_options_keys = optional_options(@_initializer).keys
858
+ optional_options = to_input_hash(optional_options_keys, options)
859
+
860
+ result = EmassClient::DashboardsApi.new.get_system_sensor_hardware_details(
861
+ options[:orgId], optional_options
862
+ )
863
+ puts to_output_hash(result).green
864
+ rescue EmassClient::ApiError => e
865
+ puts 'Exception when calling DashboardsApi->get_system_sensor_hardware_details'.red
866
+ puts to_output_hash(e)
867
+ end
868
+
869
+ #--------------------------------------------------------------------------
870
+ # Software Baseline Dashboards
871
+ # /api/dashboards/system-software-summary
872
+ desc 'software_summary', 'Get system software summary dashboard information'
873
+ def software_summary
874
+ optional_options_keys = optional_options(@_initializer).keys
875
+ optional_options = to_input_hash(optional_options_keys, options)
876
+
877
+ result = EmassClient::DashboardsApi.new.get_system_software_summary(
878
+ options[:orgId], optional_options
879
+ )
880
+ puts to_output_hash(result).green
881
+ rescue EmassClient::ApiError => e
882
+ puts 'Exception when calling DashboardsApi->get_system_software_summary'.red
883
+ puts to_output_hash(e)
884
+ end
885
+
886
+ # /api/dashboards/system-software-details
887
+ desc 'software_details', 'Get system software details dashboard information'
888
+ def software_details
889
+ optional_options_keys = optional_options(@_initializer).keys
890
+ optional_options = to_input_hash(optional_options_keys, options)
891
+
892
+ result = EmassClient::DashboardsApi.new.get_system_software_details(
893
+ options[:orgId], optional_options
894
+ )
895
+ puts to_output_hash(result).green
896
+ rescue EmassClient::ApiError => e
897
+ puts 'Exception when calling DashboardsApi->get_system_software_details'.red
898
+ puts to_output_hash(e)
899
+ end
900
+
901
+ #--------------------------------------------------------------------------
902
+ # Ports and Protocols Dashboard
903
+ # /api/dashboards/system-ports-protocols-summary
904
+ desc 'ports_protocols_summary', 'Get system ports & portocols summary dashboard information'
905
+ def ports_protocols_summary
906
+ optional_options_keys = optional_options(@_initializer).keys
907
+ optional_options = to_input_hash(optional_options_keys, options)
908
+
909
+ result = EmassClient::DashboardsApi.new.get_system_ports_protocols_summary(
910
+ options[:orgId], optional_options
911
+ )
912
+ puts to_output_hash(result).green
913
+ rescue EmassClient::ApiError => e
914
+ puts 'Exception when calling DashboardsApi->get_system_ports_protocols_summary'.red
915
+ puts to_output_hash(e)
916
+ end
917
+
918
+ # /api/dashboards/system-ports-protocols-details
919
+ desc 'ports_protocols_details', 'Get system ports & portocols details dashboard information'
920
+ def ports_protocols_details
921
+ optional_options_keys = optional_options(@_initializer).keys
922
+ optional_options = to_input_hash(optional_options_keys, options)
923
+
924
+ result = EmassClient::DashboardsApi.new.get_system_ports_protocols_details(
925
+ options[:orgId], optional_options
926
+ )
927
+ puts to_output_hash(result).green
928
+ rescue EmassClient::ApiError => e
929
+ puts 'Exception when calling DashboardsApi->get_system_ports_protocols_details'.red
930
+ puts to_output_hash(e)
931
+ end
932
+
933
+ #--------------------------------------------------------------------------
934
+ # System CONMON Integration Status Dashboard
935
+ # /api/dashboards/system-conmon-integration-status-summary
936
+ desc 'common_integration_status_summary', 'Get system conmon integration status summary dashboard information'
937
+ def common_integration_status_summary
938
+ optional_options_keys = optional_options(@_initializer).keys
939
+ optional_options = to_input_hash(optional_options_keys, options)
940
+
941
+ result = EmassClient::DashboardsApi.new.get_system_common_integration_status_summary(
942
+ options[:orgId], optional_options
943
+ )
944
+ puts to_output_hash(result).green
945
+ rescue EmassClient::ApiError => e
946
+ puts 'Exception when calling DashboardsApi->get_system_common_integration_status_summary'.red
947
+ puts to_output_hash(e)
948
+ end
949
+
950
+ #--------------------------------------------------------------------------
951
+ # System Associations Dashboard
952
+ # /api/dashboards/system-associations-details
953
+ desc 'associations_details', 'Get system associations details dashboard information'
954
+ def associations_details
955
+ optional_options_keys = optional_options(@_initializer).keys
956
+ optional_options = to_input_hash(optional_options_keys, options)
957
+
958
+ result = EmassClient::DashboardsApi.new.get_system_associations_details(
959
+ options[:orgId], optional_options
960
+ )
961
+ puts to_output_hash(result).green
962
+ rescue EmassClient::ApiError => e
963
+ puts 'Exception when calling DashboardsApi->get_system_associations_details'.red
964
+ puts to_output_hash(e)
965
+ end
966
+
967
+ #--------------------------------------------------------------------------
968
+ # Users Dashboard
969
+ # /api/dashboards/user-system-assignments-details
970
+ desc 'assignments_details', 'Get user system assignments details dashboard information'
971
+ def assignments_details
972
+ optional_options_keys = optional_options(@_initializer).keys
973
+ optional_options = to_input_hash(optional_options_keys, options)
974
+
975
+ result = EmassClient::DashboardsApi.new.get_user_system_assignments_details(
976
+ options[:orgId], optional_options
977
+ )
978
+ puts to_output_hash(result).green
979
+ rescue EmassClient::ApiError => e
980
+ puts 'Exception when calling DashboardsApi->get_user_system_assignments_details'.red
981
+ puts to_output_hash(e)
982
+ end
983
+
984
+ #--------------------------------------------------------------------------
985
+ # Privacy Compliance Dashboard
986
+ # /api/dashboards/system-privacy-summary
987
+ desc 'privacy_summary', 'Get user system privacy summary dashboard information'
988
+ def privacy_summary
989
+ optional_options_keys = optional_options(@_initializer).keys
990
+ optional_options = to_input_hash(optional_options_keys, options)
991
+
992
+ result = EmassClient::DashboardsApi.new.get_system_privacy_summary(
993
+ options[:orgId], optional_options
994
+ )
995
+ puts to_output_hash(result).green
996
+ rescue EmassClient::ApiError => e
997
+ puts 'Exception when calling DashboardsApi->get_system_privacy_summary'.red
998
+ puts to_output_hash(e)
999
+ end
1000
+
1001
+ # /api/dashboards/va-omb-fisma-saop-summary
1002
+ desc 'fisma_saop_summary', 'Get VA OMB-FISMA SAOP summary dashboard information'
1003
+ def fisma_saop_summary
1004
+ optional_options_keys = optional_options(@_initializer).keys
1005
+ optional_options = to_input_hash(optional_options_keys, options)
1006
+
1007
+ result = EmassClient::DashboardsApi.new.get_va_omb_fsma_saop_summary(
1008
+ options[:orgId], optional_options
1009
+ )
1010
+ puts to_output_hash(result).green
1011
+ rescue EmassClient::ApiError => e
1012
+ puts 'Exception when calling DashboardsApi->get_va_omb_fsma_saop_summary'.red
1013
+ puts to_output_hash(e).yellow
1014
+ end
1015
+
1016
+ #--------------------------------------------------------------------------
1017
+ # System A&A Summary Dashboard
1018
+ # /api/dashboards/va-system-aa-summary
1019
+ desc 'va_aa_summary', 'Get VA system A&A summary dashboard information'
1020
+ def va_aa_summary
1021
+ optional_options_keys = optional_options(@_initializer).keys
1022
+ optional_options = to_input_hash(optional_options_keys, options)
1023
+
1024
+ result = EmassClient::DashboardsApi.new.get_va_system_aa_summary(
1025
+ options[:orgId], optional_options
1026
+ )
1027
+ puts to_output_hash(result).green
1028
+ rescue EmassClient::ApiError => e
1029
+ puts 'Exception when calling DashboardsApi->get_va_system_aa_summary'.red
1030
+ puts to_output_hash(e).yellow
1031
+ end
1032
+
1033
+ #--------------------------------------------------------------------------
1034
+ # System A2.0 Summary Dashboard
1035
+ # /api/dashboards/va-system-a2-summary
1036
+ desc 'va_a2_summary', 'Get VA system A2.0 summary dashboard information'
1037
+ def va_a2_summary
1038
+ optional_options_keys = optional_options(@_initializer).keys
1039
+ optional_options = to_input_hash(optional_options_keys, options)
1040
+
1041
+ result = EmassClient::DashboardsApi.new.get_va_system_a2_summary(
1042
+ options[:orgId], optional_options
1043
+ )
1044
+ puts to_output_hash(result).green
1045
+ rescue EmassClient::ApiError => e
1046
+ puts 'Exception when calling DashboardsApi->get_va_system_a2_summary'.red
1047
+ puts to_output_hash(e).yellow
1048
+ end
1049
+
1050
+ #--------------------------------------------------------------------------
1051
+ # System P.L. 109 Reporting Summary Dashboard
1052
+ # /api/dashboards/va-system-pl-109-reporting-summary
1053
+ desc 'va_pl_109_summary', 'Get VA System P.L. 109 reporting summary dashboard information'
1054
+ def va_pl_109_summary
1055
+ optional_options = options.clone
1056
+ optional_options.delete('orgId')
1057
+
1058
+ result = EmassClient::DashboardsApi.new.get_va_system_pl109_reporting_summary(
1059
+ options[:orgId], optional_options
1060
+ )
1061
+ puts to_output_hash(result).green
1062
+ rescue EmassClient::ApiError => e
1063
+ puts 'Exception when calling DashboardsApi->get_va_system_pl109_reporting_summary'.red
1064
+ puts to_output_hash(e).yellow
1065
+ end
1066
+
1067
+ #--------------------------------------------------------------------------
1068
+ # FISMA Inventory Summary Dashboard
1069
+ # /api/dashboards/va-system-fisma-inventory-summary
1070
+ desc 'fisma_inventory_summary', 'Get VA system FISMA inventory summary dashboard information'
1071
+ def fisma_inventory_summary
1072
+ optional_options_keys = optional_options(@_initializer).keys
1073
+ optional_options = to_input_hash(optional_options_keys, options)
1074
+
1075
+ result = EmassClient::DashboardsApi.new.get_va_system_fisma_invetory_summary(
1076
+ options[:orgId], optional_options
1077
+ )
1078
+ puts to_output_hash(result).green
1079
+ rescue EmassClient::ApiError => e
1080
+ puts 'Exception when calling DashboardsApi->get_va_system_fisma_invetory_summary'.red
1081
+ puts to_output_hash(e).yellow
1082
+ end
1083
+
1084
+ # /api/dashboards/va-system-fisma-inventory-crypto-summary
1085
+ desc 'fisma_inventory_crypto_summary', 'Get VA system FISMA inventory crypto summary dashboard information'
1086
+ def fisma_inventory_crypto_summary
1087
+ optional_options_keys = optional_options(@_initializer).keys
1088
+ optional_options = to_input_hash(optional_options_keys, options)
1089
+
1090
+ result = EmassClient::DashboardsApi.new.get_va_system_fisma_invetory_crypto_summary(
1091
+ options[:orgId], optional_options
1092
+ )
1093
+ puts to_output_hash(result).green
1094
+ rescue EmassClient::ApiError => e
1095
+ puts 'Exception when calling DashboardsApi->get_va_system_fisma_invetory_crypto_summary'.red
1096
+ puts to_output_hash(e).yellow
1097
+ end
1098
+
1099
+ #--------------------------------------------------------------------------
1100
+ # Threat Risks Dashboard
1101
+ # /api/dashboards/va-system-threat-risks-summary
1102
+ desc 'threat_risk_summary', 'Get VA System Threat Risks Summary dashboard information'
1103
+ def threat_risk_summary
1104
+ optional_options_keys = optional_options(@_initializer).keys
1105
+ optional_options = to_input_hash(optional_options_keys, options)
1106
+
1107
+ result = EmassClient::DashboardsApi.new.get_va_system_threat_risk_summary(
1108
+ options[:orgId], optional_options
1109
+ )
1110
+ puts to_output_hash(result).green
1111
+ rescue EmassClient::ApiError => e
1112
+ puts 'Exception when calling DashboardsApi->get_va_system_threat_risk_summary'.red
1113
+ puts to_output_hash(e).yellow
1114
+ end
1115
+
1116
+ # /api/dashboards/va-system-threat-sources-details
1117
+ desc 'threat_risk_details', 'Get VA System Threat Sources Details dashboard information'
1118
+ def threat_risk_details
1119
+ optional_options_keys = optional_options(@_initializer).keys
1120
+ optional_options = to_input_hash(optional_options_keys, options)
1121
+
1122
+ result = EmassClient::DashboardsApi.new.get_va_system_threat_source_details(
1123
+ options[:orgId], optional_options
1124
+ )
1125
+ puts to_output_hash(result).green
1126
+ rescue EmassClient::ApiError => e
1127
+ puts 'Exception when calling DashboardsApi->get_va_system_threat_source_details'.red
1128
+ puts to_output_hash(e).yellow
1129
+ end
1130
+
1131
+ # /api/dashboards/va-system-threat-architecture-details
1132
+ desc 'threat_architecture_details', 'Get VA System Threat Architecture Detail dashboard information'
1133
+ def threat_architecture_details
1134
+ optional_options_keys = optional_options(@_initializer).keys
1135
+ optional_options = to_input_hash(optional_options_keys, options)
1136
+
1137
+ result = EmassClient::DashboardsApi.new.get_va_system_threat_architecture_details(
1138
+ options[:orgId], optional_options
1139
+ )
1140
+ puts to_output_hash(result).green
1141
+ rescue EmassClient::ApiError => e
1142
+ puts 'Exception when calling DashboardsApi->get_va_system_threat_architecture_details'.red
1143
+ puts to_output_hash(e).yellow
1144
+ end
1145
+ end
1146
+
1147
+ class Get < SubCommandBase
1148
+ desc 'test', 'Test connection to the configured eMASS server'
1149
+ subcommand 'test', Test
1150
+
1151
+ desc 'system', 'Get a system ID given name/owner, or get a system by ID'
1152
+ subcommand 'system', System
1153
+
1154
+ desc 'systems', 'Get all systems'
1155
+ subcommand 'systems', Systems
1156
+
1157
+ desc 'roles', 'Get all system roles or by category Id'
1158
+ subcommand 'roles', Roles
1159
+
1160
+ desc 'controls', 'Get system Controls'
1161
+ subcommand 'controls', Controls
1162
+
1163
+ desc 'test_results', 'Get system Test Results'
1164
+ subcommand 'test_results', TestResults
1165
+
1166
+ desc 'poams', 'Get system Poams'
1167
+ subcommand 'poams', Poams
1168
+
1169
+ desc 'milestones', 'Get system Milestones'
1170
+ subcommand 'milestones', Milestones
1171
+
1172
+ desc 'artifacts', 'Get system Artifacts'
1173
+ subcommand 'artifacts', Artifacts
1174
+
1175
+ desc 'cac', 'Get location of one or many controls in CAC'
1176
+ subcommand 'cac', CAC
1177
+
1178
+ desc 'pac', 'Get status of active workflows in a system'
1179
+ subcommand 'pac', PAC
1180
+
1181
+ desc 'cmmc', 'Get CMMC assessment information'
1182
+ subcommand 'cmmc', CMMC
1183
+
1184
+ desc 'workflow_definitions', 'Get workflow definitions in a site'
1185
+ subcommand 'workflow_definitions', WorkflowDefinitions
1186
+
1187
+ desc 'workflow_instances', 'Get workflow instance by system and/or ID in a system'
1188
+ subcommand 'workflow_instances', WorkflowInstances
1189
+
1190
+ desc 'dashboards', 'Get dashboard information'
1191
+ subcommand 'dashboards', Dashboards
1192
+ end
1193
+ end
1194
+ # rubocop:enable Naming/MethodName