Class: WavefrontCli::DerivedMetric
- 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
rubocop:disable Metrics/AbcSize.
- #do_describe ⇒ Object
-
#do_history ⇒ Object
rubocop:enable Metrics/AbcSize.
-
#valid_tags? ⇒ Boolean
rubocop:enable Metrics/AbcSize.
- #validator_exception ⇒ Object
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_tag_add, #do_tag_clear, #do_tag_delete, #do_tag_set, #do_tags, #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, #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
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/wavefront-cli/derivedmetric.rb', line 42 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
37 38 39 |
# File 'lib/wavefront-cli/derivedmetric.rb', line 37 def do_create wf.create(build_body) end |
#do_delete ⇒ Object
rubocop:disable Metrics/AbcSize
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/wavefront-cli/derivedmetric.rb', line 17 def do_delete cannot_noop! word = if wf.describe([:'<id>']).status.code == 200 'Soft' else 'Permanently' end puts format('%s deleting derived metric definition %s', word, [:'<id>']) wf.delete([:'<id>']) end |
#do_describe ⇒ Object
12 13 14 |
# File 'lib/wavefront-cli/derivedmetric.rb', line 12 def do_describe wf.describe([:'<id>'], [:version]) end |
#do_history ⇒ Object
rubocop:enable Metrics/AbcSize
33 34 35 |
# File 'lib/wavefront-cli/derivedmetric.rb', line 33 def do_history wf.history([:'<id>']) end |
#valid_tags? ⇒ Boolean
rubocop:enable Metrics/AbcSize
55 56 57 |
# File 'lib/wavefront-cli/derivedmetric.rb', line 55 def ![:ctag].empty? && ([:ctag]) end |
#validator_exception ⇒ Object
8 9 10 |
# File 'lib/wavefront-cli/derivedmetric.rb', line 8 def validator_exception Wavefront::Exception::InvalidDerivedMetricId end |