Class: Uffizzi::Cli::Connect
- Inherits:
-
Thor
- Object
- Thor
- Uffizzi::Cli::Connect
show all
- Includes:
- ApiClient
- Defined in:
- lib/uffizzi/cli/connect.rb
Instance Method Summary
collapse
Methods included from ApiClient
#bulk_create_secrets, #check_can_install, #check_credential, #create_access_token, #create_account_controller_settings, #create_ci_session, #create_cluster, #create_credential, #create_deployment, #create_project, #create_session, #delete_account_controller_settings, #delete_cluster, #delete_credential, #delete_deployment, #delete_project, #delete_secret, #deploy_containers, #describe_compose_file, #describe_deployment, #destroy_session, #fetch_account, #fetch_account_projects, #fetch_accounts, #fetch_credentials, #fetch_deployment_service_logs, #fetch_deployment_services, #fetch_deployments, #fetch_events, #fetch_project, #fetch_projects, #fetch_secrets, #get_access_token, #get_account_clusters, #get_account_controller_settings, #get_activity_items, #get_cluster, #get_cluster_ingresses, #get_k8s_container_description, #get_project_clusters, #scale_down_cluster, #scale_up_cluster, #set_compose_file, #sync_cluster, #unset_compose_file, #update_account, #update_account_controller_settings, #update_credential, #update_deployment, #validate_compose_file
Methods included from ApiRoutes
#access_token_url, #access_tokens_url, #account_can_install_uri, #account_clusters_uri, #account_controller_setting_uri, #account_controller_settings_uri, #account_projects_uri, #account_uri, #accounts_uri, #activity_items_uri, #browser_sign_in_url, #check_credential_uri, #ci_session_uri, #cluster_uri, #compose_file_uri, #create_projects_uri, #credential_uri, #credentials_uri, #deploy_containers_uri, #deployment_uri, #deployments_uri, #events_uri, #k8s_container_description_uri, #preview_service_logs_uri, #preview_services_uri, #project_cluster_ingresses_uri, #project_clusters_uri, #project_uri, #projects_uri, #scale_down_cluster_uri, #scale_up_cluster_uri, #secret_uri, #secrets_uri, #session_uri, #sync_cluster_uri, #validate_compose_file_uri
Instance Method Details
#acr ⇒ Object
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# File 'lib/uffizzi/cli/connect.rb', line 93
def acr
type = Uffizzi.configuration.credential_types[:azure]
credential_exists = credential_exists?(type)
handle_existing_credential_options('acr') if credential_exists
registry_url, username, password = Uffizzi::ConnectHelper.get_acr_data(options)
params = {
username: username,
password: password,
registry_url: prepare_registry_url(registry_url),
type: type,
token: ConfigFile.read_option(:oidc_token),
}
server = ConfigFile.read_option(:server)
account_id = ConfigFile.read_option(:account, :id)
response = if credential_exists
update_credential(server, account_id, params, type)
else
create_credential(server, account_id, params)
end
handle_result_for('ACR', response)
end
|
#docker_hub ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/uffizzi/cli/connect.rb', line 28
def docker_hub
type = Uffizzi.configuration.credential_types[:dockerhub]
credential_exists = credential_exists?(type)
handle_existing_credential_options('docker-hub') if credential_exists
username, password = Uffizzi::ConnectHelper.get_docker_hub_data(options)
params = {
username: username,
password: password,
type: type,
token: ConfigFile.read_option(:oidc_token),
}
server = ConfigFile.read_option(:server)
account_id = ConfigFile.read_option(:account, :id)
response = if credential_exists
update_credential(server, account_id, params, type)
else
create_credential(server, account_id, params)
end
handle_result_for('Docker Hub', response)
end
|
#docker_registry ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/uffizzi/cli/connect.rb', line 60
def docker_registry
type = Uffizzi.configuration.credential_types[:docker_registry]
credential_exists = credential_exists?(type)
handle_existing_credential_options('docker-registry') if credential_exists
registry_url, username, password = Uffizzi::ConnectHelper.get_docker_registry_data(options)
params = {
registry_url: prepare_registry_url(registry_url),
username: username,
password: password,
type: type,
token: ConfigFile.read_option(:oidc_token),
}
server = ConfigFile.read_option(:server)
account_id = ConfigFile.read_option(:account, :id)
response = if credential_exists
update_credential(server, account_id, params, type)
else
create_credential(server, account_id, params)
end
handle_result_for('Docker Registry', response)
end
|
#ecr ⇒ Object
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
# File 'lib/uffizzi/cli/connect.rb', line 126
def ecr
type = Uffizzi.configuration.credential_types[:amazon]
credential_exists = credential_exists?(type)
handle_existing_credential_options('ecr') if credential_exists
registry_url, access_key_id, secret_access_key = Uffizzi::ConnectHelper.get_ecr_data(options)
params = {
username: access_key_id,
password: secret_access_key,
registry_url: prepare_registry_url(registry_url),
type: type,
token: ConfigFile.read_option(:oidc_token),
}
server = ConfigFile.read_option(:server)
account_id = ConfigFile.read_option(:account, :id)
response = if credential_exists
update_credential(server, account_id, params, type)
else
create_credential(server, account_id, params)
end
handle_result_for('ECR', response)
end
|
#gcr(credential_file_path = nil) ⇒ Object
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
# File 'lib/uffizzi/cli/connect.rb', line 156
def gcr(credential_file_path = nil)
type = Uffizzi.configuration.credential_types[:google]
credential_exists = credential_exists?(type)
handle_existing_credential_options('gcr') if credential_exists
credential_content = google_service_account_content(credential_file_path)
params = {
password: credential_content,
type: type,
token: ConfigFile.read_option(:oidc_token),
}
server = ConfigFile.read_option(:server)
account_id = ConfigFile.read_option(:account, :id)
response = if credential_exists
update_credential(server, account_id, params, type)
else
create_credential(server, account_id, params)
end
handle_result_for('GCR', response)
end
|
#ghcr ⇒ Object
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
# File 'lib/uffizzi/cli/connect.rb', line 186
def ghcr
type = Uffizzi.configuration.credential_types[:github_registry]
credential_exists = credential_exists?(type)
handle_existing_credential_options('ghcr') if credential_exists
username, password = Uffizzi::ConnectHelper.get_ghcr_data(options)
params = {
username: username,
password: password,
type: type,
token: ConfigFile.read_option(:oidc_token),
}
server = ConfigFile.read_option(:server)
account_id = ConfigFile.read_option(:account, :id)
response = if credential_exists
update_credential(server, account_id, params, type)
else
create_credential(server, account_id, params)
end
handle_result_for('GHCR', response)
end
|
#list_credentials ⇒ Object