Class: WavefrontCli::Message

Inherits:
Base
  • Object
show all
Defined in:
lib/wavefront-cli/message.rb

Overview

CLI coverage for the v2 ‘message’ API.

Constant Summary

Constants included from Constants

Constants::ALL_PAGE_SIZE, Constants::DEFAULT_CONFIG, Constants::DEFAULT_OPTS, Constants::EVENT_STATE_DIR, Constants::HUMAN_TIME_FORMAT, Constants::HUMAN_TIME_FORMAT_MS, Constants::SEARCH_SPLIT

Instance Attribute Summary

Attributes inherited from Base

#klass, #klass_word, #options, #wf

Instance Method Summary collapse

Methods inherited from Base

#_sdk_class, #cannot_noop!, #check_response_blocks, #check_status, #cli_output_class, #conds_to_query, #descriptive_name, #dispatch, #display, #display_api_error, #display_class, #display_no_api_response, #do_delete, #do_describe, #do_dump, #do_import, #do_search, #do_set, #do_undelete, #dump_json, #dump_yaml, #extract_values, #failed_validation_message, #format_var, #handle_error, #handle_response, #hcl_fields, #import_to_create, #initialize, #item_dump_call, #load_display_class, #matching_method, #method_word_list, #mk_creds, #mk_opts, #name_of_do_method, #ok_exit, #one_or_all, #options_and_exit, #parseable_output, #range_hash, #require_sdk_class, #run, #search_key, #smart_delete, #smart_delete_message, #status_error_handler, #unsupported_format_message, #validate_id, #validate_input, #validate_opts, #validate_tags, #validator_exception, #validator_method, #warning_message

Constructor Details

This class inherits a constructor from WavefrontCli::Base

Instance Method Details

#do_listObject

There’s an extra flag to “list” that no other commands have.



16
17
18
# File 'lib/wavefront-cli/message.rb', line 16

def do_list
  wf.list(options[:offset] || 0, options[:limit] || 100, !options[:all])
end

#do_markObject



31
32
33
# File 'lib/wavefront-cli/message.rb', line 31

def do_mark
  wf.read(options[:'<id>'])
end

#do_readObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/wavefront-cli/message.rb', line 20

def do_read
  cannot_noop!

  resp = wf.list(0, :all, false).response.items.select do |msg|
    msg[:id] == options[:'<id>']
  end

  do_mark
  resp.first
end

#no_api_responseObject



10
11
12
# File 'lib/wavefront-cli/message.rb', line 10

def no_api_response
  %w[do_read]
end