Class: Chef::Knife::UserKeyDelete
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::UserKeyDelete
- Defined in:
- lib/chef/knife/user_key_delete.rb
Overview
Implements knife user key delete using Chef::Knife::KeyDelete as a service class.
Constant Summary
Constants inherited from Chef::Knife
CHEF_ORGANIZATION_MANAGEMENT, KNIFE_ROOT, OFFICIAL_PLUGINS, OPSCODE_HOSTED_CHEF_ACCESS_CONTROL, VERSION
Instance Attribute Summary collapse
-
#actor ⇒ String
readonly
the name of the client that this key is for.
Attributes inherited from Chef::Knife
Instance Method Summary collapse
- #actor_field_name ⇒ Object
- #actor_missing_error ⇒ Object
- #apply_params!(params) ⇒ Object
-
#initialize(argv = []) ⇒ UserKeyDelete
constructor
A new instance of UserKeyDelete.
- #keyname_missing_error ⇒ Object
- #run ⇒ Object
- #service_object ⇒ Object
Methods inherited from Chef::Knife
#api_key, #apply_computed_config, category, chef_config_dir, common_name, #config_file_defaults, #config_file_settings, config_loader, #config_source, #configure_chef, #create_object, #delete_object, dependency_loaders, deps, #format_rest_error, guess_category, #humanize_exception, #humanize_http_exception, inherited, list_commands, load_commands, load_config, load_deps, #maybe_setup_fips, #merge_configs, msg, #noauth_rest, #parse_options, reset_config_loader!, reset_subcommands!, #rest, #root_rest, run, #run_with_pretty_exceptions, #server_url, #show_usage, snake_case_name, subcommand_category, subcommand_class_from, subcommand_files, subcommand_loader, subcommands, subcommands_by_category, #test_mandatory_field, ui, unnamed?, use_separate_defaults?, #username
Constructor Details
#initialize(argv = []) ⇒ UserKeyDelete
Returns a new instance of UserKeyDelete.
38 39 40 41 |
# File 'lib/chef/knife/user_key_delete.rb', line 38 def initialize(argv = []) super(argv) @service_object = nil end |
Instance Attribute Details
#actor ⇒ String (readonly)
the name of the client that this key is for
29 30 31 |
# File 'lib/chef/knife/user_key_delete.rb', line 29 def actor @actor end |
Instance Method Details
#actor_field_name ⇒ Object
48 49 50 |
# File 'lib/chef/knife/user_key_delete.rb', line 48 def actor_field_name "user" end |
#actor_missing_error ⇒ Object
52 53 54 |
# File 'lib/chef/knife/user_key_delete.rb', line 52 def actor_missing_error "You must specify a user name" end |
#apply_params!(params) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/chef/knife/user_key_delete.rb', line 64 def apply_params!(params) @actor = params[0] if @actor.nil? show_usage ui.fatal(actor_missing_error) exit 1 end @name = params[1] if @name.nil? show_usage ui.fatal(keyname_missing_error) exit 1 end end |
#keyname_missing_error ⇒ Object
56 57 58 |
# File 'lib/chef/knife/user_key_delete.rb', line 56 def keyname_missing_error "You must specify a key name" end |
#run ⇒ Object
43 44 45 46 |
# File 'lib/chef/knife/user_key_delete.rb', line 43 def run apply_params!(@name_args) service_object.run end |