Class: Kontena::Plugin::Cloud::Token::RemoveCommand
- Inherits:
-
Command
- Object
- Clamp::Command
- Command
- Kontena::Plugin::Cloud::Token::RemoveCommand
show all
- Includes:
- Cli::Common, Cli::TableGenerator::Helper
- Defined in:
- lib/kontena/plugin/cloud/token/remove_command.rb
Constant Summary
CloudCommand::PLATFORM_NOT_SELECTED_ERROR
Instance Method Summary
collapse
#verify_current_grid, #verify_current_master, #verify_current_master_token
Instance Method Details
#default_id ⇒ Object
25
26
27
|
# File 'lib/kontena/plugin/cloud/token/remove_command.rb', line 25
def default_id
prompt_token
end
|
#execute ⇒ Object
9
10
11
12
13
|
# File 'lib/kontena/plugin/cloud/token/remove_command.rb', line 9
def execute
id = self.id
confirm unless forced?
cloud_client.delete("/user/personal_access_tokens/#{id}")
end
|
#prompt_token ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'lib/kontena/plugin/cloud/token/remove_command.rb', line 16
def prompt_token
tokens = cloud_client.get('/user/personal_access_tokens')['data']
prompt.select("Choose token:") do ||
tokens.each do |d|
.choice d.dig('attributes', 'name'), d['id']
end
end
end
|