emasser 3.4.1 → 3.12.0

Sign up to get free protection for your applications and to get access to all the features.
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 +66 -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 +179 -178
  23. data/Rakefile +18 -18
  24. data/_config.yml +1 -1
  25. data/docs/features.md +1677 -1437
  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 +22 -26
  32. data/lib/emasser/delete.rb +210 -148
  33. data/lib/emasser/errors.rb +14 -14
  34. data/lib/emasser/get.rb +1401 -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 +125 -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,1401 @@
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)
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
+ # desc 'id', 'Get a system ID given "name" or "owner"'
64
+
65
+ # Required parameters/fields
66
+ option :system_name, aliases: '-n'
67
+ option :system_owner, aliases: '-o'
68
+
69
+ def id
70
+ if options[:system_name].nil? && options[:system_owner].nil?
71
+ raise ArgumentError,
72
+ 'SYSTEM_NAME or SYSTEM_OWNER is required'
73
+ end
74
+
75
+ begin
76
+ results = EmassClient::SystemsApi.new.get_systems.data
77
+ # Convert the Ruby Object (results) to a Hash (hash) and save each hash to an Array (hash_array)
78
+ hash_array = []
79
+ results.each do |element|
80
+ hash = {}
81
+ # instance_variables returns an array of object’s instance variables
82
+ # instance_variable_get returns the value of the instance variable, given the variable name
83
+ element.instance_variables.each do |v|
84
+ hash[v.to_s.delete('@')] = element.instance_variable_get(v)
85
+ end
86
+ hash_array.push(hash)
87
+ end
88
+ # Filter the hash array based on provided options
89
+ results = filter_systems(hash_array, options[:system_name], options[:system_owner])
90
+ # Output the filtered results
91
+ results.each { |result| puts "#{result['system_id']} - #{result['owning_organization']} - #{result['name']}" }
92
+ rescue EmassClient::ApiError => e
93
+ puts 'Exception when calling SystemsApi->get_systems'
94
+ puts to_output_hash(e)
95
+ end
96
+ end
97
+
98
+ no_commands do
99
+ def filter_systems(results, system_name = nil, system_owner = nil)
100
+ if system_owner.nil?
101
+ results.filter { |result| result['name'].eql?(system_name) }
102
+ elsif system_name.nil?
103
+ results.filter { |result| result['owning_organization'].eql?(system_owner) }
104
+ else
105
+ results.filter { |result| result['name'].eql?(system_name) && result['owning_organization'].eql?(system_owner) }
106
+ end
107
+ end
108
+ end
109
+
110
+ desc 'byId [options]', 'Retrieve a system - filtered by [options] params'
111
+ option :systemId, aliases: '-s', type: :numeric, required: true,
112
+ desc: 'A numeric value representing the system identification'
113
+ option :includePackage, aliases: '-I', type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
114
+ option :policy, aliases: '-p', type: :string, required: false, enum: %w[diacap rmf reporting]
115
+
116
+ def byId
117
+ optional_options_keys = optional_options(@_initializer).keys
118
+ optional_options = to_input_hash(optional_options_keys, options)
119
+ # optional_options.merge!(Emasser::GET_SYSTEM_RETURN_TYPE)
120
+
121
+ begin
122
+ # Get system information matching provided parameters
123
+ result = EmassClient::SystemsApi.new.get_system(options[:systemId], optional_options)
124
+ puts to_output_hash(result).green
125
+ rescue EmassClient::ApiError => e
126
+ puts 'Exception when calling SystemsApi->get_systems'.red
127
+ puts to_output_hash(e)
128
+ end
129
+ end
130
+ end
131
+
132
+ class Systems < SubCommandBase
133
+ def self.exit_on_failure?
134
+ true
135
+ end
136
+
137
+ desc 'all [options]', 'Retrieves all available system(s) - filtered by [options] params'
138
+ # Optional parameters/fields
139
+ option :registrationType, aliases: '-r',
140
+ type: :string, required: false,
141
+ enum: %w[assessAndAuthorize assessOnly guest regular functional cloudServiceProvider commonControlProvider]
142
+ option :ditprId, aliases: '-t', type: :string, required: false,
143
+ desc: 'DoD Information Technology (IT) Portfolio Repository (DITPR) string Id'
144
+ option :coamsId, aliases: '-c', type: :string, required: false,
145
+ desc: 'Cyber Operational Attributes Management System (COAMS) string Id'
146
+ option :policy, aliases: '-p', type: :string, required: false, enum: %w[diacap rmf reporting]
147
+
148
+ option :includePackage, aliases: '-I', type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
149
+ option :includeDitprMetrics, aliases: '-M', type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
150
+ option :includeDecommissioned, aliases: '-D', type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
151
+ option :reportsForScorecard, aliases: '-S', type: :boolean, required: false, desc: 'BOOLEAN - true or false.'
152
+
153
+ def all
154
+ optional_options_keys = optional_options(@_initializer).keys
155
+ optional_options = to_input_hash(optional_options_keys, options)
156
+ # optional_options.merge!(Emasser::GET_SYSTEM_RETURN_TYPE)
157
+
158
+ begin
159
+ # Get system information matching provided parameters
160
+ result = EmassClient::SystemsApi.new.get_systems(optional_options)
161
+ puts to_output_hash(result).green
162
+ rescue EmassClient::ApiError => e
163
+ puts 'Exception when calling SystemsApi->get_systems'.red
164
+ puts to_output_hash(e)
165
+ end
166
+ end
167
+ end
168
+
169
+ # The System Roles endpoints provides the ability to access user data assigned to systems.
170
+ # Notes:
171
+ # The endpoint can access three different role categories: PAC, CAC, and Other.
172
+ # If a system is dual-policy enabled, the returned system role information will default
173
+ # to the RMF policy information unless otherwise specified.
174
+ #
175
+ # Endpoint:
176
+ # /api/system-roles - Get all available roles
177
+ # /api/system-roles/{roleCategory} - Get system roles for provided role catgory
178
+ class Roles < SubCommandBase
179
+ def self.exit_on_failure?
180
+ true
181
+ end
182
+
183
+ desc 'all', 'Retrieves all available system roles'
184
+
185
+ def all
186
+ result = EmassClient::SystemRolesApi.new.get_system_roles
187
+ puts to_output_hash(result).green
188
+ rescue EmassClient::ApiError => e
189
+ puts 'Exception when calling SystemRolesApi->get_system_roles'.red
190
+ puts to_output_hash(e)
191
+ end
192
+
193
+ desc 'byCategory [options]', 'Retrieves role(s) - filtered by [options] params'
194
+ # Required parameters/fields
195
+ option :roleCategory, aliases: '-c', type: :string, required: true, enum: %w[PAC CAC Other]
196
+ option :role, aliases: '-r', type: :string, required: true,
197
+ desc: 'Accepts single value from options available at base system-roles endpoint e.g., SCA.'
198
+
199
+ # Optional parameters/fields
200
+ option :policy, aliases: '-p', type: :string, required: false, enum: %w[diacap rmf reporting]
201
+
202
+ def byCategory
203
+ optional_options_keys = optional_options(@_initializer).keys
204
+ optional_options = to_input_hash(optional_options_keys, options)
205
+
206
+ begin
207
+ result = EmassClient::SystemRolesApi.new.get_system_roles_by_category_id(options[:roleCategory],
208
+ options[:role], optional_options)
209
+ puts to_output_hash(result).green
210
+ rescue EmassClient::ApiError => e
211
+ puts 'Exception when calling SystemRolesApi->get_system_by_role_category_id'.red
212
+ puts to_output_hash(e)
213
+ end
214
+ end
215
+ end
216
+
217
+ # The Controls endpoints provide the ability to view Security Control information
218
+ # of a system for both the Implementation Plan and Risk Assessment.
219
+ #
220
+ # Endpoint:
221
+ # /api/systems/{systemId}/controls - Get control information in a system for one or many controls
222
+ class Controls < SubCommandBase
223
+ def self.exit_on_failure?
224
+ true
225
+ end
226
+
227
+ desc 'forSystem', 'Get control information in a system for one or many controls (acronym)'
228
+ # Required parameters/fields
229
+ option :systemId, aliases: '-s', type: :numeric, required: true,
230
+ desc: 'A numeric value representing the system identification'
231
+ # Optional parameters/fields
232
+ option :acronyms, aliases: '-a', type: :string, required: false,
233
+ desc: 'The system acronym(s) e.g "AC-1, AC-2" - if not provided all controls for systemId are returned'
234
+
235
+ def forSystem
236
+ optional_options_keys = optional_options(@_initializer).keys
237
+ optional_options = to_input_hash(optional_options_keys, options)
238
+
239
+ begin
240
+ result = EmassClient::ControlsApi.new.get_system_controls(options[:systemId], optional_options)
241
+ puts to_output_hash(result).green
242
+ rescue EmassClient::ApiError => e
243
+ puts 'Exception when calling ControlsApi->get_system_controls'.red
244
+ puts to_output_hash(e)
245
+ end
246
+ end
247
+ end
248
+
249
+ # The Test Results endpoints provide the ability to view test results for a
250
+ # system's Assessment Procedures (CCIs) which determine Security Control compliance.
251
+ #
252
+ # Endpoint:
253
+ # /api/systems/{systemId}/test-results - Get one or many test results in a system
254
+ class TestResults < SubCommandBase
255
+ def self.exit_on_failure?
256
+ true
257
+ end
258
+
259
+ desc 'forSystem', 'Get one or many test results in a system'
260
+ # Required parameters/fields
261
+ option :systemId, aliases: '-s', type: :numeric, required: true,
262
+ desc: 'A numeric value representing the system identification'
263
+ # Optional parameters/fields
264
+ option :controlAcronyms, aliases: '-a', type: :string, required: false, desc: 'The system acronym(s) e.g "AC-1, AC-2"'
265
+ option :assessmentProcedures, aliases: '-p', type: :string, required: false,
266
+ desc: 'The system Security Control Assessment Procedure e.g "AC-1.1,AC-1.2"'
267
+ option :ccis, aliases: '-c', type: :string, required: false, desc: 'The system CCIS string numerical value'
268
+ option :latestOnly, aliases: '-L', type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
269
+
270
+ def forSystem
271
+ optional_options_keys = optional_options(@_initializer).keys
272
+ optional_options = to_input_hash(optional_options_keys, options)
273
+
274
+ begin
275
+ result = EmassClient::TestResultsApi.new.get_system_test_results(options[:systemId], optional_options)
276
+ puts to_output_hash(result).green
277
+ rescue EmassClient::ApiError => e
278
+ puts 'Exception when calling TestResultsApi->get_system_test_results'.red
279
+ puts to_output_hash(e)
280
+ end
281
+ end
282
+ end
283
+
284
+ # The POA&Ms endpoints provide the ability to view Plan of Action and Milestones (POA&M)
285
+ # items and associated milestones for a system.
286
+ #
287
+ # Endpoint:
288
+ # /api/systems/{systemId}/poams - Get one or many POA&M items in a system
289
+ # /api/systems/{systemId}/poams/{poamId} - Get POA&M item by ID in a system
290
+ class Poams < SubCommandBase
291
+ def self.exit_on_failure?
292
+ true
293
+ end
294
+
295
+ # BY SYSTEM ID ------------------------------------------------------------------
296
+ desc 'forSystem', 'Get one or many POA&M items in a system'
297
+ # Required parameters/fields
298
+ option :systemId, aliases: '-s', type: :numeric, required: true,
299
+ desc: 'A numeric value representing the system identification'
300
+ # Optional parameters/fields
301
+ option :scheduledCompletionDateStart, aliases: '-d', type: :numeric, required: false,
302
+ desc: 'The schedule completion start date - Unix time format.'
303
+ option :scheduledCompletionDateEnd, aliases: '-e', type: :numeric, required: false,
304
+ desc: 'The scheduled completion end date - Unix time format.'
305
+ option :controlAcronyms, aliases: '-a', type: :string, required: false, desc: 'The system acronym(s) e.g "AC-1, AC-2"'
306
+ option :assessmentProcedures, aliases: '-p', type: :string, required: false,
307
+ desc: 'The system Security Control Assessment Procedure e.g "AC-1.1,AC-1.2"'
308
+ option :ccis, aliases: '-c', type: :string, required: false, desc: 'The system CCIS string numerical value'
309
+ option :systemOnly, aliases: '-Y', type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
310
+
311
+ def forSystem
312
+ optional_options_keys = optional_options(@_initializer).keys
313
+ optional_options = to_input_hash(optional_options_keys, options)
314
+
315
+ begin
316
+ result = EmassClient::POAMApi.new.get_system_poams(options[:systemId], optional_options)
317
+ puts to_output_hash(result).green
318
+ rescue EmassClient::ApiError => e
319
+ puts 'Exception when calling POAMApi->get_system_poams'.red
320
+ puts to_output_hash(e)
321
+ end
322
+ end
323
+
324
+ # BY POAM ID --------------------------------------------------------------
325
+ desc 'byPoamId', 'Get POA&M item for given systemId and poamId'
326
+ # Required parameters/fields
327
+ option :systemId, aliases: '-s', type: :numeric, required: true,
328
+ desc: 'A numeric value representing the system identification'
329
+ option :poamId, aliases: '-p', type: :numeric, required: true,
330
+ desc: 'A numeric value representing the poam identification'
331
+
332
+ def byPoamId
333
+ result = EmassClient::POAMApi.new.get_system_poams_by_poam_id(options[:systemId], options[:poamId])
334
+ puts to_output_hash(result).green
335
+ rescue EmassClient::ApiError => e
336
+ puts 'Exception when calling POAMApi->get_system_poams_by_poam_id'.red
337
+ puts to_output_hash(e)
338
+ end
339
+ end
340
+
341
+ # The Milestones endpoints provide the ability to view milestones that are associated
342
+ # with Plan of Action and Milestones (POA&M) items for a system.
343
+ #
344
+ # /api/systems/{systemId}/poams/{poamId}/milestones - Get milestones in one or many POA&M items in a system
345
+ # /api/systems/{systemId}/poams/{poamId}/milestones/{milestoneId} - Get milestone by ID in POA&M item in a system
346
+ class Milestones < SubCommandBase
347
+ def self.exit_on_failure?
348
+ true
349
+ end
350
+ # MILSTONES by SYSTEM and POAM ID -----------------------------------------
351
+ desc 'byPoamId', 'Get milestone(s) for given specified system and poam'
352
+ # Required parameters/fields
353
+ option :systemId, aliases: '-s', type: :numeric, required: true,
354
+ desc: 'A numeric value representing the system identification'
355
+ option :poamId, aliases: '-p', type: :numeric, required: true,
356
+ desc: 'A numeric value representing the poam identification'
357
+ # Optional parameters/fields
358
+ option :scheduledCompletionDateStart, aliases: '-d', type: :numeric, required: false,
359
+ desc: 'The schedule completion start date - Unix time format.'
360
+ option :scheduledCompletionDateEnd, aliases: '-e', type: :numeric, required: false,
361
+ desc: 'The scheduled completion end date - Unix time format.'
362
+
363
+ def byPoamId
364
+ optional_options_keys = optional_options(@_initializer).keys
365
+ optional_options = to_input_hash(optional_options_keys, options)
366
+
367
+ begin
368
+ # Get milestones in one or many poa&m items in a system
369
+ result = EmassClient::MilestonesApi.new.get_system_milestones_by_poam_id(options[:systemId],
370
+ options[:poamId], optional_options)
371
+ puts to_output_hash(result).green
372
+ rescue EmassClient::ApiError => e
373
+ puts 'Exception when calling MilestonesApi->get_system_milestones_by_poam_id'.red
374
+ puts to_output_hash(e)
375
+ end
376
+ end
377
+
378
+ # MILSTONES by SYSTEM, POAM, and MILESTONE ID -----------------------------------------
379
+ desc 'byMilestoneId', 'Get milestone(s) for given specified system, poam, and milestone Id'
380
+ # Required parameters/fields
381
+ option :systemId, aliases: '-s', type: :numeric, required: true,
382
+ desc: 'A numeric value representing the system identification'
383
+ option :poamId, aliases: '-p', type: :numeric, required: true,
384
+ desc: 'A numeric value representing the poam identification'
385
+ option :milestoneId, aliases: '-m', type: :numeric, required: true,
386
+ desc: 'A numeric value representing the milestone identification'
387
+
388
+ def byMilestoneId
389
+ result = EmassClient::MilestonesApi.new.get_system_milestones_by_poam_id_and_milestone_id(
390
+ options[:systemId], options[:poamId], options[:milestoneId]
391
+ )
392
+ puts to_output_hash(result).green
393
+ rescue EmassClient::ApiError => e
394
+ puts 'Exception when calling MilestonesApi->get_system_milestones_by_poam_id_and_milestone_id'.red
395
+ puts to_output_hash(e)
396
+ end
397
+ end
398
+
399
+ # The Artifact endpoints provide the ability to add new Artifacts
400
+ # (supporting documentation/evidence for Security Control Assessments
401
+ # and system Authorization activities) to a system.
402
+ #
403
+ # Endpoints:
404
+ # /api/systems/{systemId}/artifacts - Get one or many artifacts in a system
405
+ # /api/systems/{systemId}/artifacts-export - Get the file of an artifact in a system
406
+ class Artifacts < SubCommandBase
407
+ def self.exit_on_failure?
408
+ true
409
+ end
410
+
411
+ desc 'forSystem', 'Get all system artifacts for a system Id'
412
+ # Required parameters/fields
413
+ option :systemId, aliases: '-s', type: :numeric, required: true,
414
+ desc: 'A numeric value representing the system identification'
415
+ # Optional parameters/fields
416
+ option :filename, aliases: '-f', type: :string, required: false, desc: 'The artifact file name'
417
+ option :controlAcronyms, aliases: '-a', type: :string, required: false, desc: 'The system acronym(s) e.g "AC-1, AC-2"'
418
+ option :assessmentProcedures, aliases: '-p', type: :string, required: false,
419
+ desc: 'The system Security Control Assessment Procedure e.g "AC-1.1,AC-1.2"'
420
+ option :ccis, aliases: '-c', type: :string, required: false, desc: 'The system CCIS string numerical value'
421
+ option :systemOnly, aliases: '-Y', type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
422
+
423
+ def forSystem
424
+ optional_options_keys = optional_options(@_initializer).keys
425
+ optional_options = to_input_hash(optional_options_keys, options)
426
+
427
+ begin
428
+ # Get one or many artifacts in a system
429
+ result = EmassClient::ArtifactsApi.new.get_system_artifacts(options[:systemId],
430
+ optional_options)
431
+ puts to_output_hash(result).green
432
+ rescue EmassClient::ApiError => e
433
+ puts 'Exception when calling ArtifactsApi->get_system_artifacts'.red
434
+ puts to_output_hash(e)
435
+ end
436
+ end
437
+
438
+ desc 'export', 'Get artifact binary file associated with given filename'
439
+ # Required parameters/fields
440
+ option :systemId, aliases: '-s', type: :numeric, required: true,
441
+ desc: 'A numeric value representing the system identification'
442
+ option :filename, aliases: '-f', type: :string, required: true, desc: 'The artifact file name'
443
+ option :compress, aliases: '-C', type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
444
+ option :printToStdout, aliases: '-o', required: false, desc: 'Output file content to terminal - not valid for zip files'
445
+ # NOTE: compress is a required parameter, however Thor does not allow a boolean type to be required because it
446
+ # automatically creates a --no-compress option, which is confusing in the help output:
447
+ # [--compress], [--no-compress] # BOOLEAN - true or false.
448
+
449
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
450
+ def export
451
+ optional_options_keys = optional_options(@_initializer).keys
452
+ optional_options = to_input_hash(optional_options_keys, options)
453
+ if options[:printToStdout]
454
+ optional_options.merge!(Emasser::GET_ARTIFACTS_RETURN_TYPE)
455
+ if options[:compress]
456
+ puts 'Output to stdout - compress'.yellow
457
+ else
458
+ puts 'Output to stdout - plain text'.yellow
459
+ end
460
+ else
461
+ puts 'Output to temp directory'.yellow
462
+ end
463
+
464
+ result = EmassClient::ArtifactsExportApi.new.get_system_artifacts_export(
465
+ options[:systemId], options[:filename], optional_options
466
+ )
467
+
468
+ unless File.extname(options[:filename]).eql? '.zip'
469
+ # rubocop:disable Style/SoleNestedConditional, Metrics/BlockNesting
470
+ if options[:printToStdout]
471
+ if options[:compress]
472
+ puts result.green
473
+ else
474
+ begin
475
+ puts JSON.pretty_generate(JSON.parse(result)).green
476
+ rescue StandardError
477
+ puts result.red
478
+ end
479
+ end
480
+ end
481
+ end
482
+ # rubocop:enable Style/SoleNestedConditional, Metrics/BlockNesting
483
+ rescue EmassClient::ApiError => e
484
+ puts 'Exception when calling ArtifactsApi->get_system_artifacts_export'.red
485
+ puts to_output_hash(e)
486
+ end
487
+ end
488
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
489
+
490
+ # The Control Approval Chain (CAC) endpoints provide the ability to view the status of
491
+ # Security Controls and submit them to the second stage in the Control Approval Chain
492
+ # Note:
493
+ # POST requests will only yield successful results if the Security Control is at the first
494
+ # stage of the CAC. If the control is not at the first stage, an error will be returned.
495
+ #
496
+ # Endpoints:
497
+ # /api/systems/{systemId}/approval/cac - Get location of one or many controls in CAC
498
+ class CAC < SubCommandBase
499
+ def self.exit_on_failure?
500
+ true
501
+ end
502
+
503
+ desc 'controls', 'Get location of one or many controls in CAC'
504
+ # Required parameters/fields
505
+ option :systemId, aliases: '-s', type: :numeric, required: true,
506
+ desc: 'A numeric value representing the system identification'
507
+ # Optional parameters/fields
508
+ option :controlAcronyms, aliases: '-a', type: :string, required: false,
509
+ desc: 'The system acronym(s) e.g "AC-1, AC-2" - if not provided all CACs for systemId are returned'
510
+
511
+ def controls
512
+ optional_options_keys = optional_options(@_initializer).keys
513
+ optional_options = to_input_hash(optional_options_keys, options)
514
+
515
+ begin
516
+ # Get location of one or many controls in CAC
517
+ result = EmassClient::CACApi.new.get_system_cac(options[:systemId], optional_options)
518
+ puts to_output_hash(result).green
519
+ rescue EmassClient::ApiError => e
520
+ puts 'Exception when calling ApprovalChainApi->get_system_cac'.red
521
+ puts to_output_hash(e)
522
+ end
523
+ end
524
+ end
525
+
526
+ # The Package Approval Chain (PAC) endpoints provide the ability to view the
527
+ # status of existing workflows and initiate new workflows for a system.
528
+ #
529
+ # Notes:
530
+ # - If the indicated system has any active workflows, the response will include
531
+ # information such as the workflow type and the current stage of each workflow.
532
+ # - If there are no active workflows, then a null data member will be returned.
533
+ #
534
+ # Endpoints:
535
+ # /api/systems/{systemId}/approval/pac - Get location of system package in PAC
536
+ class PAC < SubCommandBase
537
+ def self.exit_on_failure?
538
+ true
539
+ end
540
+
541
+ desc 'package', 'Get location of system package in PAC'
542
+ # Required parameters/fields
543
+ option :systemId, aliases: '-s', type: :numeric, required: true,
544
+ desc: 'A numeric value representing the system identification'
545
+
546
+ def package
547
+ # Get location of system package in PAC
548
+ result = EmassClient::PACApi.new.get_system_pac(options[:systemId])
549
+ puts to_output_hash(result).green
550
+ rescue EmassClient::ApiError => e
551
+ puts 'Exception when calling ApprovalChainApi->get_system_'.red
552
+ puts to_output_hash(e)
553
+ end
554
+ end
555
+
556
+ # The Cybersecurity Maturity Model Certification (CMMC) Assessments endpoint provides
557
+ # the ability to view CMMC assessment information. It is available to CMMC eMASS only.
558
+ #
559
+ # Endpoints:
560
+ # /api/cmmc-assessments - Get CMMC assessment information
561
+ class CMMC < SubCommandBase
562
+ def self.exit_on_failure?
563
+ true
564
+ end
565
+
566
+ desc 'assessments', 'Get CMMC assessment information'
567
+ long_desc Help.text(:cmmc_get_mapper)
568
+
569
+ # Required parameters/fields
570
+ option :sinceDate, aliases: '-d', type: :string, required: true, desc: 'The CMMC date. Unix date format'
571
+
572
+ def assessments
573
+ result = EmassClient::CMMCAssessmentsApi.new.get_cmmc_assessments(options[:sinceDate])
574
+ puts to_output_hash(result).green
575
+ rescue EmassClient::ApiError => e
576
+ puts 'Exception when calling ApprovalChainApi->get_cmmc_assessments'.red
577
+ puts to_output_hash(e)
578
+ end
579
+ end
580
+
581
+ # The Workflow Definitions endpoint provides the ability to view all workflow schemas
582
+ # available on the eMASS instance. Every transition for each workflow stage is included.
583
+ #
584
+ # Endpoints:
585
+ # /api/workflow-definitions - Get workflow definitions in a site
586
+ class WorkflowDefinitions < SubCommandBase
587
+ def self.exit_on_failure?
588
+ true
589
+ end
590
+
591
+ desc 'forSite', 'Get location of system package in PAC'
592
+
593
+ # Optional parameters/fields
594
+ option :includeInactive, aliases: '-I', type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
595
+ option :registrationType, aliases: '-r',
596
+ type: :string, required: false,
597
+ enum: %w[assessAndAuthorize assessOnly guest regular functional cloudServiceProvider commonControlProvider]
598
+
599
+ def forSite
600
+ optional_options_keys = optional_options(@_initializer).keys
601
+ optional_options = to_input_hash(optional_options_keys, options)
602
+
603
+ result = EmassClient::WorkflowDefinitionsApi.new.get_workflow_definitions(optional_options)
604
+ puts to_output_hash(result).green
605
+ rescue EmassClient::ApiError => e
606
+ puts 'Exception when calling ApprovalChainApi->get_workflow_definitions'.red
607
+ puts to_output_hash(e)
608
+ end
609
+ end
610
+
611
+ # The Workflow Instances endpoint provides the ability to view detailed information on all
612
+ # active and historical workflows for a system.
613
+ #
614
+ # Endpoints:
615
+ # /api/systems/{systemId}/workflow-instances - Get workflow instances in a system
616
+ # /api/systems/{systemId}/workflow-instances/{workflowInstanceId} - Get workflow instance by ID in a system
617
+ class WorkflowInstances < SubCommandBase
618
+ def self.exit_on_failure?
619
+ true
620
+ end
621
+
622
+ desc 'all', 'Get detailed information for all active and historical workflows'
623
+ # Optional parameters/fields
624
+ option :includeComments, aliases: '-C', type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
625
+ option :includeDecommissionSystems, aliases: '-D', type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false.'
626
+ option :pageIndex, aliases: '-p', type: :numeric, required: false, desc: 'The page number to be returned'
627
+ option :sinceDate, aliases: '-d', type: :string, required: false, desc: 'The workflow instance date. Unix date format'
628
+ option :status, aliases: '-s', type: :string, required: false, enum: %w[active inactive all]
629
+
630
+ def all
631
+ optional_options_keys = optional_options(@_initializer).keys
632
+ optional_options = to_input_hash(optional_options_keys, options)
633
+
634
+ result = EmassClient::WorkflowInstancesApi.new.get_system_workflow_instances(optional_options)
635
+ puts to_output_hash(result).green
636
+ rescue EmassClient::ApiError => e
637
+ puts 'Exception when calling ApprovalChainApi->get_system_workflow_instances'.red
638
+ puts to_output_hash(e)
639
+ end
640
+
641
+ # Workflow by workflowInstanceId ---------------------------------------------------------
642
+ desc 'byInstanceId', 'Get workflow instance by ID in a system'
643
+
644
+ # Required parameters/fields
645
+ option :workflowInstanceId, aliases: '-w', type: :numeric, required: true,
646
+ desc: 'A numeric value representing the workflowInstance identification'
647
+
648
+ def byInstanceId
649
+ # opts = Emasser::GET_WORKFLOWINSTANCES_RETURN_TYPE
650
+
651
+ result = EmassClient::WorkflowInstancesApi
652
+ .new.get_system_workflow_instances_by_workflow_instance_id(options[:workflowInstanceId])
653
+ puts to_output_hash(result).green
654
+ rescue EmassClient::ApiError => e
655
+ puts 'Exception when calling ApprovalChainApi->get_system_workflow_instances_by_workflow_instance_id'.red
656
+ puts to_output_hash(e)
657
+ end
658
+ end
659
+
660
+ # The Dashboards endpoints provide the ability to view data contained in dashboard exports.
661
+ # In the eMASS front end, these dashboard exports are generated as Excel exports.
662
+ # Each dashboard dataset available from the API is automatically updated with the current
663
+ # configuration of the dashboard and the instance of eMASS as the dashboard changes.
664
+ #
665
+ # Endpoints: (37)
666
+ # ---------------------------------------------------------------------------
667
+ # System Status Dashboard
668
+ # /api/dashboards/system-status-details - Get systems status detail
669
+ # ---------------------------------------------------------------------------
670
+ # Enterprise Security Controls Dashboard
671
+ # /api/dashboards/system-control-compliance-summary - Get systems control compliance summary
672
+ # /api/dashboards/system-security-controls-details - Get systems security control details
673
+ # /api/dashboards/system-assessment-procedures-details - Get systems assessement procdures details
674
+ # ---------------------------------------------------------------------------
675
+ # Enterprise Terms Conditions Dashboards
676
+ # /api/dashboards/system-terms-conditions-summary - Get systems terms conditions summary
677
+ # /api/dashboards/system-terms-conditions-details - Get systems terms conditions details
678
+ # ---------------------------------------------------------------------------
679
+ # Enterprise POA&M Dashboards
680
+ # /api/dashboards/system-poam-summary - Get systems POA&Ms summary
681
+ # /api/dashboards/system-poam-details - Get system POA&Ms details
682
+ # ---------------------------------------------------------------------------
683
+ # Enterprise Artifacts Dashboards
684
+ # /api/dashboards/system-artifacts-summary - Get system Artifacts summary
685
+ # /api/dashboards/system-artifacts-details - Get system Artifacts details
686
+ # ---------------------------------------------------------------------------
687
+ # Hardware Baseline Dashboards
688
+ # /api/dashboards/system-hardware-summary - Get system hardware summary
689
+ # /api/dashboards/system-hardware-details - Get system hardware details
690
+ # ---------------------------------------------------------------------------
691
+ # Enterprise Sensor-based Hardware Resources Dashboards
692
+ # /api/dashboards/system-sensor-hardware-summary - Get system sensor hardware summary
693
+ # /api/dashboards/system-sensor-hardware-details - Get system sensor hardware details
694
+ # ---------------------------------------------------------------------------
695
+ # Software Baseline Dashboards
696
+ # /api/dashboards/system-software-summary - Get system software summary
697
+ # /api/dashboards/system-software-details - Get system ssoftware details
698
+ # ---------------------------------------------------------------------------
699
+ # Enterprise Sensor-based Software Resources Dashboards
700
+ # /api/dashboards/system-sensor-software-summary - Get system sensor software summary
701
+ # /api/dashboards/system-sensor-software-details - Get system sensor software details
702
+ # /api/dashboards/system-sensor-software-counts - Get system sensor software counts
703
+ # ---------------------------------------------------------------------------
704
+ # Enterprise Vulnerability Dashboards
705
+ # /api/dashboards/system-vulnerability-summary - Get system vulnerability summary
706
+ # /api/dashboards/system-device-findings-summary - Get system device findings summary
707
+ # /api/dashboards/system-device-findings-details - Get system device findings details
708
+ # ---------------------------------------------------------------------------
709
+ # Ports and Protocols Dashboards
710
+ # /api/dashboards/system-ports-protocols-summary - Get system ports and protocols summary
711
+ # /api/dashboards/system-ports-protocols-details - Get system ports and protocols details
712
+ #----------------------------------------------------------------------------
713
+ # System CONMON Integration Status Dashboard
714
+ # /api/dashboards/system-conmon-integration-status-summary - Get system conmon integration status summary
715
+ #----------------------------------------------------------------------------
716
+ # System Associations Dashboard
717
+ # /api/dashboards/system-associations-details - Get system associations details
718
+ #----------------------------------------------------------------------------
719
+ # Users Dashboard
720
+ # /api/dashboards/user-system-assignments-details - Get user system assignments details
721
+ #----------------------------------------------------------------------------
722
+ # Privacy Compliance Dashboards
723
+ # /api/dashboards/system-privacy-summary - Get user system privacy summary
724
+ # /api/dashboards/va-omb-fisma-saop-summary - Get VA OMB-FISMA SAOP summary
725
+ #----------------------------------------------------------------------------
726
+ # System A&A Summary Dashboard
727
+ # /api/dashboards/va-system-aa-summary - Get VA system A&A summary
728
+ #----------------------------------------------------------------------------
729
+ # System A2.0 Summary Dashboard
730
+ # /api/dashboards/va-system-a2-summary - Get VA system A2.0 summary
731
+ #----------------------------------------------------------------------------
732
+ # System P.L. 109 Reporting Summary Dashboard
733
+ # /api/dashboards/va-system-pl-109-reporting-summary - Get workflow instance by ID in a system
734
+ #----------------------------------------------------------------------------
735
+ # FISMA Inventory Summary Dashboards
736
+ # /api/dashboards/va-system-fisma-inventory-summary - Get VA system FISMA inventory summary
737
+ # /api/dashboards/va-system-fisma-inventory-crypto-summary - Get VA system FISMA inventory crypto summary
738
+ #----------------------------------------------------------------------------
739
+ # Threat Risks Dashboards
740
+ # /api/dashboards/va-system-threat-risks-summary - Get VA System Threat Risks Summary
741
+ # /api/dashboards/va-system-threat-sources-details - Get VA System Threat Sources Details
742
+ # /api/dashboards/va-system-threat-architecture-details - Get VA System Threat Architecture Details
743
+
744
+ class Dashboards < SubCommandBase
745
+ def self.exit_on_failure?
746
+ true
747
+ end
748
+
749
+ # Required parameters/fields
750
+ class_option :orgId, aliases: '-o', type: :numeric, required: true,
751
+ desc: 'A numeric value representing the system identification'
752
+
753
+ # Optional parameters/fields
754
+ class_option :excludeinherited, aliases: '-I', type: :boolean, required: false, default: false, desc: 'BOOLEAN - true or false, default false.'
755
+ class_option :pageIndex, aliases: '-i', type: :numeric, required: false, desc: 'The page number to be returned, if not specified starts at page 0'
756
+ class_option :pageSize, aliases: '-s', type: :numeric, required: false, desc: 'The total entries per page, default is 20,000'
757
+
758
+ #--------------------------------------------------------------------------
759
+ # System Status Dashboard
760
+ # /api/dashboards/system-status-details
761
+ desc 'status_details', 'Get systems status detail dashboard information'
762
+ def status_details
763
+ optional_options_keys = optional_options(@_initializer).keys
764
+ optional_options = to_input_hash(optional_options_keys, options)
765
+
766
+ result = EmassClient::SystemStatusDashboardApi.new.get_system_status_details(
767
+ options[:orgId], optional_options
768
+ )
769
+ puts to_output_hash(result).green
770
+ rescue EmassClient::ApiError => e
771
+ puts 'Exception when calling SystemStatusDashboardApi->get_system_status_details'.red
772
+ puts to_output_hash(e)
773
+ end
774
+
775
+ #----------------------------------------------------------------------------
776
+ # Enterprise Terms Conditions Dashboards
777
+ # /api/dashboards/system-terms-conditions-summary
778
+ desc 'terms_conditions_summary', 'Get systems terms conditions summary dashboard information'
779
+ def terms_conditions_summary
780
+ optional_options_keys = optional_options(@_initializer).keys
781
+ optional_options = to_input_hash(optional_options_keys, options)
782
+
783
+ result = EmassClient::EnterpriseTermsConditionsDashboardsApi.new.get_system_terms_conditions_summary(
784
+ options[:orgId], optional_options
785
+ )
786
+ puts to_output_hash(result).green
787
+ rescue EmassClient::ApiError => e
788
+ puts 'Exception when calling EnterpriseTermsConditionsDashboardsApi->get_system_terms_conditions_summary'.red
789
+ puts to_output_hash(e)
790
+ end
791
+
792
+ # /api/dashboards/system-terms-conditions-details
793
+ desc 'terms_conditions_detail', 'Get systems terms conditions details dashboard information'
794
+ def terms_conditions_details
795
+ optional_options_keys = optional_options(@_initializer).keys
796
+ optional_options = to_input_hash(optional_options_keys, options)
797
+
798
+ result = EmassClient::EnterpriseTermsConditionsDashboardsApi.new.get_system_terms_conditions_details(
799
+ options[:orgId], optional_options
800
+ )
801
+ puts to_output_hash(result).green
802
+ rescue EmassClient::ApiError => e
803
+ puts 'Exception when calling EnterpriseTermsConditionsDashboardsApi->get_system_terms_conditions_details'.red
804
+ puts to_output_hash(e)
805
+ end
806
+
807
+ #--------------------------------------------------------------------------
808
+ # Enterprise Security Controls Dashboards
809
+ # /api/dashboards/system-control-compliance-summary
810
+ desc 'control_compliance_summary', 'Get systems control compliance summary dashboard information'
811
+ def control_compliance_summary
812
+ optional_options_keys = optional_options(@_initializer).keys
813
+ optional_options = to_input_hash(optional_options_keys, options)
814
+
815
+ result = EmassClient::EnterpriseSecurityControlsDashboardsApi.new.get_system_control_compliance_summary(
816
+ options[:orgId], optional_options
817
+ )
818
+ puts to_output_hash(result).green
819
+ rescue EmassClient::ApiError => e
820
+ puts 'Exception when calling EnterpriseSecurityControlsDashboardsApi->get_system_control_compliance_summary'.red
821
+ puts to_output_hash(e)
822
+ end
823
+
824
+ # /api/dashboards/system-security-controls-details
825
+ desc 'security_control_details', 'Get systems security control details dashboard information'
826
+ def security_controls_details
827
+ optional_options_keys = optional_options(@_initializer).keys
828
+ optional_options = to_input_hash(optional_options_keys, options)
829
+
830
+ result = EmassClient::EnterpriseSecurityControlsDashboardsApi.new.get_system_security_control_details(
831
+ options[:orgId], optional_options
832
+ )
833
+ puts to_output_hash(result).green
834
+ rescue EmassClient::ApiError => e
835
+ puts 'Exception when calling EnterpriseSecurityControlsDashboardsApi->get_system_security_control_details'.red
836
+ puts to_output_hash(e)
837
+ end
838
+
839
+ # /api/dashboards/system-assessment-procedures-details
840
+ desc 'assessment_procedures_details', 'Get systems assessement procdures details dashboard information'
841
+ def assessment_procedures_details
842
+ optional_options_keys = optional_options(@_initializer).keys
843
+ optional_options = to_input_hash(optional_options_keys, options)
844
+
845
+ result = EmassClient::EnterpriseSecurityControlsDashboardsApi.new.get_system_assessment_procedures_details(
846
+ options[:orgId], optional_options
847
+ )
848
+ puts to_output_hash(result).green
849
+ rescue EmassClient::ApiError => e
850
+ puts 'Exception when calling EnterpriseSecurityControlsDashboardsApi->get_system_assessment_procedures_details'.red
851
+ puts to_output_hash(e)
852
+ end
853
+
854
+ #--------------------------------------------------------------------------
855
+ # Enterprise POA&M Dashboard
856
+ # /api/dashboards/system-poam-summary
857
+ desc 'poam_summary', 'Get systems POA&Ms summary dashboard information'
858
+ def poam_summary
859
+ optional_options_keys = optional_options(@_initializer).keys
860
+ optional_options = to_input_hash(optional_options_keys, options)
861
+
862
+ result = EmassClient::EnterprisePOAMDashboardsApi.new.get_system_poam_summary(
863
+ options[:orgId], optional_options
864
+ )
865
+ puts to_output_hash(result).green
866
+ rescue EmassClient::ApiError => e
867
+ puts 'Exception when calling EnterprisePOAMDashboardsApi->get_system_poam_summary'.red
868
+ puts to_output_hash(e)
869
+ end
870
+
871
+ # /api/dashboards/system-poam-details
872
+ desc 'poam_details', 'Get system POA&Ms details dashboard information'
873
+ def poam_details
874
+ optional_options_keys = optional_options(@_initializer).keys
875
+ optional_options = to_input_hash(optional_options_keys, options)
876
+
877
+ result = EmassClient::EnterprisePOAMDashboardsApi.new.get_system_poam_details(
878
+ options[:orgId], optional_options
879
+ )
880
+ puts to_output_hash(result).green
881
+ rescue EmassClient::ApiError => e
882
+ puts 'Exception when calling EnterprisePOAMDashboardsApi->get_system_poam_details'.red
883
+ puts to_output_hash(e)
884
+ end
885
+
886
+ #--------------------------------------------------------------------------
887
+ # Enterprise Artifacts Dashboard
888
+ # /api/dashboards/system-artifacts-summary
889
+ desc 'artifacts_summary', 'Get systems artifacts summary dashboard information'
890
+ def artifacts_summary
891
+ optional_options_keys = optional_options(@_initializer).keys
892
+ optional_options = to_input_hash(optional_options_keys, options)
893
+
894
+ result = EmassClient::EnterpriseArtifactsDashboardsApi.new.get_system_artifacts_summary(
895
+ options[:orgId], optional_options
896
+ )
897
+ puts to_output_hash(result).green
898
+ rescue EmassClient::ApiError => e
899
+ puts 'Exception when calling EnterpriseArtifactsDashboardsApi->get_system_artifacts_summary'.red
900
+ puts to_output_hash(e)
901
+ end
902
+
903
+ # /api/dashboards/system-artifacts-details
904
+ desc 'artifacts_details', 'Get systems artifacts summary dashboard information'
905
+ def artifacts_details
906
+ optional_options_keys = optional_options(@_initializer).keys
907
+ optional_options = to_input_hash(optional_options_keys, options)
908
+
909
+ result = EmassClient::EnterpriseArtifactsDashboardsApi.new.get_system_artifacts_details(
910
+ options[:orgId], optional_options
911
+ )
912
+ puts to_output_hash(result).green
913
+ rescue EmassClient::ApiError => e
914
+ puts 'Exception when calling EnterpriseArtifactsDashboardsApi->get_system_artifacts_details'.red
915
+ puts to_output_hash(e)
916
+ end
917
+
918
+ #--------------------------------------------------------------------------
919
+ # Hardware Baseline Dashboard
920
+ # /api/dashboards/system-hardware-summary
921
+ desc 'hardware_summary', 'Get system hardware summary dashboard information'
922
+ def hardware_summary
923
+ optional_options_keys = optional_options(@_initializer).keys
924
+ optional_options = to_input_hash(optional_options_keys, options)
925
+
926
+ result = EmassClient::HardwareBaselineDashboardsApi.new.get_system_hardware_summary(
927
+ options[:orgId], optional_options
928
+ )
929
+ puts to_output_hash(result).green
930
+ rescue EmassClient::ApiError => e
931
+ puts 'Exception when calling HardwareBaselineDashboardsApi->get_system_hardware_summary'.red
932
+ puts to_output_hash(e)
933
+ end
934
+
935
+ # /api/dashboards/system-hardware-details
936
+ desc 'hardware_details', 'Get system hardware details dashboard information'
937
+ def hardware_details
938
+ optional_options_keys = optional_options(@_initializer).keys
939
+ optional_options = to_input_hash(optional_options_keys, options)
940
+
941
+ result = EmassClient::HardwareBaselineDashboardsApi.new.get_system_hardware_details(
942
+ options[:orgId], optional_options
943
+ )
944
+ puts to_output_hash(result).green
945
+ rescue EmassClient::ApiError => e
946
+ puts 'Exception when calling HardwareBaselineDashboardsApi->get_system_hardware_details'.red
947
+ puts to_output_hash(e)
948
+ end
949
+
950
+ #--------------------------------------------------------------------------
951
+ # Enterprise Sensor-based Hardware Resources Dashboard
952
+ # /api/dashboards/system-sensor-hardware-summary
953
+ desc 'sensor_hardware_summary', 'Get system sensor hardware summary dashboard information'
954
+ def sensor_hardware_summary
955
+ optional_options_keys = optional_options(@_initializer).keys
956
+ optional_options = to_input_hash(optional_options_keys, options)
957
+
958
+ result = EmassClient::EnterpriseSensorBasedHardwareResourcesDashboardsApi.new.get_system_sensor_hardware_summary(
959
+ options[:orgId], optional_options
960
+ )
961
+ puts to_output_hash(result).green
962
+ rescue EmassClient::ApiError => e
963
+ puts 'Exception when calling EnterpriseSensorBasedHardwareResourcesDashboardsApi->get_system_sensor_hardware_summary'.red
964
+ puts to_output_hash(e)
965
+ end
966
+
967
+ # /api/dashboards/system-sensor-hardware-details
968
+ desc 'sensor_hardware_details', 'Get system sensor hardware details dashboard information'
969
+ def sensor_hardware_details
970
+ optional_options_keys = optional_options(@_initializer).keys
971
+ optional_options = to_input_hash(optional_options_keys, options)
972
+
973
+ result = EmassClient::EnterpriseSensorBasedHardwareResourcesDashboardsApi.new.get_system_sensor_hardware_details(
974
+ options[:orgId], optional_options
975
+ )
976
+ puts to_output_hash(result).green
977
+ rescue EmassClient::ApiError => e
978
+ puts 'Exception when calling EnterpriseSensorBasedHardwareResourcesDashboardsApi->get_system_sensor_hardware_details'.red
979
+ puts to_output_hash(e)
980
+ end
981
+
982
+ #--------------------------------------------------------------------------
983
+ # Software Baseline Dashboards
984
+ # /api/dashboards/system-software-summary
985
+ desc 'software_summary', 'Get system software summary dashboard information'
986
+ def software_summary
987
+ optional_options_keys = optional_options(@_initializer).keys
988
+ optional_options = to_input_hash(optional_options_keys, options)
989
+
990
+ result = EmassClient::SoftwareBaselineDashboardsApi.new.get_system_software_summary(
991
+ options[:orgId], optional_options
992
+ )
993
+ puts to_output_hash(result).green
994
+ rescue EmassClient::ApiError => e
995
+ puts 'Exception when calling SoftwareBaselineDashboardsApi->get_system_software_summary'.red
996
+ puts to_output_hash(e)
997
+ end
998
+
999
+ # /api/dashboards/system-software-details
1000
+ desc 'software_details', 'Get system software details dashboard information'
1001
+ def software_details
1002
+ optional_options_keys = optional_options(@_initializer).keys
1003
+ optional_options = to_input_hash(optional_options_keys, options)
1004
+
1005
+ result = EmassClient::SoftwareBaselineDashboardsApi.new.get_system_software_details(
1006
+ options[:orgId], optional_options
1007
+ )
1008
+ puts to_output_hash(result).green
1009
+ rescue EmassClient::ApiError => e
1010
+ puts 'Exception when calling SoftwareBaselineDashboardsApi->get_system_software_details'.red
1011
+ puts to_output_hash(e)
1012
+ end
1013
+
1014
+ #--------------------------------------------------------------------------
1015
+ # Enterprise Sensor-based Software Resources Dashboards
1016
+ # /api/dashboards/system-sensor-software-summary
1017
+ desc 'sensor_software_summary', 'Get system sensor software summary dashboard information'
1018
+ def sensor_software_summary
1019
+ optional_options_keys = optional_options(@_initializer).keys
1020
+ optional_options = to_input_hash(optional_options_keys, options)
1021
+
1022
+ result = EmassClient::EnterpriseSensorBasedSoftwareResourcesDashboardsApi.new.get_system_sensor_software_summary(
1023
+ options[:orgId], optional_options
1024
+ )
1025
+ puts to_output_hash(result).green
1026
+ rescue EmassClient::ApiError => e
1027
+ puts 'Exception when calling EnterpriseSensorBasedSoftwareResourcesDashboardsApi->get_system_sensor_software_summary'.red
1028
+ puts to_output_hash(e)
1029
+ end
1030
+
1031
+ # /api/dashboards/system-sensor-software-details
1032
+ desc 'sensor_software_details', 'Get system sensor software details dashboard information'
1033
+ def sensor_software_details
1034
+ optional_options_keys = optional_options(@_initializer).keys
1035
+ optional_options = to_input_hash(optional_options_keys, options)
1036
+
1037
+ result = EmassClient::EnterpriseSensorBasedSoftwareResourcesDashboardsApi.new.get_system_sensor_software_details(
1038
+ options[:orgId], optional_options
1039
+ )
1040
+ puts to_output_hash(result).green
1041
+ rescue EmassClient::ApiError => e
1042
+ puts 'Exception when calling EnterpriseSensorBasedSoftwareResourcesDashboardsApi->get_system_sensor_software_details'.red
1043
+ puts to_output_hash(e)
1044
+ end
1045
+
1046
+ # /api/dashboards/system-sensor-software-counts
1047
+ desc 'sensor_software_counts', 'Get system sensor software counts dashboard information'
1048
+ def sensor_software_counts
1049
+ optional_options_keys = optional_options(@_initializer).keys
1050
+ optional_options = to_input_hash(optional_options_keys, options)
1051
+
1052
+ result = EmassClient::EnterpriseSensorBasedSoftwareResourcesDashboardsApi.new.get_system_sensor_software_counts(
1053
+ options[:orgId], optional_options
1054
+ )
1055
+ puts to_output_hash(result).green
1056
+ rescue EmassClient::ApiError => e
1057
+ puts 'Exception when calling EnterpriseSensorBasedSoftwareResourcesDashboardsApi->get_system_sensor_software_counts'.red
1058
+ puts to_output_hash(e)
1059
+ end
1060
+
1061
+ #--------------------------------------------------------------------------
1062
+ # Enterprise Vulnerability Dashboards
1063
+ # /api/dashboards/system-vulnerability-summary
1064
+ desc 'vulnerability_summary', 'Get system vulnerability summary dashboard information'
1065
+ def vulnerability_summary
1066
+ optional_options_keys = optional_options(@_initializer).keys
1067
+ optional_options = to_input_hash(optional_options_keys, options)
1068
+
1069
+ result = EmassClient::EnterpriseVulnerabilityDashboardsApi.new.get_system_vulnerability_summary(
1070
+ options[:orgId], optional_options
1071
+ )
1072
+ puts to_output_hash(result).green
1073
+ rescue EmassClient::ApiError => e
1074
+ puts 'Exception when calling EnterpriseVulnerabilityDashboardsApi->get_system_vulnerability_summary'.red
1075
+ puts to_output_hash(e)
1076
+ end
1077
+
1078
+ # /api/dashboards/system-device-findings-summary
1079
+ desc 'device_findings_summary', 'Get system device findings summary dashboard information'
1080
+ def device_findings_summary
1081
+ optional_options_keys = optional_options(@_initializer).keys
1082
+ optional_options = to_input_hash(optional_options_keys, options)
1083
+
1084
+ result = EmassClient::EnterpriseVulnerabilityDashboardsApi.new.get_system_device_findings_summary(
1085
+ options[:orgId], optional_options
1086
+ )
1087
+ puts to_output_hash(result).green
1088
+ rescue EmassClient::ApiError => e
1089
+ puts 'Exception when calling EnterpriseVulnerabilityDashboardsApi->get_system_device_findings_summary'.red
1090
+ puts to_output_hash(e)
1091
+ end
1092
+
1093
+ # /api/dashboards/system-device-findings-details
1094
+ desc 'device_findings_details', 'Get system device findings details dashboard information'
1095
+ def device_findings_details
1096
+ optional_options_keys = optional_options(@_initializer).keys
1097
+ optional_options = to_input_hash(optional_options_keys, options)
1098
+
1099
+ result = EmassClient::EnterpriseVulnerabilityDashboardsApi.new.get_system_device_findings_details(
1100
+ options[:orgId], optional_options
1101
+ )
1102
+ puts to_output_hash(result).green
1103
+ rescue EmassClient::ApiError => e
1104
+ puts 'Exception when calling EnterpriseVulnerabilityDashboardsApi->get_system_device_findings_details'.red
1105
+ puts to_output_hash(e)
1106
+ end
1107
+
1108
+ #--------------------------------------------------------------------------
1109
+ # Ports and Protocols Dashboards
1110
+ # /api/dashboards/system-ports-protocols-summary
1111
+ desc 'ports_protocols_summary', 'Get system ports & portocols summary dashboard information'
1112
+ def ports_protocols_summary
1113
+ optional_options_keys = optional_options(@_initializer).keys
1114
+ optional_options = to_input_hash(optional_options_keys, options)
1115
+
1116
+ result = EmassClient::PortsAndProtocolsDashboardsApi.new.get_system_ports_protocols_summary(
1117
+ options[:orgId], optional_options
1118
+ )
1119
+ puts to_output_hash(result).green
1120
+ rescue EmassClient::ApiError => e
1121
+ puts 'Exception when calling PortsAndProtocolsDashboardsApi->get_system_ports_protocols_summary'.red
1122
+ puts to_output_hash(e)
1123
+ end
1124
+
1125
+ # /api/dashboards/system-ports-protocols-details
1126
+ desc 'ports_protocols_details', 'Get system ports & portocols details dashboard information'
1127
+ def ports_protocols_details
1128
+ optional_options_keys = optional_options(@_initializer).keys
1129
+ optional_options = to_input_hash(optional_options_keys, options)
1130
+
1131
+ result = EmassClient::PortsAndProtocolsDashboardsApi.new.get_system_ports_protocols_details(
1132
+ options[:orgId], optional_options
1133
+ )
1134
+ puts to_output_hash(result).green
1135
+ rescue EmassClient::ApiError => e
1136
+ puts 'Exception when calling PortsAndProtocolsDashboardsApi->get_system_ports_protocols_details'.red
1137
+ puts to_output_hash(e)
1138
+ end
1139
+
1140
+ #--------------------------------------------------------------------------
1141
+ # System CONMON Integration Status Dashboard
1142
+ # /api/dashboards/system-conmon-integration-status-summary
1143
+ desc 'integration_status_summary', 'Get system conmon integration status summary dashboard information'
1144
+ def integration_status_summary
1145
+ optional_options_keys = optional_options(@_initializer).keys
1146
+ optional_options = to_input_hash(optional_options_keys, options)
1147
+
1148
+ result = EmassClient::SystemCONMONIntegrationStatusDashboardApi.new.get_system_common_integration_status_summary(
1149
+ options[:orgId], optional_options
1150
+ )
1151
+ puts to_output_hash(result).green
1152
+ rescue EmassClient::ApiError => e
1153
+ puts 'Exception when calling SystemCONMONIntegrationStatusDashboardApi->get_system_common_integration_status_summary'.red
1154
+ puts to_output_hash(e)
1155
+ end
1156
+
1157
+ #--------------------------------------------------------------------------
1158
+ # System Associations Dashboard
1159
+ # /api/dashboards/system-associations-details
1160
+ desc 'associations_details', 'Get system associations details dashboard information'
1161
+ def associations_details
1162
+ optional_options_keys = optional_options(@_initializer).keys
1163
+ optional_options = to_input_hash(optional_options_keys, options)
1164
+
1165
+ result = EmassClient::SystemAssociationsDashboardApi.new.get_system_associations_details(
1166
+ options[:orgId], optional_options
1167
+ )
1168
+ puts to_output_hash(result).green
1169
+ rescue EmassClient::ApiError => e
1170
+ puts 'Exception when calling SystemAssociationsDashboardApi->get_system_associations_details'.red
1171
+ puts to_output_hash(e)
1172
+ end
1173
+
1174
+ #--------------------------------------------------------------------------
1175
+ # Users Dashboard
1176
+ # /api/dashboards/user-system-assignments-details
1177
+ desc 'assignments_details', 'Get user system assignments details dashboard information'
1178
+ def assignments_details
1179
+ optional_options_keys = optional_options(@_initializer).keys
1180
+ optional_options = to_input_hash(optional_options_keys, options)
1181
+
1182
+ result = EmassClient::UsersDashboardApi.new.get_user_system_assignments_details(
1183
+ options[:orgId], optional_options
1184
+ )
1185
+ puts to_output_hash(result).green
1186
+ rescue EmassClient::ApiError => e
1187
+ puts 'Exception when calling UsersDashboardApi->get_user_system_assignments_details'.red
1188
+ puts to_output_hash(e)
1189
+ end
1190
+
1191
+ #--------------------------------------------------------------------------
1192
+ # Privacy Compliance Dashboard
1193
+ # /api/dashboards/system-privacy-summary
1194
+ desc 'privacy_summary', 'Get user system privacy summary dashboard information'
1195
+ def privacy_summary
1196
+ optional_options_keys = optional_options(@_initializer).keys
1197
+ optional_options = to_input_hash(optional_options_keys, options)
1198
+
1199
+ result = EmassClient::PrivacyComplianceDashboardsApi.new.get_system_privacy_summary(
1200
+ options[:orgId], optional_options
1201
+ )
1202
+ puts to_output_hash(result).green
1203
+ rescue EmassClient::ApiError => e
1204
+ puts 'Exception when calling PrivacyComplianceDashboardsApi->get_system_privacy_summary'.red
1205
+ puts to_output_hash(e)
1206
+ end
1207
+
1208
+ # /api/dashboards/va-omb-fisma-saop-summary
1209
+ desc 'fisma_saop_summary', 'Get VA OMB-FISMA SAOP summary dashboard information'
1210
+ def fisma_saop_summary
1211
+ optional_options_keys = optional_options(@_initializer).keys
1212
+ optional_options = to_input_hash(optional_options_keys, options)
1213
+
1214
+ result = EmassClient::PrivacyComplianceDashboardsApi.new.get_va_omb_fsma_saop_summary(
1215
+ options[:orgId], optional_options
1216
+ )
1217
+ puts to_output_hash(result).green
1218
+ rescue EmassClient::ApiError => e
1219
+ puts 'Exception when calling PrivacyComplianceDashboardsApi->get_va_omb_fsma_saop_summary'.red
1220
+ puts to_output_hash(e).yellow
1221
+ end
1222
+
1223
+ #--------------------------------------------------------------------------
1224
+ # System A&A Summary Dashboard
1225
+ # /api/dashboards/va-system-aa-summary
1226
+ desc 'va_aa_summary', 'Get VA system A&A summary dashboard information'
1227
+ def va_aa_summary
1228
+ optional_options_keys = optional_options(@_initializer).keys
1229
+ optional_options = to_input_hash(optional_options_keys, options)
1230
+
1231
+ result = EmassClient::SystemAASummaryDashboardApi.new.get_va_system_aa_summary(
1232
+ options[:orgId], optional_options
1233
+ )
1234
+ puts to_output_hash(result).green
1235
+ rescue EmassClient::ApiError => e
1236
+ puts 'Exception when calling SystemAASummaryDashboardApi->get_va_system_aa_summary'.red
1237
+ puts to_output_hash(e).yellow
1238
+ end
1239
+
1240
+ #--------------------------------------------------------------------------
1241
+ # System A2.0 Summary Dashboard
1242
+ # /api/dashboards/va-system-a2-summary
1243
+ desc 'va_a2_summary', 'Get VA system A2.0 summary dashboard information'
1244
+ def va_a2_summary
1245
+ optional_options_keys = optional_options(@_initializer).keys
1246
+ optional_options = to_input_hash(optional_options_keys, options)
1247
+
1248
+ result = EmassClient::SystemA20SummaryDashboardApi.new.get_va_system_a2_summary(
1249
+ options[:orgId], optional_options
1250
+ )
1251
+ puts to_output_hash(result).green
1252
+ rescue EmassClient::ApiError => e
1253
+ puts 'Exception when calling SystemA20SummaryDashboardApi->get_va_system_a2_summary'.red
1254
+ puts to_output_hash(e).yellow
1255
+ end
1256
+
1257
+ #--------------------------------------------------------------------------
1258
+ # System P.L. 109 Reporting Summary Dashboard
1259
+ # /api/dashboards/va-system-pl-109-reporting-summary
1260
+ desc 'va_pl_109_summary', 'Get VA System P.L. 109 reporting summary dashboard information'
1261
+ def va_pl_109_summary
1262
+ optional_options_keys = optional_options(@_initializer).keys
1263
+ optional_options = to_input_hash(optional_options_keys, options)
1264
+
1265
+ result = EmassClient::SystemPL109ReportingSummaryDashboardApi.new.get_va_system_pl109_reporting_summary(
1266
+ options[:orgId], optional_options
1267
+ )
1268
+ puts to_output_hash(result).green
1269
+ rescue EmassClient::ApiError => e
1270
+ puts 'Exception when calling SystemPL109ReportingSummaryDashboardApi->get_va_system_pl109_reporting_summary'.red
1271
+ puts to_output_hash(e).yellow
1272
+ end
1273
+
1274
+ #--------------------------------------------------------------------------
1275
+ # FISMA Inventory Summary Dashboard
1276
+ # /api/dashboards/va-system-fisma-inventory-summary
1277
+ desc 'fisma_inventory_summary', 'Get VA system FISMA inventory summary dashboard information'
1278
+ def fisma_inventory_summary
1279
+ optional_options_keys = optional_options(@_initializer).keys
1280
+ optional_options = to_input_hash(optional_options_keys, options)
1281
+
1282
+ result = EmassClient::FISMAInventorySummaryDashboardsApi.new.get_va_system_fisma_invetory_summary(
1283
+ options[:orgId], optional_options
1284
+ )
1285
+ puts to_output_hash(result).green
1286
+ rescue EmassClient::ApiError => e
1287
+ puts 'Exception when calling FISMAInventorySummaryDashboardsApi->get_va_system_fisma_invetory_summary'.red
1288
+ puts to_output_hash(e).yellow
1289
+ end
1290
+
1291
+ # /api/dashboards/va-system-fisma-inventory-crypto-summary
1292
+ desc 'fisma_inventory_crypto_summary', 'Get VA system FISMA inventory crypto summary dashboard information'
1293
+ def fisma_inventory_crypto_summary
1294
+ optional_options_keys = optional_options(@_initializer).keys
1295
+ optional_options = to_input_hash(optional_options_keys, options)
1296
+
1297
+ result = EmassClient::FISMAInventorySummaryDashboardsApi.new.get_va_system_fisma_invetory_crypto_summary(
1298
+ options[:orgId], optional_options
1299
+ )
1300
+ puts to_output_hash(result).green
1301
+ rescue EmassClient::ApiError => e
1302
+ puts 'Exception when calling FISMAInventorySummaryDashboardsApi->get_va_system_fisma_invetory_crypto_summary'.red
1303
+ puts to_output_hash(e).yellow
1304
+ end
1305
+
1306
+ #--------------------------------------------------------------------------
1307
+ # Threat Risks Dashboard
1308
+ # /api/dashboards/va-system-threat-risks-summary
1309
+ desc 'threat_risk_summary', 'Get VA System Threat Risks Summary dashboard information'
1310
+ def threat_risk_summary
1311
+ optional_options_keys = optional_options(@_initializer).keys
1312
+ optional_options = to_input_hash(optional_options_keys, options)
1313
+
1314
+ result = EmassClient::ThreatRisksDashboardsApi.new.get_va_system_threat_risk_summary(
1315
+ options[:orgId], optional_options
1316
+ )
1317
+ puts to_output_hash(result).green
1318
+ rescue EmassClient::ApiError => e
1319
+ puts 'Exception when calling ThreatRisksDashboardsApi->get_va_system_threat_risk_summary'.red
1320
+ puts to_output_hash(e).yellow
1321
+ end
1322
+
1323
+ # /api/dashboards/va-system-threat-sources-details
1324
+ desc 'threat_risk_details', 'Get VA System Threat Sources Details dashboard information'
1325
+ def threat_risk_details
1326
+ optional_options_keys = optional_options(@_initializer).keys
1327
+ optional_options = to_input_hash(optional_options_keys, options)
1328
+
1329
+ result = EmassClient::ThreatRisksDashboardsApi.new.get_va_system_threat_source_details(
1330
+ options[:orgId], optional_options
1331
+ )
1332
+ puts to_output_hash(result).green
1333
+ rescue EmassClient::ApiError => e
1334
+ puts 'Exception when calling ThreatRisksDashboardsApi->get_va_system_threat_source_details'.red
1335
+ puts to_output_hash(e).yellow
1336
+ end
1337
+
1338
+ # /api/dashboards/va-system-threat-architecture-details
1339
+ desc 'threat_architecture_details', 'Get VA System Threat Architecture Detail dashboard information'
1340
+ def threat_architecture_details
1341
+ optional_options_keys = optional_options(@_initializer).keys
1342
+ optional_options = to_input_hash(optional_options_keys, options)
1343
+
1344
+ result = EmassClient::ThreatRisksDashboardsApi.new.get_va_system_threat_architecture_details(
1345
+ options[:orgId], optional_options
1346
+ )
1347
+ puts to_output_hash(result).green
1348
+ rescue EmassClient::ApiError => e
1349
+ puts 'Exception when calling ThreatRisksDashboardsApi->get_va_system_threat_architecture_details'.red
1350
+ puts to_output_hash(e).yellow
1351
+ end
1352
+ end
1353
+
1354
+ class Get < SubCommandBase
1355
+ desc 'test', 'Test connection to the configured eMASS server'
1356
+ subcommand 'test', Test
1357
+
1358
+ desc 'system', 'Get a system ID given name/owner, or get a system by ID'
1359
+ subcommand 'system', System
1360
+
1361
+ desc 'systems', 'Get all systems'
1362
+ subcommand 'systems', Systems
1363
+
1364
+ desc 'roles', 'Get all system roles or by category Id'
1365
+ subcommand 'roles', Roles
1366
+
1367
+ desc 'controls', 'Get system Controls'
1368
+ subcommand 'controls', Controls
1369
+
1370
+ desc 'test_results', 'Get system Test Results'
1371
+ subcommand 'test_results', TestResults
1372
+
1373
+ desc 'poams', 'Get system Poams'
1374
+ subcommand 'poams', Poams
1375
+
1376
+ desc 'milestones', 'Get system Milestones'
1377
+ subcommand 'milestones', Milestones
1378
+
1379
+ desc 'artifacts', 'Get system Artifacts'
1380
+ subcommand 'artifacts', Artifacts
1381
+
1382
+ desc 'cac', 'Get location of one or many controls in CAC'
1383
+ subcommand 'cac', CAC
1384
+
1385
+ desc 'pac', 'Get status of active workflows in a system'
1386
+ subcommand 'pac', PAC
1387
+
1388
+ desc 'cmmc', 'Get CMMC assessment information'
1389
+ subcommand 'cmmc', CMMC
1390
+
1391
+ desc 'workflow_definitions', 'Get workflow definitions in a site'
1392
+ subcommand 'workflow_definitions', WorkflowDefinitions
1393
+
1394
+ desc 'workflow_instances', 'Get workflow instance by system and/or ID in a system'
1395
+ subcommand 'workflow_instances', WorkflowInstances
1396
+
1397
+ desc 'dashboards', 'Get dashboard information'
1398
+ subcommand 'dashboards', Dashboards
1399
+ end
1400
+ end
1401
+ # rubocop:enable Naming/MethodName