Class: WavefrontCli::IngestionPolicy

Inherits:
Base
  • Object
show all
Includes:
Wavefront::Mixins
Defined in:
lib/wavefront-cli/ingestionpolicy.rb

Overview

CLI coverage for the ingestion policy part of the v2 ‘usage’ 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, #dispatch, #display, #display_api_error, #display_class, #display_no_api_response, #do_delete, #do_describe, #do_dump, #do_import, #do_list, #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, #no_api_response, #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_method, #warning_message

Constructor Details

This class inherits a constructor from WavefrontCli::Base

Instance Method Details

#do_add_userObject



17
18
19
# File 'lib/wavefront-cli/ingestionpolicy.rb', line 17

def do_add_user
  .add_ingestion_policy(options[:'<id>'], options[:'<user>'])
end

#do_createObject



13
14
15
# File 'lib/wavefront-cli/ingestionpolicy.rb', line 13

def do_create
  wf.create(create_body)
end

#do_forObject



33
34
35
36
37
38
39
# File 'lib/wavefront-cli/ingestionpolicy.rb', line 33

def do_for
  resp = do_list
  parent_policies = parent_policies(options[:'<user>'][0],
                                    resp.response.items)
  resp.response = parent_policies.map { |p| p[:id] }
  resp
end

#do_membersObject



26
27
28
29
30
31
# File 'lib/wavefront-cli/ingestionpolicy.rb', line 26

def do_members
  resp = do_describe
  resp.response = resp.response[:sampledUserAccounts] +
                  resp.response[:sampledServiceAccounts]
  resp
end

#do_remove_userObject



21
22
23
24
# File 'lib/wavefront-cli/ingestionpolicy.rb', line 21

def do_remove_user
  .remove_ingestion_policy(options[:'<id>'],
                                       options[:'<user>'])
end