emasser 1.0.3 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.env-example +2 -0
  3. data/.github/workflows/gh-pages.yml +4 -5
  4. data/.github/workflows/release.yml +9 -9
  5. data/Dockerfile +6 -4
  6. data/Gemfile +1 -1
  7. data/Gemfile.lock +25 -32
  8. data/README.md +87 -78
  9. data/docs/features.md +455 -213
  10. data/docs/images/emasser_architecture.jpg +0 -0
  11. data/emasser.gemspec +5 -3
  12. data/images/emasser_architecture.jpg +0 -0
  13. data/images/emasser_diagram-Page-3.jpg +0 -0
  14. data/lib/emasser/cli.rb +2 -2
  15. data/lib/emasser/configuration.rb +1 -0
  16. data/lib/emasser/constants.rb +11 -3
  17. data/lib/emasser/delete.rb +9 -7
  18. data/lib/emasser/get.rb +323 -49
  19. data/lib/emasser/help/cloudresource_post_mapper.md +62 -0
  20. data/lib/emasser/help/container_post_mapper.md +44 -0
  21. data/lib/emasser/output_converters.rb +101 -4
  22. data/lib/emasser/post.rb +231 -38
  23. data/lib/emasser/put.rb +23 -16
  24. data/lib/emasser/version.rb +1 -1
  25. metadata +15 -27
  26. data/.github/workflows/generate_docs.yml +0 -33
  27. data/docs/developers.md +0 -115
  28. data/docs/swagger/dist/favicon-16x16.png +0 -0
  29. data/docs/swagger/dist/favicon-32x32.png +0 -0
  30. data/docs/swagger/dist/oauth2-redirect.html +0 -75
  31. data/docs/swagger/dist/swagger-ui-bundle.js +0 -3
  32. data/docs/swagger/dist/swagger-ui-bundle.js.map +0 -1
  33. data/docs/swagger/dist/swagger-ui-es-bundle-core.js +0 -3
  34. data/docs/swagger/dist/swagger-ui-es-bundle-core.js.map +0 -1
  35. data/docs/swagger/dist/swagger-ui-es-bundle.js +0 -3
  36. data/docs/swagger/dist/swagger-ui-es-bundle.js.map +0 -1
  37. data/docs/swagger/dist/swagger-ui-standalone-preset.js +0 -3
  38. data/docs/swagger/dist/swagger-ui-standalone-preset.js.map +0 -1
  39. data/docs/swagger/dist/swagger-ui.css +0 -4
  40. data/docs/swagger/dist/swagger-ui.css.map +0 -1
  41. data/docs/swagger/dist/swagger-ui.js +0 -3
  42. data/docs/swagger/dist/swagger-ui.js.map +0 -1
  43. data/docs/swagger/index.html +0 -60
data/emasser.gemspec CHANGED
@@ -6,11 +6,11 @@ Gem::Specification.new do |spec|
6
6
  spec.name = 'emasser'
7
7
  spec.version = Emasser::VERSION
8
8
  spec.authors = ['Amndeep Singh Mann', 'George Dias', 'Kyle Fagan', 'Robert Clark', 'Aaron Lippold']
9
- spec.email = ['saf@mitre.org']
9
+ spec.email = ['saf@groups.mitre.org']
10
10
  spec.licenses = ['Apache-2.0']
11
11
 
12
12
  spec.summary = 'Provide an automated capability for invoving eMASS API endpoints'
13
- spec.description = 'emasser can be used as a gem or used from the command line to access eMASS via thei API.'
13
+ spec.description = 'emasser can be used as a gem or used from the command line (CL) to access eMASS endpoints via their API.'
14
14
  spec.homepage = 'https://saf.mitre.org'
15
15
  spec.required_ruby_version = Gem::Requirement.new('~> 2.5')
16
16
 
@@ -21,13 +21,15 @@ Gem::Specification.new do |spec|
21
21
  end
22
22
  spec.bindir = 'exe'
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ # References: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-rubygems-registry
25
+ spec.metadata = { "github_repo" => "ssh://github.com/mitre/emasser" }
24
26
 
25
27
  spec.add_runtime_dependency 'activesupport', '~> 6.1.4'
26
28
  spec.add_runtime_dependency 'colorize', '~> 0.8.1'
27
29
  spec.add_runtime_dependency 'dotenv', '~> 2.7.6'
28
30
  spec.add_runtime_dependency 'rubyzip', '~> 2.3.2'
29
31
  spec.add_runtime_dependency 'thor', '~> 1.1.0'
30
- spec.add_runtime_dependency 'emass_client', '~> 1.0'
32
+ spec.add_runtime_dependency 'emass_client', '~> 3.0'
31
33
 
32
34
  spec.add_development_dependency 'bundler', '~> 2.3'
33
35
  spec.add_development_dependency 'bundler-audit', '~> 0.7'
Binary file
Binary file
data/lib/emasser/cli.rb CHANGED
@@ -20,8 +20,8 @@ module Emasser
20
20
  puts "emasser version: #{Emasser::VERSION}".green
21
21
  exit
22
22
  elsif ARGV[0].to_s.include? 'hello'
23
- user_name = ENV['USERNAME'] || 'rookie'
24
- puts "Hello #{user_name} - enjoy using emasser!".cyan
23
+ user_name = ENV.fetch('USERNAME', 'rookie')
24
+ puts "Hello #{user_name} - enjoy using emasser version #{Emasser::VERSION}!".cyan
25
25
  exit
26
26
  end
27
27
 
@@ -33,6 +33,7 @@ module Emasser
33
33
  config.api_key['user-uid'] = raise_unless_present('EMASSER_API_KEY_USER_UID')
34
34
  config.scheme = 'https'
35
35
  config.base_path = '/'
36
+ config.server_index = nil
36
37
  config.host = raise_unless_present('EMASSER_HOST')
37
38
  config.key_file = raise_unless_present('EMASSER_KEY_FILE_PATH')
38
39
  config.cert_file = raise_unless_present('EMASSER_CERT_FILE_PATH')
@@ -5,14 +5,22 @@ module Emasser
5
5
  include_package: false,
6
6
  include_ditpr_metrics: false,
7
7
  include_decommissioned: false,
8
- return_type: 'SystemResponse' # This is used by swagger client only to format output
8
+ debug_return_type: 'SystemResponse' # This is used by swagger client only to format output
9
9
  }.freeze
10
10
 
11
11
  GET_SYSTEM_RETURN_TYPE = {
12
- return_type: 'SystemResponse'
12
+ debug_return_type: 'SystemResponse'
13
13
  }.freeze
14
14
 
15
15
  GET_ARTIFACTS_RETURN_TYPE = {
16
- return_type: 'String'
16
+ debug_return_type: 'String'
17
+ }.freeze
18
+
19
+ GET_WORKFLOWINSTANCES_RETURN_TYPE = {
20
+ debug_return_type: 'Object'
21
+ }.freeze
22
+
23
+ DEL_MILESTONES_RETURN_TYPE = {
24
+ debug_return_type: 'Object'
17
25
  }.freeze
18
26
  end
@@ -55,11 +55,11 @@ module Emasser
55
55
  option :poamId, type: :numeric, required: true, desc: 'A numeric value representing the poam identification'
56
56
 
57
57
  def remove
58
- body = EmassClient::DeletePoam.new
58
+ body = EmassClient::PoamGet.new
59
59
  body.poam_id = options[:poamId]
60
60
  body_array = Array.new(1, body)
61
61
 
62
- result = EmassClient::POAMApi.new.delete_poam(body_array, options[:systemId])
62
+ result = EmassClient::POAMApi.new.delete_poam(options[:systemId], body_array)
63
63
  puts to_output_hash(result).green
64
64
  rescue EmassClient::ApiError => e
65
65
  puts 'Exception when calling POAMApi->delete_poam'.red
@@ -88,16 +88,18 @@ module Emasser
88
88
  desc: 'A numeric value representing the milestone identification'
89
89
 
90
90
  def remove
91
- body = EmassClient::DeleteMilestone.new
91
+ body = EmassClient::MilestonesGet.new
92
92
  body.milestone_id = options[:milestoneId]
93
93
  body_array = Array.new(1, body)
94
94
 
95
- result = EmassClient::MilestonesApi.new.delete_milestone(body_array, options[:systemId], options[:poamId])
96
- # The server returns an empty object upon successfully deleting a milestone.
95
+ # Getting an empty return when utilizing the default return type - using 'Object' as return type
96
+ opts = Emasser::DEL_MILESTONES_RETURN_TYPE
97
+
98
+ result = EmassClient::MilestonesApi.new.delete_milestone(options[:systemId], options[:poamId], body_array, opts)
97
99
  puts to_output_hash(result).green
98
100
  rescue EmassClient::ApiError => e
99
101
  puts 'Exception when calling MilestonesApi->delete_milestone'.red
100
- puts to_output_hash(e)
102
+ puts to_output_hash(e).yellow
101
103
  end
102
104
  end
103
105
 
@@ -125,7 +127,7 @@ module Emasser
125
127
  body_array << obj
126
128
  end
127
129
 
128
- result = EmassClient::ArtifactsApi.new.delete_artifact(body_array, options[:systemId])
130
+ result = EmassClient::ArtifactsApi.new.delete_artifact(options[:systemId], body_array)
129
131
  puts to_output_hash(result).green
130
132
  rescue EmassClient::ApiError => e
131
133
  puts 'Exception when calling ArtifactsApi->delete_artifact'.red