1# -------------------------------------------------------------------------------------------- 2# Copyright (c) Microsoft Corporation. All rights reserved. 3# Licensed under the MIT License. See License.txt in the project root for license information. 4# -------------------------------------------------------------------------------------------- 5 6from azure.cli.core.commands import CliCommandType 7 8from ._format import ( 9 registry_output_format, 10 usage_output_format, 11 policy_output_format, 12 credential_output_format, 13 webhook_output_format, 14 webhook_get_config_output_format, 15 webhook_list_events_output_format, 16 webhook_ping_output_format, 17 replication_output_format, 18 build_output_format, 19 task_output_format, 20 run_output_format, 21 helm_list_output_format, 22 helm_show_output_format 23) 24from ._client_factory import ( 25 cf_acr_registries, 26 cf_acr_replications, 27 cf_acr_webhooks, 28 cf_acr_tasks, 29 cf_acr_runs 30) 31 32 33def load_command_table(self, _): # pylint: disable=too-many-statements 34 35 acr_custom_util = CliCommandType( 36 operations_tmpl='azure.cli.command_modules.acr.custom#{}', 37 table_transformer=registry_output_format, 38 client_factory=cf_acr_registries 39 ) 40 41 acr_login_util = CliCommandType( 42 operations_tmpl='azure.cli.command_modules.acr.custom#{}' 43 ) 44 45 acr_import_util = CliCommandType( 46 operations_tmpl='azure.cli.command_modules.acr.import#{}', 47 client_factory=cf_acr_registries 48 ) 49 50 acr_policy_util = CliCommandType( 51 operations_tmpl='azure.cli.command_modules.acr.policy#{}', 52 table_transformer=policy_output_format, 53 client_factory=cf_acr_registries 54 ) 55 56 acr_cred_util = CliCommandType( 57 operations_tmpl='azure.cli.command_modules.acr.credential#{}', 58 table_transformer=credential_output_format, 59 client_factory=cf_acr_registries 60 ) 61 62 acr_repo_util = CliCommandType( 63 operations_tmpl='azure.cli.command_modules.acr.repository#{}' 64 ) 65 66 acr_webhook_util = CliCommandType( 67 operations_tmpl='azure.cli.command_modules.acr.webhook#{}', 68 table_transformer=webhook_output_format, 69 client_factory=cf_acr_webhooks 70 ) 71 72 acr_replication_util = CliCommandType( 73 operations_tmpl='azure.cli.command_modules.acr.replication#{}', 74 table_transformer=replication_output_format, 75 client_factory=cf_acr_replications 76 ) 77 78 acr_build_util = CliCommandType( 79 operations_tmpl='azure.cli.command_modules.acr.build#{}', 80 table_transformer=build_output_format, 81 client_factory=cf_acr_runs 82 ) 83 84 acr_run_util = CliCommandType( 85 operations_tmpl='azure.cli.command_modules.acr.run#{}', 86 table_transformer=run_output_format, 87 client_factory=cf_acr_runs 88 ) 89 90 acr_pack_util = CliCommandType( 91 operations_tmpl='azure.cli.command_modules.acr.pack#{}', 92 table_transformer=run_output_format, 93 client_factory=cf_acr_runs 94 ) 95 96 acr_task_util = CliCommandType( 97 operations_tmpl='azure.cli.command_modules.acr.task#{}', 98 table_transformer=task_output_format, 99 client_factory=cf_acr_tasks 100 ) 101 102 acr_helm_util = CliCommandType( 103 operations_tmpl='azure.cli.command_modules.acr.helm#{}' 104 ) 105 106 acr_network_rule_util = CliCommandType( 107 operations_tmpl='azure.cli.command_modules.acr.network_rule#{}', 108 client_factory=cf_acr_registries 109 ) 110 111 acr_check_health_util = CliCommandType( 112 operations_tmpl='azure.cli.command_modules.acr.check_health#{}' 113 ) 114 115 with self.command_group('acr', acr_custom_util) as g: 116 g.command('check-name', 'acr_check_name', table_transformer=None) 117 g.command('list', 'acr_list') 118 g.command('create', 'acr_create') 119 g.command('delete', 'acr_delete') 120 g.show_command('show', 'acr_show') 121 g.command('show-usage', 'acr_show_usage', table_transformer=usage_output_format) 122 g.generic_update_command('update', 123 getter_name='acr_update_get', 124 setter_name='acr_update_set', 125 custom_func_name='acr_update_custom', 126 custom_func_type=acr_custom_util, 127 client_factory=cf_acr_registries) 128 129 with self.command_group('acr', acr_login_util) as g: 130 g.command('login', 'acr_login') 131 132 with self.command_group('acr', acr_import_util) as g: 133 g.command('import', 'acr_import') 134 135 with self.command_group('acr credential', acr_cred_util) as g: 136 g.show_command('show', 'acr_credential_show') 137 g.command('renew', 'acr_credential_renew') 138 139 with self.command_group('acr repository', acr_repo_util) as g: 140 g.command('list', 'acr_repository_list') 141 g.command('show-tags', 'acr_repository_show_tags') 142 g.command('show-manifests', 'acr_repository_show_manifests') 143 g.command('show', 'acr_repository_show') 144 g.command('update', 'acr_repository_update') 145 g.command('delete', 'acr_repository_delete') 146 g.command('untag', 'acr_repository_untag') 147 148 with self.command_group('acr webhook', acr_webhook_util) as g: 149 g.command('list', 'acr_webhook_list') 150 g.command('create', 'acr_webhook_create') 151 g.command('delete', 'acr_webhook_delete') 152 g.show_command('show', 'acr_webhook_show') 153 g.command('get-config', 'acr_webhook_get_config', table_transformer=webhook_get_config_output_format) 154 g.command('list-events', 'acr_webhook_list_events', table_transformer=webhook_list_events_output_format) 155 g.command('ping', 'acr_webhook_ping', table_transformer=webhook_ping_output_format) 156 g.generic_update_command('update', 157 getter_name='acr_webhook_update_get', 158 setter_name='acr_webhook_update_set', 159 custom_func_name='acr_webhook_update_custom', 160 custom_func_type=acr_webhook_util, 161 client_factory=cf_acr_webhooks) 162 163 with self.command_group('acr replication', acr_replication_util) as g: 164 g.command('list', 'acr_replication_list') 165 g.command('create', 'acr_replication_create') 166 g.command('delete', 'acr_replication_delete') 167 g.show_command('show', 'acr_replication_show') 168 g.generic_update_command('update', 169 getter_name='acr_replication_update_get', 170 setter_name='acr_replication_update_set', 171 custom_func_name='acr_replication_update_custom', 172 custom_func_type=acr_replication_util, 173 client_factory=cf_acr_replications) 174 175 with self.command_group('acr', acr_build_util) as g: 176 g.command('build', 'acr_build', supports_no_wait=True) 177 178 with self.command_group('acr', acr_run_util) as g: 179 g.command('run', 'acr_run', supports_no_wait=True) 180 181 with self.command_group('acr pack', acr_pack_util, is_preview=True) as g: 182 g.command('build', 'acr_pack_build', supports_no_wait=True) 183 184 with self.command_group('acr task', acr_task_util) as g: 185 g.command('create', 'acr_task_create') 186 g.show_command('show', 'acr_task_show') 187 g.command('list', 'acr_task_list') 188 g.command('delete', 'acr_task_delete') 189 g.command('update', 'acr_task_update') 190 g.command('identity assign', 'acr_task_identity_assign') 191 g.command('identity remove', 'acr_task_identity_remove') 192 g.command('identity show', 'acr_task_identity_show') 193 g.command('credential add', 'acr_task_credential_add') 194 g.command('credential update', 'acr_task_credential_update') 195 g.command('credential remove', 'acr_task_credential_remove') 196 g.command('credential list', 'acr_task_credential_list') 197 g.command('run', 'acr_task_run', client_factory=cf_acr_runs, 198 table_transformer=run_output_format, supports_no_wait=True) 199 g.command('list-runs', 'acr_task_list_runs', client_factory=cf_acr_runs, 200 table_transformer=run_output_format) 201 g.command('show-run', 'acr_task_show_run', client_factory=cf_acr_runs, 202 table_transformer=run_output_format) 203 g.command('cancel-run', 'acr_task_cancel_run', client_factory=cf_acr_runs, 204 table_transformer=None) 205 g.command('update-run', 'acr_task_update_run', client_factory=cf_acr_runs, 206 table_transformer=run_output_format) 207 g.command('logs', 'acr_task_logs', client_factory=cf_acr_runs, 208 table_transformer=None) 209 210 with self.command_group('acr config content-trust', acr_policy_util) as g: 211 g.command('show', 'acr_config_content_trust_show') 212 g.command('update', 'acr_config_content_trust_update') 213 214 with self.command_group('acr helm', acr_helm_util) as g: 215 g.command('list', 'acr_helm_list', table_transformer=helm_list_output_format) 216 g.command('show', 'acr_helm_show', table_transformer=helm_show_output_format) 217 g.command('delete', 'acr_helm_delete') 218 g.command('push', 'acr_helm_push') 219 g.command('repo add', 'acr_helm_repo_add') 220 221 with self.command_group('acr network-rule', acr_network_rule_util) as g: 222 g.command('list', 'acr_network_rule_list') 223 g.command('add', 'acr_network_rule_add') 224 g.command('remove', 'acr_network_rule_remove') 225 226 with self.command_group('acr', acr_check_health_util) as g: 227 g.command('check-health', 'acr_check_health') 228