Class: WavefrontCli::Settings

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

Overview

CLI coverage for the v2 ‘settings’ 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

Methods inherited from Base

#_sdk_class, #cannot_noop!, #check_status, #conds_to_query, #dispatch, #display, #display_api_error, #display_no_api_response, #do_delete, #do_describe, #do_import, #do_list, #do_search, #do_undelete, #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_exception, #validator_method

Constructor Details

This class inherits a constructor from WavefrontCli::Base

Instance Method Details

#do_default_usergroupsObject



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

def do_default_usergroups
  wf.default_user_groups
end

#do_list_permissionsObject



8
9
10
# File 'lib/wavefront-cli/settings.rb', line 8

def do_list_permissions
  wf.permissions
end

#do_show_preferencesObject



12
13
14
# File 'lib/wavefront-cli/settings.rb', line 12

def do_show_preferences
  wf.preferences
end

#do_updateObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/wavefront-cli/settings.rb', line 20

def do_update
  body = options[:'<key=value>'].each_with_object({}) do |o, a|
    k, v = o.split('=', 2)
    next unless v && !v.empty?

    if %w[invitePermissions defaultUserGroups].include?(k)
      v = v.include?(',') ? v.split(',') : [v]
    end

    a[k] = v
  end

  pp body

  wf.update_preferences(body)
end