Class: WavefrontCli::DerivedMetric
- Includes:
- Mixin::Tag
- Defined in:
- lib/wavefront-cli/derivedmetric.rb
Overview
CLI coverage for the v2 ‘derivedmetric’ API.
Constant Summary
Constants included from Constants
Constants::ALL_PAGE_SIZE, Constants::DEFAULT_CONFIG, Constants::DEFAULT_OPTS, Constants::HUMAN_TIME_FORMAT, Constants::HUMAN_TIME_FORMAT_MS
Instance Attribute Summary
Attributes inherited from Base
#klass, #klass_word, #options, #wf
Instance Method Summary collapse
-
#build_body ⇒ Object
rubocop:disable Metrics/AbcSize.
- #do_create ⇒ Object
- #do_delete ⇒ Object
- #do_describe ⇒ Object
- #do_history ⇒ Object
-
#valid_tags? ⇒ Boolean
rubocop:enable Metrics/AbcSize.
- #validator_exception ⇒ Object
Methods included from Mixin::Tag
#do_tag_add, #do_tag_clear, #do_tag_delete, #do_tag_set, #do_tags
Methods inherited from Base
#_sdk_class, #cannot_noop!, #check_status, #conds_to_query, #dispatch, #display, #display_api_error, #display_no_api_response, #do_import, #do_list, #do_search, #do_undelete, #do_update, #extract_values, #failed_validation_message, #format_var, #handle_error, #handle_response, #hcl_fields, #import_to_create, #initialize, #load_display_class, #load_file, #load_from_stdin, #mk_creds, #mk_opts, #no_api_response, #ok_exit, #one_or_all, #options_and_exit, #parseable_output, #range_hash, #run, #search_key, #smart_delete, #smart_delete_message, #validate_id, #validate_input, #validate_opts, #validate_tags, #validator_method
Constructor Details
This class inherits a constructor from WavefrontCli::Base
Instance Method Details
#build_body ⇒ Object
rubocop:disable Metrics/AbcSize
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/wavefront-cli/derivedmetric.rb', line 32 def build_body ret = { query: [:'<query>'], name: [:'<name>'], minutes: [:range].to_i, includeObsoleteMetrics: [:obsolete], processRateMinutes: [:interval].to_i } ret[:additionalInformation] = [:desc] if [:desc] ret[:tags] = [:ctag] if ret end |
#do_create ⇒ Object
27 28 29 |
# File 'lib/wavefront-cli/derivedmetric.rb', line 27 def do_create wf.create(build_body) end |
#do_delete ⇒ Object
19 20 21 |
# File 'lib/wavefront-cli/derivedmetric.rb', line 19 def do_delete smart_delete('derived metric') end |
#do_describe ⇒ Object
15 16 17 |
# File 'lib/wavefront-cli/derivedmetric.rb', line 15 def do_describe wf.describe([:'<id>'], [:version]) end |
#do_history ⇒ Object
23 24 25 |
# File 'lib/wavefront-cli/derivedmetric.rb', line 23 def do_history wf.history([:'<id>']) end |
#valid_tags? ⇒ Boolean
rubocop:enable Metrics/AbcSize
45 46 47 |
# File 'lib/wavefront-cli/derivedmetric.rb', line 45 def ![:ctag].empty? && ([:ctag]) end |
#validator_exception ⇒ Object
11 12 13 |
# File 'lib/wavefront-cli/derivedmetric.rb', line 11 def validator_exception Wavefront::Exception::InvalidDerivedMetricId end |