9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/uffizzi/cli/disconnect.rb', line 9
def run(credential_type)
connection_type = case credential_type
when 'docker-hub'
Uffizzi.configuration.credential_types[:dockerhub]
when 'docker-registry'
Uffizzi.configuration.credential_types[:docker_registry]
when 'acr'
Uffizzi.configuration.credential_types[:azure]
when 'ecr'
Uffizzi.configuration.credential_types[:amazon]
when 'gcr'
Uffizzi.configuration.credential_types[:google]
when 'ghcr'
Uffizzi.configuration.credential_types[:github_registry]
else
raise Uffizzi::Error.new('Unsupported credential type.')
end
response = delete_credential(ConfigFile.read_option(:server), ConfigFile.read_option(:account, :id), connection_type)
if ResponseHelper.no_content?(response)
Uffizzi.ui.say("Successfully disconnected from #{connection_name(credential_type)}.")
else
ResponseHelper.handle_failed_response(response)
end
end
|