diff options
| author | mo <mo.khan@gmail.com> | 2018-03-18 17:37:30 -0600 |
|---|---|---|
| committer | mo <mo.khan@gmail.com> | 2018-03-18 17:37:30 -0600 |
| commit | e496812f1aa71d2fc98cf01f8efc032e2171b4a2 (patch) | |
| tree | e1f05ba6e1b8372e1b8fcedf778180846a6d4538 | |
| parent | c966d017478bae036d8df0de87e116832752794b (diff) | |
add amp4e events command.
| -rw-r--r-- | lib/ats.rb | 1 | ||||
| -rw-r--r-- | lib/ats/amp4e/api.rb | 4 | ||||
| -rw-r--r-- | lib/ats/amp4e/events.rb | 15 | ||||
| -rw-r--r-- | lib/ats/cli.rb | 1 | ||||
| -rw-r--r-- | lib/ats/cli/amp4e/application.rb | 3 | ||||
| -rw-r--r-- | lib/ats/cli/amp4e/events.rb | 14 |
6 files changed, 38 insertions, 0 deletions
@@ -10,6 +10,7 @@ require 'ats/version' require 'ats/amp4e/api' require 'ats/amp4e/computers' +require 'ats/amp4e/events' require 'ats/threat_grid/api' require 'ats/threat_grid/organizations' require 'ats/threat_grid/samples' diff --git a/lib/ats/amp4e/api.rb b/lib/ats/amp4e/api.rb index 202df1a..f1ad63e 100644 --- a/lib/ats/amp4e/api.rb +++ b/lib/ats/amp4e/api.rb @@ -23,6 +23,10 @@ module ATS ATS::AMP4E::Computers.new(self) end + def events + ATS::AMP4E::Events.new(self) + end + def get(url, params: {}, version: 1) http.get(build_uri(url, version: version), headers: headers, body: params) do |request, response| JSON.parse(response.body, symbolize_names: true) diff --git a/lib/ats/amp4e/events.rb b/lib/ats/amp4e/events.rb new file mode 100644 index 0000000..4e06e21 --- /dev/null +++ b/lib/ats/amp4e/events.rb @@ -0,0 +1,15 @@ +module ATS + module AMP4E + class Events + attr_reader :api + + def initialize(api) + @api = api + end + + def list + api.get("events") + end + end + end +end diff --git a/lib/ats/cli.rb b/lib/ats/cli.rb index 682bc50..3abf11c 100644 --- a/lib/ats/cli.rb +++ b/lib/ats/cli.rb @@ -4,6 +4,7 @@ require 'thor' require 'ats/cli/threat_grid' require 'ats/cli/amp4e/command' require 'ats/cli/amp4e/computers' +require 'ats/cli/amp4e/events' require 'ats/cli/amp4e/application' module ATS diff --git a/lib/ats/cli/amp4e/application.rb b/lib/ats/cli/amp4e/application.rb index 34e5693..e1ed61a 100644 --- a/lib/ats/cli/amp4e/application.rb +++ b/lib/ats/cli/amp4e/application.rb @@ -6,6 +6,9 @@ module ATS desc 'computers SUBCOMMAND ...ARGS', 'interact with the Threat Grid API' subcommand :computers, ATS::CLI::AMP4E::Computers + + desc 'events SUBCOMMAND ...ARGS', 'interact with the Threat Grid API' + subcommand :events, ATS::CLI::AMP4E::Events end end end diff --git a/lib/ats/cli/amp4e/events.rb b/lib/ats/cli/amp4e/events.rb new file mode 100644 index 0000000..aed9d85 --- /dev/null +++ b/lib/ats/cli/amp4e/events.rb @@ -0,0 +1,14 @@ +module ATS + module CLI + module AMP4E + class Events < Command + class_option :profile, default: :default, required: false + + desc 'list', 'list' + def list + print_json api.events.list + end + end + end + end +end |
