emasser 1.0.3 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env-example +2 -0
- data/.github/workflows/gh-pages.yml +4 -5
- data/.github/workflows/release.yml +9 -9
- data/Dockerfile +6 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +25 -32
- data/README.md +87 -78
- data/docs/features.md +455 -213
- data/docs/images/emasser_architecture.jpg +0 -0
- data/emasser.gemspec +5 -3
- data/images/emasser_architecture.jpg +0 -0
- data/images/emasser_diagram-Page-3.jpg +0 -0
- data/lib/emasser/cli.rb +2 -2
- data/lib/emasser/configuration.rb +1 -0
- data/lib/emasser/constants.rb +11 -3
- data/lib/emasser/delete.rb +9 -7
- data/lib/emasser/get.rb +323 -49
- data/lib/emasser/help/cloudresource_post_mapper.md +62 -0
- data/lib/emasser/help/container_post_mapper.md +44 -0
- data/lib/emasser/output_converters.rb +101 -4
- data/lib/emasser/post.rb +231 -38
- data/lib/emasser/put.rb +23 -16
- data/lib/emasser/version.rb +1 -1
- metadata +15 -27
- data/.github/workflows/generate_docs.yml +0 -33
- data/docs/developers.md +0 -115
- data/docs/swagger/dist/favicon-16x16.png +0 -0
- data/docs/swagger/dist/favicon-32x32.png +0 -0
- data/docs/swagger/dist/oauth2-redirect.html +0 -75
- data/docs/swagger/dist/swagger-ui-bundle.js +0 -3
- data/docs/swagger/dist/swagger-ui-bundle.js.map +0 -1
- data/docs/swagger/dist/swagger-ui-es-bundle-core.js +0 -3
- data/docs/swagger/dist/swagger-ui-es-bundle-core.js.map +0 -1
- data/docs/swagger/dist/swagger-ui-es-bundle.js +0 -3
- data/docs/swagger/dist/swagger-ui-es-bundle.js.map +0 -1
- data/docs/swagger/dist/swagger-ui-standalone-preset.js +0 -3
- data/docs/swagger/dist/swagger-ui-standalone-preset.js.map +0 -1
- data/docs/swagger/dist/swagger-ui.css +0 -4
- data/docs/swagger/dist/swagger-ui.css.map +0 -1
- data/docs/swagger/dist/swagger-ui.js +0 -3
- data/docs/swagger/dist/swagger-ui.js.map +0 -1
- data/docs/swagger/index.html +0 -60
Binary file
|
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
|
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', '~>
|
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
|
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')
|
data/lib/emasser/constants.rb
CHANGED
@@ -5,14 +5,22 @@ module Emasser
|
|
5
5
|
include_package: false,
|
6
6
|
include_ditpr_metrics: false,
|
7
7
|
include_decommissioned: false,
|
8
|
-
|
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
|
-
|
12
|
+
debug_return_type: 'SystemResponse'
|
13
13
|
}.freeze
|
14
14
|
|
15
15
|
GET_ARTIFACTS_RETURN_TYPE = {
|
16
|
-
|
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
|
data/lib/emasser/delete.rb
CHANGED
@@ -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::
|
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(
|
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::
|
91
|
+
body = EmassClient::MilestonesGet.new
|
92
92
|
body.milestone_id = options[:milestoneId]
|
93
93
|
body_array = Array.new(1, body)
|
94
94
|
|
95
|
-
|
96
|
-
|
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(
|
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
|