Class: JDCAdmin::ServiceAuthToken
Instance Method Summary
collapse
Methods inherited from JDC::CLI
#add_exception_name_to_msg, #build_client, #check_key, #check_logged_in, #check_organization_and_space, #check_target, client, #client, client=, #client_target, #color_enabled?, #debug?, #default_action, #ensure_config_dir, #err, #execute, #fail, #fail_unknown, #force?, #formatted_exception_output, #help, #help_header, #invalidate_client, #log_error, #name_list, #normalize_targets_info, #one_of, #quiet?, #remove_target_info, #sane_target_url, #save_target_info, #save_targets, #save_token_if_it_changes, #set_target, #table, #target_info, #targets_info, #user_colors, #verbose?, #wrap_errors
#indented, #justify, #line, #lines, #quiet?, #spaced, #start_line, #tabular, #text_width, #trim_escapes
#ask, #handler, #input_state, #list_choices, #prompt, #show_default
Instance Method Details
#create_service_auth_token ⇒ Object
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/admin/service_auth_token.rb', line 41
def create_service_auth_token
sat = client.service_auth_token
sat.label = input[:label]
sat.provider = input[:provider]
sat.token = input[:token]
with_progress("Creating service auth token") do
sat.create!
end
end
|
#delete_service_auth_token ⇒ Object
86
87
88
89
90
91
92
|
# File 'lib/admin/service_auth_token.rb', line 86
def delete_service_auth_token
sat = input[:service_auth_token]
with_progress("Deleting token #{c(sat.label, :name)}") do
sat.delete!
end
end
|
#precondition ⇒ Object
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/admin/service_auth_token.rb', line 5
def precondition
unless File.exists? target_file
fail "Please select a target with 'jdc target'."
end
end
|
#service_auth_tokens ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/admin/service_auth_token.rb', line 19
def service_auth_tokens
spaced(client.service_auth_tokens) do |t|
line "#{c(t.label, :name)}:"
indented do
line "guid: #{t.guid}"
line "provider: #{t.provider}"
end
end
end
|
#update_service_auth_token ⇒ Object
66
67
68
69
70
71
72
73
|
# File 'lib/admin/service_auth_token.rb', line 66
def update_service_auth_token
sat = input[:service_auth_token]
sat.token = input[:token]
with_progress("Updating token #{c(sat.label, :name)}") do
sat.update!
end
end
|