def load_command_table(self, _): # region Command Types mgmt_vaults_entity = get_client(self.cli_ctx, ResourceType.MGMT_KEYVAULT, Clients.vaults) mgmt_pec_entity = get_client(self.cli_ctx, ResourceType.MGMT_KEYVAULT, Clients.private_endpoint_connections) mgmt_plr_entity = get_client(self.cli_ctx, ResourceType.MGMT_KEYVAULT, Clients.private_link_resources) data_entity = get_client(self.cli_ctx, ResourceType.DATA_KEYVAULT) data_key_entity = get_client(self.cli_ctx, ResourceType.DATA_KEYVAULT_KEYS) if not is_azure_stack_profile(self): mgmt_hsms_entity = get_client(self.cli_ctx, ResourceType.MGMT_KEYVAULT, Clients.managed_hsms) private_data_entity = get_client(self.cli_ctx, ResourceType.DATA_PRIVATE_KEYVAULT) data_backup_entity = get_client( self.cli_ctx, ResourceType.DATA_KEYVAULT_ADMINISTRATION_BACKUP) data_access_control_entity = get_client( self.cli_ctx, ResourceType.DATA_KEYVAULT_ADMINISTRATION_ACCESS_CONTROL) else: mgmt_hsms_entity = private_data_entity = data_backup_entity = data_access_control_entity = None kv_vaults_custom = CliCommandType( operations_tmpl='azure.cli.command_modules.keyvault.custom#{}', client_factory=get_client_factory(ResourceType.MGMT_KEYVAULT, Clients.vaults)) if not is_azure_stack_profile(self): kv_hsms_custom = CliCommandType( operations_tmpl='azure.cli.command_modules.keyvault.custom#{}', client_factory=get_client_factory(ResourceType.MGMT_KEYVAULT, Clients.managed_hsms)) else: kv_hsms_custom = None # endregion # Management Plane Commands with self.command_group( 'keyvault', mgmt_vaults_entity.command_type, client_factory=mgmt_vaults_entity.client_factory) as g: g.custom_command( 'create', 'create_vault_or_hsm', supports_no_wait=True, doc_string_source=mgmt_vaults_entity.models_docs_tmpl.format( 'VaultProperties')) g.custom_command('recover', 'recover_vault_or_hsm', supports_no_wait=True) g.custom_command('list', 'list_vault_or_hsm') g.custom_show_command( 'show', 'get_vault_or_hsm', doc_string_source=mgmt_vaults_entity.operations_docs_tmpl.format( 'get')) g.custom_command( 'delete', 'delete_vault_or_hsm', supports_no_wait=True, doc_string_source=mgmt_vaults_entity.operations_docs_tmpl.format( 'delete')) g.custom_command( 'purge', 'purge_vault_or_hsm', supports_no_wait=True, doc_string_source=mgmt_vaults_entity.operations_docs_tmpl.format( 'begin_purge_deleted')) g.custom_command('set-policy', 'set_policy', supports_no_wait=True) g.custom_command('delete-policy', 'delete_policy', supports_no_wait=True) g.custom_command( 'list-deleted', 'list_deleted_vault_or_hsm', doc_string_source=mgmt_vaults_entity.operations_docs_tmpl.format( 'list_deleted')) g.custom_command('show-deleted', 'get_deleted_vault_or_hsm') g.generic_update_command( 'update', setter_name='update_vault_setter', setter_type=kv_vaults_custom, custom_func_name='update_vault', doc_string_source=mgmt_vaults_entity.models_docs_tmpl.format( 'VaultProperties'), supports_no_wait=True) g.wait_command('wait') if not is_azure_stack_profile(self): with self.command_group( 'keyvault', mgmt_hsms_entity.command_type, client_factory=mgmt_hsms_entity.client_factory) as g: g.generic_update_command( 'update-hsm', setter_name='update_hsm_setter', setter_type=kv_hsms_custom, custom_func_name='update_hsm', supports_no_wait=True, doc_string_source=mgmt_hsms_entity.models_docs_tmpl.format( 'ManagedHsmProperties')) g.custom_wait_command('wait-hsm', 'wait_hsm') with self.command_group( 'keyvault network-rule', mgmt_vaults_entity.command_type, min_api='2018-02-14', client_factory=mgmt_vaults_entity.client_factory) as g: g.custom_command('add', 'add_network_rule', supports_no_wait=True) g.custom_command('remove', 'remove_network_rule', supports_no_wait=True) g.custom_command('list', 'list_network_rules') g.wait_command('wait') with self.command_group( 'keyvault private-endpoint-connection', mgmt_pec_entity.command_type, min_api='2018-02-14', client_factory=mgmt_pec_entity.client_factory) as g: g.custom_command('approve', 'approve_private_endpoint_connection', supports_no_wait=True, validator=validate_private_endpoint_connection_id) g.custom_command('reject', 'reject_private_endpoint_connection', supports_no_wait=True, validator=validate_private_endpoint_connection_id) g.custom_command('delete', 'delete_private_endpoint_connection', validator=validate_private_endpoint_connection_id, supports_no_wait=True) g.custom_command('list', 'list_private_endpoint_connection') g.custom_show_command( 'show', 'show_private_endpoint_connection', validator=validate_private_endpoint_connection_id) g.custom_wait_command( 'wait', 'show_private_endpoint_connection', validator=validate_private_endpoint_connection_id) with self.command_group( 'keyvault private-link-resource', mgmt_plr_entity.command_type, min_api='2018-02-14', client_factory=mgmt_plr_entity.client_factory) as g: from azure.cli.core.commands.transform import gen_dict_to_list_transform g.custom_command('list', 'list_private_link_resource', transform=gen_dict_to_list_transform(key='value')) # Data Plane Commands if not is_azure_stack_profile(self): with self.command_group('keyvault backup', data_backup_entity.command_type) as g: g.keyvault_custom('start', 'full_backup', doc_string_source=data_backup_entity. operations_docs_tmpl.format('begin_backup')) with self.command_group('keyvault restore', data_backup_entity.command_type) as g: g.keyvault_custom('start', 'full_restore', doc_string_source=data_backup_entity. operations_docs_tmpl.format('begin_restore')) with self.command_group('keyvault security-domain', private_data_entity.command_type) as g: g.keyvault_custom('init-recovery', 'security_domain_init_recovery') g.keyvault_custom('upload', 'security_domain_upload', supports_no_wait=True) g.keyvault_custom('download', 'security_domain_download', supports_no_wait=True) g.keyvault_custom('wait', '_wait_security_domain_operation') with self.command_group('keyvault key', data_entity.command_type) as g: g.keyvault_command('list', 'get_keys', transform=multi_transformers( filter_out_managed_resources, keep_max_results, extract_subresource_name(id_parameter='kid'))) g.keyvault_command('list-versions', 'get_key_versions', transform=multi_transformers( keep_max_results, extract_subresource_name(id_parameter='kid'))) g.keyvault_command('list-deleted', 'get_deleted_keys', transform=multi_transformers( keep_max_results, extract_subresource_name(id_parameter='kid'))) g.keyvault_command('show-deleted', 'get_deleted_key') g.keyvault_command('delete', 'delete_key') g.keyvault_command('purge', 'purge_deleted_key') g.keyvault_command('recover', 'recover_deleted_key') g.keyvault_custom( 'backup', 'backup_key', doc_string_source=data_entity.operations_docs_tmpl.format( 'backup_key')) g.keyvault_custom( 'restore', 'restore_key', supports_no_wait=True, doc_string_source=data_entity.operations_docs_tmpl.format( 'restore_key')) g.keyvault_custom('download', 'download_key') with self.command_group('keyvault key', data_key_entity.command_type) as g: g.keyvault_custom( 'create', 'create_key', transform=transform_key_output, doc_string_source=data_entity.operations_docs_tmpl.format( 'create_key')) g.keyvault_command('set-attributes', 'update_key_properties', transform=transform_key_output) g.keyvault_command('show', 'get_key', transform=transform_key_output) g.keyvault_custom('import', 'import_key', transform=transform_key_output) g.keyvault_custom('get-policy-template', 'get_policy_template', is_preview=True) g.keyvault_custom('encrypt', 'encrypt_key', is_preview=True, transform=transform_key_encryption_output) g.keyvault_custom('decrypt', 'decrypt_key', is_preview=True, transform=transform_key_decryption_output) if not is_azure_stack_profile(self): with self.command_group('keyvault key', data_key_entity.command_type) as g: g.keyvault_command('random', 'get_random_bytes', transform=transform_key_random_output) g.keyvault_command('rotate', 'rotate_key', transform=transform_key_output) with self.command_group('keyvault key rotation-policy', data_key_entity.command_type) as g: g.keyvault_command( 'show', 'get_key_rotation_policy', ) g.keyvault_custom('update', 'update_key_rotation_policy') with self.command_group('keyvault secret', data_entity.command_type) as g: g.keyvault_command('list', 'get_secrets', transform=multi_transformers( filter_out_managed_resources, keep_max_results, extract_subresource_name()), table_transformer=transform_secret_list) g.keyvault_command('list-versions', 'get_secret_versions', transform=multi_transformers( keep_max_results, extract_subresource_name())) g.keyvault_command('list-deleted', 'get_deleted_secrets', transform=multi_transformers( keep_max_results, extract_subresource_name())) g.keyvault_command('set', 'set_secret', validator=process_secret_set_namespace, transform=extract_subresource_name()) g.keyvault_command('set-attributes', 'update_secret', transform=extract_subresource_name()) g.keyvault_command('show', 'get_secret', transform=extract_subresource_name()) g.keyvault_command('show-deleted', 'get_deleted_secret', transform=extract_subresource_name()) g.keyvault_command( 'delete', 'delete_secret', transform=extract_subresource_name(), deprecate_info=g.deprecate( tag_func=lambda x: '', message_func=lambda x: 'Warning! If you have soft-delete protection enabled on this key vault, this secret ' 'will be moved to the soft deleted state. You will not be able to create a secret ' 'with the same name within this key vault until the secret has been purged from the ' 'soft-deleted state. Please see the following documentation for additional guidance.' '\nhttps://docs.microsoft.com/azure/key-vault/general/soft-delete-overview' )) g.keyvault_command('purge', 'purge_deleted_secret') g.keyvault_command('recover', 'recover_deleted_secret', transform=extract_subresource_name()) g.keyvault_custom('download', 'download_secret') g.keyvault_custom( 'backup', 'backup_secret', doc_string_source=data_entity.operations_docs_tmpl.format( 'backup_secret')) g.keyvault_custom( 'restore', 'restore_secret', doc_string_source=data_entity.operations_docs_tmpl.format( 'restore_secret'), transform=extract_subresource_name()) with self.command_group('keyvault certificate', data_entity.command_type) as g: g.keyvault_custom( 'create', 'create_certificate', doc_string_source=data_entity.operations_docs_tmpl.format( 'create_certificate'), transform=extract_subresource_name()) g.keyvault_command('list', 'get_certificates', transform=multi_transformers( keep_max_results, extract_subresource_name())) g.keyvault_command('list-versions', 'get_certificate_versions', transform=multi_transformers( keep_max_results, extract_subresource_name())) g.keyvault_command('list-deleted', 'get_deleted_certificates', transform=multi_transformers( keep_max_results, extract_subresource_name())) g.keyvault_command('show', 'get_certificate', transform=extract_subresource_name()) g.keyvault_command('show-deleted', 'get_deleted_certificate', transform=extract_subresource_name()) g.keyvault_command( 'delete', 'delete_certificate', deprecate_info=g.deprecate( tag_func=lambda x: '', message_func=lambda x: 'Warning! If you have soft-delete protection enabled on this key vault, this ' 'certificate will be moved to the soft deleted state. You will not be able to ' 'create a certificate with the same name within this key vault until the ' 'certificate has been purged from the soft-deleted state. Please see the following ' 'documentation for additional guidance.\n' 'https://docs.microsoft.com/azure/key-vault/general/soft-delete-overview' ), transform=extract_subresource_name()) g.keyvault_command('purge', 'purge_deleted_certificate') g.keyvault_command('recover', 'recover_deleted_certificate', transform=extract_subresource_name()) g.keyvault_command('set-attributes', 'update_certificate', transform=extract_subresource_name()) g.keyvault_custom('import', 'import_certificate', transform=extract_subresource_name()) g.keyvault_custom('download', 'download_certificate') g.keyvault_custom('get-default-policy', 'get_default_policy') with self.command_group('keyvault certificate pending', data_entity.command_type) as g: g.keyvault_command('merge', 'merge_certificate', transform=extract_subresource_name()) g.keyvault_command('show', 'get_certificate_operation', transform=extract_subresource_name()) g.keyvault_command('delete', 'delete_certificate_operation', validator=process_certificate_cancel_namespace, transform=extract_subresource_name()) with self.command_group('keyvault certificate contact', data_entity.command_type) as g: g.keyvault_command('list', 'get_certificate_contacts', transform=keep_max_results) g.keyvault_custom('add', 'add_certificate_contact') g.keyvault_custom('delete', 'delete_certificate_contact') with self.command_group('keyvault certificate issuer', data_entity.command_type) as g: g.keyvault_custom('update', 'update_certificate_issuer') g.keyvault_command('list', 'get_certificate_issuers', transform=keep_max_results) g.keyvault_custom('create', 'create_certificate_issuer') g.keyvault_command('show', 'get_certificate_issuer') g.keyvault_command('delete', 'delete_certificate_issuer') with self.command_group('keyvault certificate issuer admin', data_entity.command_type) as g: g.keyvault_custom('list', 'list_certificate_issuer_admins', transform=keep_max_results) g.keyvault_custom('add', 'add_certificate_issuer_admin') g.keyvault_custom('delete', 'delete_certificate_issuer_admin') if not is_azure_stack_profile(self): with self.command_group('keyvault role', data_access_control_entity.command_type): pass with self.command_group('keyvault role assignment', data_access_control_entity.command_type) as g: g.keyvault_custom('delete', 'delete_role_assignment', validator=validate_role_assignment_args) g.keyvault_custom('list', 'list_role_assignments', table_transformer=transform_assignment_list) g.keyvault_custom('create', 'create_role_assignment') with self.command_group('keyvault role definition', data_access_control_entity.command_type) as g: g.keyvault_custom('list', 'list_role_definitions', table_transformer=transform_definition_list) g.keyvault_custom('create', 'create_role_definition') g.keyvault_custom('update', 'update_role_definition') g.keyvault_custom('delete', 'delete_role_definition') g.keyvault_custom('show', 'show_role_definition') data_api_version = str(get_api_version(self.cli_ctx, ResourceType.DATA_KEYVAULT)).\ replace('.', '_').replace('-', '_') if data_api_version != '2016_10_01': with self.command_group('keyvault certificate', data_entity.command_type) as g: g.keyvault_custom( 'backup', 'backup_certificate', doc_string_source=data_entity.operations_docs_tmpl.format( 'backup_certificate')) g.keyvault_custom( 'restore', 'restore_certificate', doc_string_source=data_entity.operations_docs_tmpl.format( 'restore_certificate')) if data_api_version != '2016_10_01': with self.command_group('keyvault storage', data_entity.command_type) as g: g.keyvault_command('add', 'set_storage_account') g.keyvault_command('list', 'get_storage_accounts', transform=keep_max_results) g.keyvault_command('show', 'get_storage_account') g.keyvault_command('update', 'update_storage_account') g.keyvault_command('remove', 'delete_storage_account') g.keyvault_command('regenerate-key', 'regenerate_storage_account_key') g.keyvault_command('list-deleted', 'get_deleted_storage_accounts', transform=keep_max_results) g.keyvault_command('show-deleted', 'get_deleted_storage_account') g.keyvault_command('purge', 'purge_deleted_storage_account') g.keyvault_command('recover', 'recover_deleted_storage_account') g.keyvault_custom( 'backup', 'backup_storage_account', doc_string_source=data_entity.operations_docs_tmpl.format( 'backup_storage_account')) g.keyvault_custom( 'restore', 'restore_storage_account', doc_string_source=data_entity.operations_docs_tmpl.format( 'restore_storage_account')) if data_api_version != '2016_10_01': with self.command_group('keyvault storage sas-definition', data_entity.command_type) as g: g.keyvault_command( 'create', 'set_sas_definition', doc_string_source=data_entity.operations_docs_tmpl.format( 'set_sas_definition')) g.keyvault_command('list', 'get_sas_definitions', transform=keep_max_results) g.keyvault_command('show', 'get_sas_definition') g.keyvault_command( 'update', 'update_sas_definition', doc_string_source=data_entity.operations_docs_tmpl.format( 'update_sas_definition')) g.keyvault_command('delete', 'delete_sas_definition') g.keyvault_command('list-deleted', 'get_deleted_sas_definitions', transform=keep_max_results) g.keyvault_command('show-deleted', 'get_deleted_sas_definition') g.keyvault_command('recover', 'recover_deleted_sas_definition')
def load_command_table(self, _): from ._client_factory import ( cf_alert_rules, cf_metric_def, cf_alert_rule_incidents, cf_log_profiles, cf_autoscale, cf_diagnostics, cf_activity_log, cf_action_groups, cf_activity_log_alerts, cf_event_categories, cf_metric_alerts, cf_log_analytics_workspace, cf_log_analytics_workspace_management_groups, cf_log_analytics_workspace_usage, cf_log_analytics_workspace_schema, cf_log_analytics_workspace_shared_keys, cf_log_analytics_workspace_intelligence_packs, cf_log_analytics_cluster, cf_log_analytics_workspace_linked_service, cf_diagnostics_category, cf_private_link_resources, cf_private_link_scoped_resources, cf_private_link_scopes, cf_private_endpoint_connections, cf_log_analytics_linked_storage) from ._exception_handler import monitor_exception_handler, missing_resource_handler from .transformers import (action_group_list_table) from .validators import process_autoscale_create_namespace, validate_private_endpoint_connection_id,\ make_cluster_creation_as_no_wait_by_default monitor_custom = CliCommandType( operations_tmpl='azure.cli.command_modules.monitor.custom#{}', exception_handler=monitor_exception_handler) action_group_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.monitor.operations#ActionGroupsOperations.{}', client_factory=cf_action_groups, operation_group='action_groups', exception_handler=monitor_exception_handler) action_group_custom = CliCommandType( operations_tmpl= 'azure.cli.command_modules.monitor.operations.action_groups#{}', client_factory=cf_action_groups, operation_group='action_groups', exception_handler=monitor_exception_handler) activity_log_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.monitor.operations#EventCategoriesOperations.{}', client_factory=cf_event_categories, operation_group='event_categories', exception_handler=monitor_exception_handler) activity_log_alerts_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.monitor.operations#ActivityLogAlertsOperations.{}', client_factory=cf_activity_log_alerts, operation_group='activity_log_alerts', exception_handler=monitor_exception_handler) activity_log_alerts_custom = CliCommandType( operations_tmpl= 'azure.cli.command_modules.monitor.operations.activity_log_alerts#{}', client_factory=cf_activity_log_alerts, operation_group='activity_log_alerts', exception_handler=monitor_exception_handler) alert_sdk = CliCommandType( operations_tmpl='azure.mgmt.monitor.operations#AlertRulesOperations.{}', client_factory=cf_alert_rules, operation_group='alert_rules', exception_handler=monitor_exception_handler) alert_rule_incidents_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.monitor.operations#AlertRuleIncidentsOperations.{}', client_factory=cf_alert_rule_incidents, operation_group='alert_rule_incidents', exception_handler=monitor_exception_handler) autoscale_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.monitor.operations#AutoscaleSettingsOperations.{}', client_factory=cf_autoscale, operation_group='autoscale_settings', exception_handler=monitor_exception_handler) autoscale_custom = CliCommandType( operations_tmpl= 'azure.cli.command_modules.monitor.operations.autoscale_settings#{}', client_factory=cf_autoscale, operation_group='autoscale_settings', exception_handler=monitor_exception_handler) diagnostics_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.monitor.operations#DiagnosticSettingsOperations.{}', client_factory=cf_diagnostics, operation_group='diagnostic_settings', exception_handler=monitor_exception_handler) diagnostics_categories_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.monitor.operations#DiagnosticSettingsCategoryOperations.{}', client_factory=cf_diagnostics_category, operation_group='diagnostic_settings_category', exception_handler=monitor_exception_handler) diagnostics_custom = CliCommandType( operations_tmpl= 'azure.cli.command_modules.monitor.operations.diagnostics_settings#{}', client_factory=cf_diagnostics, operation_group='diagnostic_settings_category', exception_handler=monitor_exception_handler) log_profiles_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.monitor.operations#LogProfilesOperations.{}', client_factory=cf_log_profiles, operation_group='log_profiles', exception_handler=monitor_exception_handler) log_profiles_custom = CliCommandType( operations_tmpl= 'azure.cli.command_modules.monitor.operations.log_profiles#{}', client_factory=cf_log_profiles, operation_group='log_profiles', exception_handler=monitor_exception_handler) alert_custom = CliCommandType( operations_tmpl= 'azure.cli.command_modules.monitor.operations.metric_alert#{}', client_factory=cf_alert_rules, operation_group='alert_rules', exception_handler=monitor_exception_handler) metric_alert_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.monitor.operations#MetricAlertsOperations.{}', client_factory=cf_metric_alerts, operation_group='metric_alerts', exception_handler=monitor_exception_handler) metric_definitions_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.monitor.operations#MetricDefinitionsOperations.{}', client_factory=cf_metric_def, operation_group='metric_definitions', exception_handler=monitor_exception_handler) log_analytics_workspace_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.loganalytics.operations#WorkspacesOperations.{}', client_factory=cf_log_analytics_workspace, exception_handler=monitor_exception_handler) private_link_resources_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.monitor.operations#PrivateLinkResourcesOperations.{}', client_factory=cf_private_link_resources, operation_group='private_link_resources', exception_handler=monitor_exception_handler) private_link_scoped_resources_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.monitor.operations#PrivateLinkScopedResourcesOperations.{}', client_factory=cf_private_link_scoped_resources, operation_group='private_link_scoped_resources', exception_handler=monitor_exception_handler) private_link_scopes_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.monitor.operations#PrivateLinkScopesOperations.{}', client_factory=cf_private_link_scopes, operation_group='private_link_scopes', exception_handler=monitor_exception_handler) private_endpoint_connections_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.monitor.operations#PrivateEndpointConnectionsOperations.{}', client_factory=cf_private_endpoint_connections, operation_group='private_endpoint_connections', exception_handler=monitor_exception_handler) private_link_scope_custom = CliCommandType( operations_tmpl= 'azure.cli.command_modules.monitor.operations.private_link_scope#{}', client_factory=cf_private_link_scopes, exception_handler=monitor_exception_handler) log_analytics_workspace_custom = CliCommandType( operations_tmpl= 'azure.cli.command_modules.monitor.operations.log_analytics_workspace#{}', client_factory=cf_log_analytics_workspace, exception_handler=monitor_exception_handler) log_analytics_workspace_management_groups_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.loganalytics.operations#ManagementGroupsOperations.{}', client_factory=cf_log_analytics_workspace_management_groups, exception_handler=monitor_exception_handler) log_analytics_workspace_usage_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.loganalytics.operations#UsagesOperations.{}', client_factory=cf_log_analytics_workspace_usage, exception_handler=monitor_exception_handler) log_analytics_workspace_schema_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.loganalytics.operations#SchemaOperations.{}', client_factory=cf_log_analytics_workspace_schema, exception_handler=monitor_exception_handler) log_analytics_workspace_shared_keys_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.loganalytics.operations#SharedKeysOperations.{}', client_factory=cf_log_analytics_workspace_shared_keys, exception_handler=monitor_exception_handler) log_analytics_workspace_intelligence_packs_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.loganalytics.operations#IntelligencePacksOperations.{}', client_factory=cf_log_analytics_workspace_intelligence_packs, exception_handler=monitor_exception_handler) log_analytics_workspace_linked_service_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.loganalytics.operations#LinkedServicesOperations.{}', client_factory=cf_log_analytics_workspace_linked_service, exception_handler=monitor_exception_handler) log_analytics_workspace_linked_service_custom = CliCommandType( operations_tmpl= 'azure.cli.command_modules.monitor.operations.log_analytics_workspace_linked_service#{}', client_factory=cf_log_analytics_workspace_linked_service, exception_handler=monitor_exception_handler) log_analytics_cluster_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.loganalytics.operations#ClustersOperations.{}', client_factory=cf_log_analytics_cluster, exception_handler=monitor_exception_handler) log_analytics_cluster_custom = CliCommandType( operations_tmpl= 'azure.cli.command_modules.monitor.operations.log_analytics_cluster#{}', client_factory=cf_log_analytics_cluster, exception_handler=monitor_exception_handler) log_analytics_linked_storage_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.loganalytics.operations#LinkedStorageAccountsOperations.{}', client_factory=cf_log_analytics_linked_storage, exception_handler=monitor_exception_handler) log_analytics_linked_storage_custom = CliCommandType( operations_tmpl= 'azure.cli.command_modules.monitor.operations.log_analytics_linked_storage_account#{}', client_factory=cf_log_analytics_linked_storage, exception_handler=monitor_exception_handler) monitor_general_custom = CliCommandType( operations_tmpl= 'azure.cli.command_modules.monitor.operations.general_operations#{}', client_factory=cf_metric_alerts, exception_handler=monitor_exception_handler) with self.command_group('monitor action-group', action_group_sdk, custom_command_type=action_group_custom) as g: g.show_command('show', 'get', table_transformer=action_group_list_table) g.command('create', 'create_or_update', table_transformer=action_group_list_table) g.command('delete', 'delete') g.command('enable-receiver', 'enable_receiver', table_transformer=action_group_list_table) g.custom_command('list', 'list_action_groups', table_transformer=action_group_list_table) g.generic_update_command('update', custom_func_name='update_action_groups', setter_arg_name='action_group', table_transformer=action_group_list_table) with self.command_group('monitor activity-log', activity_log_sdk) as g: g.custom_command('list', 'list_activity_log', client_factory=cf_activity_log) g.command('list-categories', 'list') with self.command_group( 'monitor activity-log alert', activity_log_alerts_sdk, custom_command_type=activity_log_alerts_custom) as g: g.custom_command('list', 'list_activity_logs_alert') g.custom_command('create', 'create') g.show_command('show', 'get', exception_handler=missing_resource_handler) g.command('delete', 'delete', exception_handler=missing_resource_handler) g.generic_update_command('update', custom_func_name='update', setter_arg_name='activity_log_alert') g.custom_command('action-group add', 'add_action_group') g.custom_command('action-group remove', 'remove_action_group') g.custom_command('scope add', 'add_scope') g.custom_command('scope remove', 'remove_scope') with self.command_group('monitor alert', alert_sdk, custom_command_type=alert_custom, deprecate_info=self.deprecate( redirect='monitor metrics alert', hide='2.0.44')) as g: g.custom_command('create', 'create_metric_rule') g.command('delete', 'delete') g.show_command('show', 'get') g.command('list', 'list_by_resource_group') g.command('show-incident', 'get', command_type=alert_rule_incidents_sdk) g.command('list-incidents', 'list_by_alert_rule', command_type=alert_rule_incidents_sdk) g.generic_update_command('update', custom_func_name='update_metric_rule') with self.command_group('monitor autoscale', autoscale_sdk, custom_command_type=autoscale_custom) as g: g.custom_command('create', 'autoscale_create', validator=process_autoscale_create_namespace) g.generic_update_command('update', custom_func_name='autoscale_update', custom_func_type=autoscale_custom, exception_handler=monitor_exception_handler) g.command('delete', 'delete') g.show_command('show', 'get') g.command('list', 'list_by_resource_group') with self.command_group('monitor autoscale profile', autoscale_sdk, custom_command_type=autoscale_custom) as g: g.custom_command('create', 'autoscale_profile_create') g.custom_command('list', 'autoscale_profile_list') g.custom_show_command('show', 'autoscale_profile_show') g.custom_command('delete', 'autoscale_profile_delete') g.custom_command('list-timezones', 'autoscale_profile_list_timezones') with self.command_group('monitor autoscale rule', autoscale_sdk, custom_command_type=autoscale_custom) as g: g.custom_command('create', 'autoscale_rule_create') g.custom_command('list', 'autoscale_rule_list') g.custom_command('delete', 'autoscale_rule_delete') g.custom_command('copy', 'autoscale_rule_copy') with self.command_group( 'monitor autoscale-settings', autoscale_sdk, custom_command_type=autoscale_custom, deprecate_info=self.deprecate(redirect='monitor autoscale', hide='2.0.34')) as g: g.command('create', 'create_or_update', deprecate_info='az monitor autoscale create') g.command('delete', 'delete', deprecate_info='az monitor autoscale delete') g.show_command('show', 'get', deprecate_info='az monitor autoscale show') g.command('list', 'list_by_resource_group', deprecate_info='az monitor autoscale list') g.custom_command('get-parameters-template', 'scaffold_autoscale_settings_parameters', deprecate_info='az monitor autoscale show') g.generic_update_command('update', deprecate_info='az monitor autoscale update') with self.command_group('monitor diagnostic-settings', diagnostics_sdk, custom_command_type=diagnostics_custom) as g: from .validators import validate_diagnostic_settings g.custom_command('create', 'create_diagnostics_settings', validator=validate_diagnostic_settings) g.show_command('show', 'get') g.command('list', 'list') g.command('delete', 'delete') g.generic_update_command('update') with self.command_group('monitor diagnostic-settings categories', diagnostics_categories_sdk) as g: g.show_command('show', 'get') g.command('list', 'list') with self.command_group('monitor log-profiles', log_profiles_sdk, custom_command_type=log_profiles_custom) as g: g.custom_command('create', 'create_log_profile_operations') g.command('delete', 'delete') g.show_command('show', 'get') g.command('list', 'list') g.generic_update_command('update') with self.command_group('monitor metrics') as g: from .transformers import metrics_table, metrics_definitions_table g.command('list', 'list_metrics', command_type=monitor_custom, table_transformer=metrics_table) g.command('list-definitions', 'list', command_type=metric_definitions_sdk, table_transformer=metrics_definitions_table) with self.command_group('monitor metrics alert', metric_alert_sdk, custom_command_type=alert_custom, client_factory=cf_metric_alerts) as g: g.custom_command('create', 'create_metric_alert', custom_command_type=alert_custom) g.command('delete', 'delete') g.custom_command('list', 'list_metric_alerts', custom_command_type=alert_custom) g.command('show', 'get') g.generic_update_command('update', custom_func_name='update_metric_alert', custom_func_type=alert_custom) with self.command_group('monitor log-analytics workspace', log_analytics_workspace_sdk, custom_command_type=log_analytics_workspace_custom, is_preview=True) as g: g.custom_command('create', 'create_log_analytics_workspace') g.generic_update_command( 'update', custom_func_name='update_log_analytics_workspace') g.show_command('show', 'get') g.command('delete', 'delete') g.custom_command('list', 'list_log_analytics_workspace') g.command('get-schema', 'get', command_type=log_analytics_workspace_schema_sdk) g.command('list-usages', 'list', command_type=log_analytics_workspace_usage_sdk) g.command('list-management-groups', 'list', command_type=log_analytics_workspace_management_groups_sdk) g.command('get-shared-keys', 'get_shared_keys', command_type=log_analytics_workspace_shared_keys_sdk) with self.command_group( 'monitor log-analytics workspace pack', log_analytics_workspace_intelligence_packs_sdk) as g: g.command('list', 'list') g.command('enable', 'enable') g.command('disable', 'disable') with self.command_group( 'monitor log-analytics workspace linked-service', log_analytics_workspace_linked_service_sdk, custom_command_type=log_analytics_workspace_linked_service_custom, is_preview=True) as g: g.custom_command('create', 'create_log_analytics_workspace_linked_service', supports_no_wait=True) g.generic_update_command( 'update', custom_func_name='update_log_analytics_workspace_linked_service', supports_no_wait=True) g.show_command('show', 'get') g.command('list', 'list_by_workspace') g.command('delete', 'delete', confirmation=True, supports_no_wait=True) g.wait_command('wait') with self.command_group('monitor log-analytics cluster', log_analytics_cluster_sdk, custom_command_type=log_analytics_cluster_custom, is_preview=True) as g: g.custom_command('create', 'create_log_analytics_cluster', validator=make_cluster_creation_as_no_wait_by_default) g.custom_command('update', 'update_log_analytics_cluster') g.show_command('show', 'get') g.command('delete', 'delete', confirmation=True, supports_no_wait=True) g.custom_command('list', 'list_log_analytics_clusters') g.wait_command('wait') with self.command_group( 'monitor log-analytics workspace linked-storage', log_analytics_linked_storage_sdk, custom_command_type=log_analytics_linked_storage_custom, is_preview=True) as g: g.command('create', 'create_or_update') g.custom_command( 'add', 'add_log_analytics_workspace_linked_storage_accounts') g.custom_command( 'remove', 'remove_log_analytics_workspace_linked_storage_accounts') g.command('delete', 'delete', confirmation=True) g.show_command('show', 'get') g.command('list', 'list_by_workspace') with self.command_group('monitor', metric_alert_sdk, custom_command_type=monitor_general_custom) as g: g.custom_command('clone', 'clone_existed_settings', is_preview=True) with self.command_group('monitor private-link-scope', private_link_scopes_sdk, custom_command_type=private_link_scope_custom, is_preview=True) as g: g.custom_show_command('show', 'show_private_link_scope') g.custom_command('list', 'list_private_link_scope') g.custom_command('create', 'create_private_link_scope') g.custom_command('update', 'update_private_link_scope') g.custom_command('delete', 'delete_private_link_scope', confirmation=True) with self.command_group('monitor private-link-scope scoped-resource', private_link_scoped_resources_sdk, custom_command_type=private_link_scope_custom, is_preview=True) as g: g.custom_show_command('show', 'show_private_link_scope_resource', client_factory=cf_private_link_scoped_resources) g.custom_command('list', 'list_private_link_scope_resource', client_factory=cf_private_link_scoped_resources) g.custom_command('create', 'create_private_link_scope_resource', client_factory=cf_private_link_scoped_resources) g.custom_command('delete', 'delete_private_link_scope_resource', client_factory=cf_private_link_scoped_resources, confirmation=True) with self.command_group('monitor private-link-scope private-link-resource', private_link_resources_sdk, custom_command_type=private_link_scope_custom, is_preview=True) as g: g.custom_show_command('show', 'show_private_link_resource', client_factory=cf_private_link_resources) from azure.cli.core.commands.transform import gen_dict_to_list_transform g.custom_command('list', 'list_private_link_resource', client_factory=cf_private_link_resources, transform=gen_dict_to_list_transform(key="value")) with self.command_group( 'monitor private-link-scope private-endpoint-connection', private_endpoint_connections_sdk, custom_command_type=private_link_scope_custom, is_preview=True) as g: g.custom_show_command( 'show', 'show_private_endpoint_connection', client_factory=cf_private_endpoint_connections, validator=validate_private_endpoint_connection_id) g.custom_command('list', 'list_private_endpoint_connection', client_factory=cf_private_endpoint_connections) g.custom_command('approve', 'approve_private_endpoint_connection', client_factory=cf_private_endpoint_connections, validator=validate_private_endpoint_connection_id) g.custom_command('reject', 'reject_private_endpoint_connection', client_factory=cf_private_endpoint_connections, validator=validate_private_endpoint_connection_id) g.custom_command('delete', 'delete_private_endpoint_connection', client_factory=cf_private_endpoint_connections, validator=validate_private_endpoint_connection_id, confirmation=True)
def load_command_table(self, _): cosmosdb_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#DatabaseAccountsOperations.{}', client_factory=cf_db_accounts) cosmosdb_private_endpoint_connections_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#PrivateEndpointConnectionsOperations.{}', client_factory=cf_db_private_endpoint_connections) cosmosdb_private_link_resources_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#PrivateLinkResourcesOperations.{}', client_factory=cf_db_private_link_resources) cosmosdb_sql_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#SqlResourcesOperations.{}', client_factory=cf_sql_resources) cosmosdb_mongo_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#MongoDBResourcesOperations.{}', client_factory=cf_mongo_db_resources) cosmosdb_cassandra_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#CassandraResourcesOperations.{}', client_factory=cf_cassandra_resources) cosmosdb_gremlin_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#GremlinResourcesOperations.{}', client_factory=cf_gremlin_resources) cosmosdb_table_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#TableResourcesOperations.{}', client_factory=cf_table_resources) with self.command_group('cosmosdb', cosmosdb_sdk, client_factory=cf_db_accounts) as g: g.show_command('show', 'get') g.command('list-keys', 'list_keys', deprecate_info=g.deprecate(redirect='cosmosdb keys list', hide=True)) g.command('list-read-only-keys', 'list_read_only_keys', deprecate_info=g.deprecate( redirect='cosmosdb keys list --type read-only-keys', hide=True)) g.command('list-connection-strings', 'list_connection_strings', table_transformer=list_connection_strings_output, deprecate_info=g.deprecate( redirect='cosmosdb keys list --type connection-strings', hide=True)) g.command('regenerate-key', 'regenerate_key', deprecate_info=g.deprecate( redirect='cosmosdb keys regenerate', hide=True)) g.command('check-name-exists', 'check_name_exists') g.command('delete', 'delete', confirmation=True) g.command('failover-priority-change', 'failover_priority_change') g.custom_command('create', 'cli_cosmosdb_create') g.custom_command('update', 'cli_cosmosdb_update') g.custom_command('list', 'cli_cosmosdb_list') with self.command_group( 'cosmosdb private-endpoint-connection', cosmosdb_private_endpoint_connections_sdk, client_factory=cf_db_private_endpoint_connections) as g: g.custom_command('approve', 'approve_private_endpoint_connection', validator=validate_private_endpoint_connection_id) g.custom_command('reject', 'reject_private_endpoint_connection', validator=validate_private_endpoint_connection_id) g.command('delete', 'delete', validator=validate_private_endpoint_connection_id) g.show_command('show', 'get', validator=validate_private_endpoint_connection_id) with self.command_group('cosmosdb private-link-resource', cosmosdb_private_link_resources_sdk, client_factory=cf_db_private_link_resources) as g: from azure.cli.core.commands.transform import gen_dict_to_list_transform g.show_command('list', 'list_by_database_account', transform=gen_dict_to_list_transform(key='values')) # SQL api with self.command_group('cosmosdb sql', is_preview=True): pass with self.command_group('cosmosdb sql database', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.custom_command('create', 'cli_cosmosdb_sql_database_create') g.command('list', 'list_sql_databases') g.command('show', 'get_sql_database') g.command('delete', 'delete_sql_database', confirmation=True) with self.command_group('cosmosdb sql container', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.custom_command('create', 'cli_cosmosdb_sql_container_create') g.custom_command('update', 'cli_cosmosdb_sql_container_update') g.command('list', 'list_sql_containers') g.command('show', 'get_sql_container') g.command('delete', 'delete_sql_container', confirmation=True) with self.command_group('cosmosdb sql stored-procedure', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.custom_command('create', 'cli_cosmosdb_sql_stored_procedure_create_update') g.custom_command('update', 'cli_cosmosdb_sql_stored_procedure_create_update') g.command('list', 'list_sql_stored_procedures') g.command('show', 'get_sql_stored_procedure') g.command('delete', 'delete_sql_stored_procedure', confirmation=True) with self.command_group('cosmosdb sql trigger', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.custom_command('create', 'cli_cosmosdb_sql_trigger_create') g.custom_command('update', 'cli_cosmosdb_sql_trigger_update') g.command('list', 'list_sql_triggers') g.command('show', 'get_sql_trigger') g.command('delete', 'delete_sql_trigger', confirmation=True) with self.command_group('cosmosdb sql user-defined-function', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.custom_command( 'create', 'cli_cosmosdb_sql_user_defined_function_create_update') g.custom_command( 'update', 'cli_cosmosdb_sql_user_defined_function_create_update') g.command('list', 'list_sql_user_defined_functions') g.command('show', 'get_sql_user_defined_function') g.command('delete', 'delete_sql_user_defined_function', confirmation=True) # MongoDB api with self.command_group('cosmosdb mongodb', is_preview=True): pass with self.command_group('cosmosdb mongodb database', cosmosdb_mongo_sdk, client_factory=cf_mongo_db_resources) as g: g.custom_command('create', 'cli_cosmosdb_mongodb_database_create') g.command('list', 'list_mongo_db_databases') g.command('show', 'get_mongo_db_database') g.command('delete', 'delete_mongo_db_database', confirmation=True) with self.command_group('cosmosdb mongodb collection', cosmosdb_mongo_sdk, client_factory=cf_mongo_db_resources) as g: g.custom_command('create', 'cli_cosmosdb_mongodb_collection_create') g.custom_command('update', 'cli_cosmosdb_mongodb_collection_update') g.command('list', 'list_mongo_db_collections') g.command('show', 'get_mongo_db_collection') g.command('delete', 'delete_mongo_db_collection', confirmation=True) # Cassandra api with self.command_group('cosmosdb cassandra', is_preview=True): pass with self.command_group('cosmosdb cassandra keyspace', cosmosdb_cassandra_sdk, client_factory=cf_cassandra_resources) as g: g.custom_command('create', 'cli_cosmosdb_cassandra_keyspace_create') g.command('list', 'list_cassandra_keyspaces') g.command('show', 'get_cassandra_keyspace') g.command('delete', 'delete_cassandra_keyspace', confirmation=True) with self.command_group('cosmosdb cassandra table', cosmosdb_cassandra_sdk, client_factory=cf_cassandra_resources) as g: g.custom_command('create', 'cli_cosmosdb_cassandra_table_create') g.custom_command('update', 'cli_cosmosdb_cassandra_table_update') g.command('list', 'list_cassandra_tables') g.command('show', 'get_cassandra_table') g.command('delete', 'delete_cassandra_table', confirmation=True) # Gremlin api with self.command_group('cosmosdb gremlin', is_preview=True): pass with self.command_group('cosmosdb gremlin database', cosmosdb_gremlin_sdk, client_factory=cf_gremlin_resources) as g: g.custom_command('create', 'cli_cosmosdb_gremlin_database_create') g.command('list', 'list_gremlin_databases') g.command('show', 'get_gremlin_database') g.command('delete', 'delete_gremlin_database', confirmation=True) with self.command_group('cosmosdb gremlin graph', cosmosdb_gremlin_sdk, client_factory=cf_gremlin_resources) as g: g.custom_command('create', 'cli_cosmosdb_gremlin_graph_create') g.custom_command('update', 'cli_cosmosdb_gremlin_graph_update') g.command('list', 'list_gremlin_graphs') g.command('show', 'get_gremlin_graph') g.command('delete', 'delete_gremlin_graph', confirmation=True) # Table api with self.command_group('cosmosdb table', cosmosdb_table_sdk, client_factory=cf_table_resources, is_preview=True) as g: g.custom_command('create', 'cli_cosmosdb_table_create') g.command('list', 'list_tables') g.command('show', 'get_table') g.command('delete', 'delete_table', confirmation=True) # Offer throughput with self.command_group('cosmosdb sql database throughput', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.command('show', 'get_sql_database_throughput') g.custom_command('update', 'cli_cosmosdb_sql_database_throughput_update') with self.command_group('cosmosdb sql container throughput', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.command('show', 'get_sql_container_throughput') g.custom_command('update', 'cli_cosmosdb_sql_container_throughput_update') with self.command_group('cosmosdb mongodb database throughput', cosmosdb_mongo_sdk, client_factory=cf_mongo_db_resources) as g: g.command('show', 'get_mongo_db_database_throughput') g.custom_command('update', 'cli_cosmosdb_mongodb_database_throughput_update') with self.command_group('cosmosdb mongodb collection throughput', cosmosdb_mongo_sdk, client_factory=cf_mongo_db_resources) as g: g.command('show', 'get_mongo_db_collection_throughput') g.custom_command('update', 'cli_cosmosdb_mongodb_collection_throughput_update') with self.command_group('cosmosdb cassandra keyspace throughput', cosmosdb_cassandra_sdk, client_factory=cf_cassandra_resources) as g: g.command('show', 'get_cassandra_keyspace_throughput') g.custom_command('update', 'cli_cosmosdb_cassandra_keyspace_throughput_update') with self.command_group('cosmosdb cassandra table throughput', cosmosdb_cassandra_sdk, client_factory=cf_cassandra_resources) as g: g.command('show', 'get_cassandra_table_throughput') g.custom_command('update', 'cli_cosmosdb_cassandra_table_throughput_update') with self.command_group('cosmosdb gremlin database throughput', cosmosdb_gremlin_sdk, client_factory=cf_gremlin_resources) as g: g.command('show', 'get_gremlin_database_throughput') g.custom_command('update', 'cli_cosmosdb_gremlin_database_throughput_update') with self.command_group('cosmosdb gremlin graph throughput', cosmosdb_gremlin_sdk, client_factory=cf_gremlin_resources) as g: g.command('show', 'get_gremlin_graph_throughput') g.custom_command('update', 'cli_cosmosdb_gremlin_graph_throughput_update') with self.command_group('cosmosdb table throughput', cosmosdb_table_sdk, client_factory=cf_table_resources) as g: g.command('show', 'get_table_throughput') g.custom_command('update', 'cli_cosmosdb_table_throughput_update') # virtual network rules with self.command_group('cosmosdb network-rule', None, client_factory=cf_db_accounts) as g: g.custom_command('list', 'cli_cosmosdb_network_rule_list') g.custom_command('add', 'cli_cosmosdb_network_rule_add') g.custom_command('remove', 'cli_cosmosdb_network_rule_remove') # key operations with self.command_group('cosmosdb keys', cosmosdb_sdk, client_factory=cf_db_accounts) as g: g.custom_command('list', 'cli_cosmosdb_keys', table_transformer=list_connection_strings_output) g.command('regenerate', 'regenerate_key') # # database operations with self.command_group( 'cosmosdb database', deprecate_info=self.deprecate(redirect=DATABASE_DEPRECATION_INFO, hide=True)) as g: g.cosmosdb_custom('show', 'cli_cosmosdb_database_show', table_transformer=database_output) g.cosmosdb_custom('list', 'cli_cosmosdb_database_list', table_transformer=list_database_output) g.cosmosdb_custom('exists', 'cli_cosmosdb_database_exists') g.cosmosdb_custom('create', 'cli_cosmosdb_database_create', table_transformer=database_output) g.cosmosdb_custom('delete', 'cli_cosmosdb_database_delete', confirmation=True) # collection operations with self.command_group( 'cosmosdb collection', deprecate_info=self.deprecate(redirect=COLLECTION_DEPRECATON_INFO, hide=True)) as g: g.cosmosdb_custom('show', 'cli_cosmosdb_collection_show', table_transformer=collection_output) g.cosmosdb_custom('list', 'cli_cosmosdb_collection_list', table_transformer=list_collection_output) g.cosmosdb_custom('exists', 'cli_cosmosdb_collection_exists') g.cosmosdb_custom('create', 'cli_cosmosdb_collection_create', table_transformer=collection_output) g.cosmosdb_custom('delete', 'cli_cosmosdb_collection_delete', confirmation=True) g.cosmosdb_custom('update', 'cli_cosmosdb_collection_update')
def load_command_table(self, _): # pylint: disable=too-many-locals, too-many-statements storage_account_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.storage.operations#StorageAccountsOperations.{}', client_factory=cf_sa, resource_type=ResourceType.MGMT_STORAGE) blob_service_mgmt_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.storage.operations#BlobServicesOperations.{}', client_factory=cf_mgmt_blob_services, resource_type=ResourceType.MGMT_STORAGE) file_service_mgmt_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.storage.operations#FileServicesOperations.{}', client_factory=cf_mgmt_file_services, resource_type=ResourceType.MGMT_STORAGE) file_shares_mgmt_sdk = CliCommandType( operations_tmpl='azure.mgmt.storage.operations#FileSharesOperations.{}', client_factory=cf_mgmt_file_shares, resource_type=ResourceType.MGMT_STORAGE) storage_account_sdk_keys = CliCommandType( operations_tmpl= 'azure.mgmt.storage.operations#StorageAccountsOperations.{}', client_factory=cf_sa_for_keys, resource_type=ResourceType.MGMT_STORAGE) private_link_resource_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.storage.operations#PrivateLinkResourcesOperations.{}', client_factory=cf_private_link, resource_type=ResourceType.MGMT_STORAGE) private_endpoint_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.storage.operations#PrivateEndpointConnectionsOperations.{}', client_factory=cf_private_endpoint, resource_type=ResourceType.MGMT_STORAGE) private_endpoint_custom_type = CliCommandType( operations_tmpl= 'azure.cli.command_modules.storage.operations.account#{}', client_factory=cf_private_endpoint, resource_type=ResourceType.MGMT_STORAGE) storage_account_custom_type = CliCommandType( operations_tmpl= 'azure.cli.command_modules.storage.operations.account#{}', client_factory=cf_sa) cloud_data_plane_sdk = CliCommandType( operations_tmpl='azure.multiapi.storage.common#CloudStorageAccount.{}', client_factory=cloud_storage_account_service_factory) block_blob_sdk = CliCommandType( operations_tmpl= 'azure.multiapi.storage.blob.blockblobservice#BlockBlobService.{}', client_factory=blob_data_service_factory, resource_type=ResourceType.DATA_STORAGE) def get_custom_sdk(custom_module, client_factory, resource_type=ResourceType.DATA_STORAGE): """Returns a CliCommandType instance with specified operation template based on the given custom module name. This is useful when the command is not defined in the default 'custom' module but instead in a module under 'operations' package.""" return CliCommandType( operations_tmpl='azure.cli.command_modules.storage.operations.{}#'. format(custom_module) + '{}', client_factory=client_factory, resource_type=resource_type) with self.command_group('storage', command_type=block_blob_sdk, custom_command_type=get_custom_sdk( 'azcopy', blob_data_service_factory)) as g: g.storage_custom_command('remove', 'storage_remove', is_preview=True) with self.command_group('storage', custom_command_type=get_custom_sdk('azcopy', None)) as g: g.custom_command('copy', 'storage_copy', is_preview=True) with self.command_group( 'storage account', storage_account_sdk, resource_type=ResourceType.MGMT_STORAGE, custom_command_type=storage_account_custom_type) as g: g.command('check-name', 'check_name_availability') g.custom_command('create', 'create_storage_account') g.command('delete', 'delete', confirmation=True) g.show_command('show', 'get_properties') g.custom_command('list', 'list_storage_accounts') g.custom_command('show-usage', 'show_storage_account_usage', min_api='2018-02-01') g.custom_command('show-usage', 'show_storage_account_usage_no_location', max_api='2017-10-01') g.custom_command('show-connection-string', 'show_storage_account_connection_string') g.generic_update_command('update', getter_name='get_properties', setter_name='update', custom_func_name='update_storage_account', min_api='2016-12-01') failover_confirmation = """ The secondary cluster will become the primary cluster after failover. Please understand the following impact to your storage account before you initiate the failover: 1. Please check the Last Sync Time using `az storage account show` with `--expand geoReplicationStats` and check the "geoReplicationStats" property. This is the data you may lose if you initiate the failover. 2. After the failover, your storage account type will be converted to locally redundant storage (LRS). You can convert your account to use geo-redundant storage (GRS). 3. Once you re-enable GRS/GZRS for your storage account, Microsoft will replicate data to your new secondary region. Replication time is dependent on the amount of data to replicate. Please note that there are bandwidth charges for the bootstrap. Please refer to doc: https://azure.microsoft.com/pricing/details/bandwidth/ """ g.command('failover', 'failover', supports_no_wait=True, is_preview=True, min_api='2018-07-01', confirmation=failover_confirmation) with self.command_group('storage account', storage_account_sdk_keys, resource_type=ResourceType.MGMT_STORAGE) as g: from ._validators import validate_key_name g.command('keys renew', 'regenerate_key', validator=validate_key_name, transform=lambda x: getattr(x, 'keys', x)) g.command('keys list', 'list_keys', transform=lambda x: getattr(x, 'keys', x)) g.command('revoke-delegation-keys', 'revoke_user_delegation_keys', min_api='2019-04-01') with self.command_group('storage account', cloud_data_plane_sdk) as g: g.storage_command('generate-sas', 'generate_shared_access_signature') encryption_scope_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.storage.operations#EncryptionScopesOperations.{}', client_factory=cf_mgmt_encryption_scope, resource_type=ResourceType.MGMT_STORAGE) encryption_scope_custom_type = CliCommandType( operations_tmpl= 'azure.cli.command_modules.storage.operations.account#{}', client_factory=cf_mgmt_encryption_scope, resource_type=ResourceType.MGMT_STORAGE) with self.command_group('storage account encryption-scope', encryption_scope_sdk, custom_command_type=encryption_scope_custom_type, is_preview=True, resource_type=ResourceType.MGMT_STORAGE, min_api='2019-06-01') as g: g.custom_command('create', 'create_encryption_scope') g.show_command('show', 'get') g.command('list', 'list') g.custom_command('update', 'update_encryption_scope') management_policy_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.storage.operations#ManagementPoliciesOperations.{}', client_factory=cf_mgmt_policy, resource_type=ResourceType.MGMT_STORAGE) management_policy_custom_type = CliCommandType( operations_tmpl= 'azure.cli.command_modules.storage.operations.account#{}', client_factory=cf_mgmt_policy) storage_blob_custom_type = CliCommandType( operations_tmpl='azure.cli.command_modules.storage.operations.blob#{}', client_factory=cf_sa, resource_type=ResourceType.MGMT_STORAGE) with self.command_group( 'storage account management-policy', management_policy_sdk, resource_type=ResourceType.MGMT_STORAGE, min_api='2018-11-01', custom_command_type=management_policy_custom_type) as g: g.show_command('show', 'get') g.custom_command('create', 'create_management_policies') g.generic_update_command('update', getter_name='get', setter_name='update_management_policies', setter_type=management_policy_custom_type) g.command('delete', 'delete') with self.command_group('storage account network-rule', storage_account_sdk, custom_command_type=storage_account_custom_type, resource_type=ResourceType.MGMT_STORAGE, min_api='2017-06-01') as g: g.custom_command('add', 'add_network_rule') g.custom_command('list', 'list_network_rules') g.custom_command('remove', 'remove_network_rule') with self.command_group('storage account private-endpoint-connection', private_endpoint_sdk, custom_command_type=private_endpoint_custom_type, is_preview=True, resource_type=ResourceType.MGMT_STORAGE, min_api='2019-06-01') as g: from ._validators import validate_private_endpoint_connection_id g.command('delete', 'delete', confirmation=True, validator=validate_private_endpoint_connection_id) g.command('show', 'get', validator=validate_private_endpoint_connection_id) g.custom_command('approve', 'approve_private_endpoint_connection', validator=validate_private_endpoint_connection_id) g.custom_command('reject', 'reject_private_endpoint_connection', validator=validate_private_endpoint_connection_id) with self.command_group('storage account private-link-resource', private_link_resource_sdk, resource_type=ResourceType.MGMT_STORAGE) as g: from azure.cli.core.commands.transform import gen_dict_to_list_transform g.command('list', 'list_by_storage_account', is_preview=True, min_api='2019-06-01', transform=gen_dict_to_list_transform(key="value")) with self.command_group('storage account blob-service-properties', blob_service_mgmt_sdk, custom_command_type=storage_account_custom_type, resource_type=ResourceType.MGMT_STORAGE, min_api='2018-07-01', is_preview=True) as g: g.show_command('show', 'get_service_properties') g.generic_update_command( 'update', getter_name='get_service_properties', setter_name='set_service_properties', custom_func_name='update_blob_service_properties') with self.command_group('storage account file-service-properties', file_service_mgmt_sdk, custom_command_type=get_custom_sdk( 'account', client_factory=cf_mgmt_file_services, resource_type=ResourceType.MGMT_STORAGE), resource_type=ResourceType.MGMT_STORAGE, min_api='2019-06-01', is_preview=True) as g: g.show_command('show', 'get_service_properties') g.custom_command('update', 'update_file_service_properties') with self.command_group( 'storage logging', get_custom_sdk('logging', multi_service_properties_factory)) as g: from ._transformers import transform_logging_list_output g.storage_command('update', 'set_logging') g.storage_command('show', 'get_logging', table_transformer=transform_logging_list_output, exception_handler=show_exception_handler) g.storage_command('off', 'disable_logging', is_preview=True) with self.command_group( 'storage metrics', get_custom_sdk('metrics', multi_service_properties_factory)) as g: from ._transformers import transform_metrics_list_output g.storage_command('update', 'set_metrics') g.storage_command('show', 'get_metrics', table_transformer=transform_metrics_list_output, exception_handler=show_exception_handler) base_blob_sdk = CliCommandType( operations_tmpl= 'azure.multiapi.storage.blob.baseblobservice#BaseBlobService.{}', client_factory=blob_data_service_factory, resource_type=ResourceType.DATA_STORAGE) blob_client_sdk = CliCommandType( operation_tmpl= 'azure.multiapi.storagev2.blob._blob_client#BlobClient.{}', client_factory=cf_blob_client, resource_type=ResourceType.DATA_STORAGE_BLOB) with self.command_group( 'storage blob', blob_client_sdk, resource_type=ResourceType.DATA_STORAGE_BLOB, min_api='2019-02-02', custom_command_type=get_custom_sdk( 'blob', client_factory=cf_blob_client, resource_type=ResourceType.DATA_STORAGE_BLOB)) as g: from ._transformers import transform_blob_json_output from ._format import transform_blob_output g.storage_custom_command_oauth( 'show', 'show_blob_v2', transform=transform_blob_json_output, table_transformer=transform_blob_output, exception_handler=show_exception_handler) with self.command_group('storage blob', command_type=block_blob_sdk, custom_command_type=get_custom_sdk( 'blob', blob_data_service_factory)) as g: from ._format import transform_boolean_for_table, transform_blob_output from ._transformers import (transform_storage_list_output, transform_url, create_boolean_result_output_transformer) from ._validators import (process_blob_download_batch_parameters, process_blob_delete_batch_parameters, process_blob_upload_batch_parameters) g.storage_command_oauth('list', 'list_blobs', transform=transform_storage_list_output, table_transformer=transform_blob_output) g.storage_command_oauth('download', 'get_blob_to_path', table_transformer=transform_blob_output) g.storage_custom_command_oauth('generate-sas', 'generate_sas_blob_uri') g.storage_custom_command_oauth('url', 'create_blob_url', transform=transform_url) g.storage_command_oauth('snapshot', 'snapshot_blob') g.storage_command_oauth('update', 'set_blob_properties') g.storage_command_oauth( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists')) g.storage_command_oauth('delete', 'delete_blob') g.storage_command_oauth( 'undelete', 'undelete_blob', transform=create_boolean_result_output_transformer('undeleted'), table_transformer=transform_boolean_for_table, min_api='2017-07-29') g.storage_custom_command_oauth( 'upload', 'upload_blob', doc_string_source='blob#BlockBlobService.create_blob_from_path') g.storage_custom_command_oauth( 'upload-batch', 'storage_blob_upload_batch', validator=process_blob_upload_batch_parameters) g.storage_custom_command_oauth( 'download-batch', 'storage_blob_download_batch', validator=process_blob_download_batch_parameters) g.storage_custom_command_oauth( 'delete-batch', 'storage_blob_delete_batch', validator=process_blob_delete_batch_parameters) g.storage_command_oauth('metadata show', 'get_blob_metadata', exception_handler=show_exception_handler) g.storage_command_oauth('metadata update', 'set_blob_metadata') g.storage_command_oauth('lease acquire', 'acquire_blob_lease') g.storage_command_oauth('lease renew', 'renew_blob_lease') g.storage_command_oauth('lease release', 'release_blob_lease') g.storage_command_oauth('lease change', 'change_blob_lease') g.storage_command_oauth('lease break', 'break_blob_lease') g.storage_command_oauth('copy start', 'copy_blob') g.storage_command_oauth('copy cancel', 'abort_copy_blob') g.storage_custom_command_oauth('copy start-batch', 'storage_blob_copy_batch') with self.command_group('storage blob', custom_command_type=get_custom_sdk( 'blob', cf_blob_client)) as g: g.storage_custom_command_oauth('set-tier', 'set_blob_tier_v2') with self.command_group('storage blob', storage_account_sdk, resource_type=ResourceType.MGMT_STORAGE, custom_command_type=storage_blob_custom_type) as g: g.custom_command('restore', 'restore_blob_ranges', min_api='2019-06-01', is_preview=True, supports_no_wait=True) with self.command_group( 'storage blob incremental-copy', operations_tmpl= 'azure.multiapi.storage.blob.pageblobservice#PageBlobService.{}', client_factory=page_blob_service_factory, resource_type=ResourceType.DATA_STORAGE, min_api='2016-05-31') as g: g.storage_command_oauth('start', 'incremental_copy_blob') with self.command_group( 'storage blob incremental-copy', operations_tmpl= 'azure.multiapi.storage.blob.blockblobservice#BlockBlobService.{}', client_factory=page_blob_service_factory, resource_type=ResourceType.DATA_STORAGE, min_api='2016-05-31') as g: g.storage_command_oauth('cancel', 'abort_copy_blob') with self.command_group('storage blob service-properties delete-policy', command_type=base_blob_sdk, min_api='2017-07-29', custom_command_type=get_custom_sdk( 'blob', blob_data_service_factory)) as g: g.storage_command_oauth( 'show', 'get_blob_service_properties', transform=lambda x: getattr(x, 'delete_retention_policy', x), exception_handler=show_exception_handler) g.storage_custom_command_oauth('update', 'set_delete_policy') with self.command_group('storage blob service-properties', command_type=base_blob_sdk) as g: g.storage_command_oauth('show', 'get_blob_service_properties', exception_handler=show_exception_handler) g.storage_command_oauth('update', generic_update=True, getter_name='get_blob_service_properties', setter_type=get_custom_sdk( 'blob', cf_blob_data_gen_update), setter_name='set_service_properties', client_factory=cf_blob_data_gen_update) with self.command_group('storage blob', command_type=block_blob_sdk, custom_command_type=get_custom_sdk( 'azcopy', blob_data_service_factory)) as g: g.storage_custom_command_oauth('sync', 'storage_blob_sync', is_preview=True) with self.command_group('storage container', command_type=block_blob_sdk, custom_command_type=get_custom_sdk( 'blob', blob_data_service_factory)) as g: from azure.cli.command_modules.storage._transformers import ( transform_storage_list_output, transform_container_permission_output, transform_acl_list_output) from azure.cli.command_modules.storage._format import ( transform_container_list, transform_boolean_for_table, transform_container_show) from ._validators import process_container_delete_parameters, validate_client_auth_parameter g.storage_command_oauth('list', 'list_containers', transform=transform_storage_list_output, table_transformer=transform_container_list) g.storage_custom_command_oauth( 'delete', 'delete_container', validator=process_container_delete_parameters, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) g.storage_command_oauth('show', 'get_container_properties', table_transformer=transform_container_show, exception_handler=show_exception_handler) g.storage_custom_command_oauth( 'create', 'create_container', validator=validate_client_auth_parameter, client_factory=None, transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) g.storage_custom_command_oauth( 'generate-sas', 'generate_container_shared_access_signature', min_api='2018-11-09') g.storage_command_oauth('generate-sas', 'generate_container_shared_access_signature', max_api='2018-03-28') g.storage_command_oauth( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists'), table_transformer=transform_boolean_for_table) g.storage_command_oauth('set-permission', 'set_container_acl') g.storage_command_oauth( 'show-permission', 'get_container_acl', transform=transform_container_permission_output) g.storage_command_oauth('metadata update', 'set_container_metadata') g.storage_command_oauth('metadata show', 'get_container_metadata', exception_handler=show_exception_handler) g.storage_command_oauth('lease acquire', 'acquire_container_lease') g.storage_command_oauth('lease renew', 'renew_container_lease') g.storage_command_oauth('lease release', 'release_container_lease') g.storage_command_oauth('lease change', 'change_container_lease') g.storage_command_oauth('lease break', 'break_container_lease') with self.command_group('storage container', command_type=block_blob_sdk, custom_command_type=get_custom_sdk( 'acl', blob_data_service_factory)) as g: g.storage_custom_command_oauth('policy create', 'create_acl_policy') g.storage_custom_command_oauth('policy delete', 'delete_acl_policy') g.storage_custom_command_oauth('policy update', 'set_acl_policy', min_api='2017-04-17') g.storage_custom_command_oauth( 'policy show', 'get_acl_policy', exception_handler=show_exception_handler) g.storage_custom_command_oauth( 'policy list', 'list_acl_policies', table_transformer=transform_acl_list_output) blob_container_mgmt_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.storage.operations#BlobContainersOperations.{}', client_factory=cf_blob_container_mgmt, resource_type=ResourceType.MGMT_STORAGE) with self.command_group('storage container immutability-policy', command_type=blob_container_mgmt_sdk, min_api='2018-02-01') as g: from azure.cli.command_modules.storage._transformers import transform_immutability_policy g.show_command('show', 'get_immutability_policy', transform=transform_immutability_policy) g.command('create', 'create_or_update_immutability_policy') g.command('delete', 'delete_immutability_policy', transform=lambda x: None) g.command('lock', 'lock_immutability_policy') g.command('extend', 'extend_immutability_policy') with self.command_group('storage container legal-hold', command_type=blob_container_mgmt_sdk, min_api='2018-02-01') as g: g.command('set', 'set_legal_hold') g.command('clear', 'clear_legal_hold') g.show_command('show', 'get', transform=lambda x: getattr(x, 'legal_hold', x)) file_sdk = CliCommandType( operations_tmpl= 'azure.multiapi.storage.file.fileservice#FileService.{}', client_factory=file_data_service_factory, resource_type=ResourceType.DATA_STORAGE) with self.command_group('storage share-rm', command_type=file_shares_mgmt_sdk, custom_command_type=get_custom_sdk( 'file', cf_mgmt_file_shares, resource_type=ResourceType.MGMT_STORAGE), resource_type=ResourceType.MGMT_STORAGE, min_api='2019-04-01', is_preview=True) as g: g.custom_command('create', 'create_share_rm') g.command('delete', 'delete', confirmation=True) g.custom_command( 'exists', '_file_share_exists', transform=create_boolean_result_output_transformer('exists')) g.command('list', 'list') g.show_command('show', 'get') g.generic_update_command('update', setter_name='update', setter_arg_name='file_share', custom_func_name='update_share_rm') with self.command_group('storage share', command_type=file_sdk, custom_command_type=get_custom_sdk( 'file', file_data_service_factory)) as g: from ._format import (transform_share_list, transform_boolean_for_table) g.storage_command('list', 'list_shares', transform=transform_storage_list_output, table_transformer=transform_share_list) g.storage_command( 'create', 'create_share', transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) g.storage_command( 'delete', 'delete_share', transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) g.storage_command('generate-sas', 'generate_share_shared_access_signature') g.storage_command('stats', 'get_share_stats') g.storage_command('show', 'get_share_properties', exception_handler=show_exception_handler) g.storage_command('update', 'set_share_properties') g.storage_command('snapshot', 'snapshot_share', min_api='2017-04-17') g.storage_command( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists')) g.storage_custom_command('url', 'create_share_url', transform=transform_url) g.storage_command('metadata show', 'get_share_metadata', exception_handler=show_exception_handler) g.storage_command('metadata update', 'set_share_metadata') with self.command_group('storage share policy', command_type=file_sdk, custom_command_type=get_custom_sdk( 'acl', file_data_service_factory)) as g: g.storage_custom_command('create', 'create_acl_policy') g.storage_custom_command('delete', 'delete_acl_policy') g.storage_custom_command('show', 'get_acl_policy', exception_handler=show_exception_handler) g.storage_custom_command('list', 'list_acl_policies', table_transformer=transform_acl_list_output) g.storage_custom_command('update', 'set_acl_policy') with self.command_group('storage directory', command_type=file_sdk, custom_command_type=get_custom_sdk( 'directory', file_data_service_factory)) as g: from ._format import transform_file_directory_result, transform_file_output g.storage_command( 'create', 'create_directory', transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) g.storage_command( 'delete', 'delete_directory', transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) g.storage_command('show', 'get_directory_properties', table_transformer=transform_file_output, exception_handler=show_exception_handler) g.storage_command( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists')) g.storage_command('metadata show', 'get_directory_metadata', exception_handler=show_exception_handler) g.storage_command('metadata update', 'set_directory_metadata') g.storage_custom_command( 'list', 'list_share_directories', transform=transform_file_directory_result(self.cli_ctx), table_transformer=transform_file_output, doc_string_source='file#FileService.list_directories_and_files') with self.command_group('storage file', command_type=file_sdk, custom_command_type=get_custom_sdk( 'file', file_data_service_factory)) as g: from ._format import transform_file_directory_result, transform_boolean_for_table, transform_file_output from ._transformers import transform_url g.storage_custom_command( 'list', 'list_share_files', transform=transform_file_directory_result(self.cli_ctx), table_transformer=transform_file_output, doc_string_source='file#FileService.list_directories_and_files') g.storage_command( 'delete', 'delete_file', transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) g.storage_command('resize', 'resize_file') g.storage_custom_command('url', 'create_file_url', transform=transform_url) g.storage_command('generate-sas', 'generate_file_shared_access_signature') g.storage_command('show', 'get_file_properties', table_transformer=transform_file_output, exception_handler=show_exception_handler) g.storage_command('update', 'set_file_properties') g.storage_command( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists')) g.storage_command('download', 'get_file_to_path') g.storage_command('upload', 'create_file_from_path') g.storage_command('metadata show', 'get_file_metadata', exception_handler=show_exception_handler) g.storage_command('metadata update', 'set_file_metadata') g.storage_command('copy start', 'copy_file') g.storage_command('copy cancel', 'abort_copy_file') g.storage_custom_command('upload-batch', 'storage_file_upload_batch') g.storage_custom_command('download-batch', 'storage_file_download_batch') g.storage_custom_command('delete-batch', 'storage_file_delete_batch') g.storage_custom_command('copy start-batch', 'storage_file_copy_batch') with self.command_group( 'storage cors', get_custom_sdk('cors', multi_service_properties_factory)) as g: from ._transformers import transform_cors_list_output g.storage_command('add', 'add_cors') g.storage_command('clear', 'clear_cors') g.storage_command('list', 'list_cors', transform=transform_cors_list_output) queue_sdk = CliCommandType( operations_tmpl= 'azure.multiapi.storage.queue.queueservice#QueueService.{}', client_factory=queue_data_service_factory, resource_type=ResourceType.DATA_STORAGE) with self.command_group('storage queue', queue_sdk, custom_command_type=get_custom_sdk( 'acl', queue_data_service_factory)) as g: from ._format import transform_boolean_for_table from ._transformers import create_boolean_result_output_transformer g.storage_command_oauth('list', 'list_queues', transform=transform_storage_list_output) g.storage_command_oauth( 'create', 'create_queue', transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) g.storage_command_oauth( 'delete', 'delete_queue', transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) g.storage_command_oauth('generate-sas', 'generate_queue_shared_access_signature') g.storage_command_oauth('stats', 'get_queue_service_stats', min_api='2016-05-31') g.storage_command_oauth( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists')) g.storage_command_oauth('metadata show', 'get_queue_metadata', exception_handler=show_exception_handler) g.storage_command_oauth('metadata update', 'set_queue_metadata') g.storage_custom_command_oauth('policy create', 'create_acl_policy') g.storage_custom_command_oauth('policy delete', 'delete_acl_policy') g.storage_custom_command_oauth( 'policy show', 'get_acl_policy', exception_handler=show_exception_handler) g.storage_custom_command_oauth( 'policy list', 'list_acl_policies', table_transformer=transform_acl_list_output) g.storage_custom_command_oauth('policy update', 'set_acl_policy') with self.command_group('storage message', queue_sdk) as g: from ._transformers import create_boolean_result_output_transformer from ._format import transform_message_show g.storage_command_oauth('put', 'put_message') g.storage_command_oauth('get', 'get_messages', table_transformer=transform_message_show) g.storage_command_oauth('peek', 'peek_messages', table_transformer=transform_message_show) g.storage_command_oauth( 'delete', 'delete_message', transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) g.storage_command_oauth('clear', 'clear_messages') g.storage_command_oauth('update', 'update_message') if cosmosdb_table_exists(self.cli_ctx): table_sdk = CliCommandType( operations_tmpl= 'azure.multiapi.cosmosdb.table.tableservice#TableService.{}', client_factory=table_data_service_factory, resource_type=ResourceType.DATA_COSMOS_TABLE) else: table_sdk = CliCommandType( operations_tmpl= 'azure.multiapi.storage.table.tableservice#TableService.{}', client_factory=table_data_service_factory, resource_type=ResourceType.DATA_COSMOS_TABLE) with self.command_group('storage table', table_sdk, custom_command_type=get_custom_sdk( 'acl', table_data_service_factory)) as g: from ._format import transform_boolean_for_table from ._transformers import create_boolean_result_output_transformer g.storage_command( 'create', 'create_table', transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) g.storage_command( 'delete', 'delete_table', transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) g.storage_command( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists')) g.storage_command('generate-sas', 'generate_table_shared_access_signature') g.storage_command('list', 'list_tables', transform=transform_storage_list_output) g.storage_command('stats', 'get_table_service_stats', min_api='2016-05-31') g.storage_custom_command('policy create', 'create_acl_policy') g.storage_custom_command('policy delete', 'delete_acl_policy') g.storage_custom_command('policy show', 'get_acl_policy', exception_handler=show_exception_handler) g.storage_custom_command('policy list', 'list_acl_policies', table_transformer=transform_acl_list_output) g.storage_custom_command('policy update', 'set_acl_policy') with self.command_group('storage entity', table_sdk, custom_command_type=get_custom_sdk( 'table', table_data_service_factory)) as g: from ._format import transform_boolean_for_table, transform_entity_show from ._transformers import (create_boolean_result_output_transformer, transform_entity_query_output, transform_entities_result, transform_entity_result) g.storage_command('query', 'query_entities', table_transformer=transform_entity_query_output, transform=transform_entities_result) g.storage_command('replace', 'update_entity') g.storage_command('merge', 'merge_entity') g.storage_command( 'delete', 'delete_entity', transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) g.storage_command('show', 'get_entity', table_transformer=transform_entity_show, exception_handler=show_exception_handler, transform=transform_entity_result) g.storage_custom_command('insert', 'insert_table_entity') adls_service_sdk = CliCommandType( operations_tmpl= 'azure.multiapi.storagev2.filedatalake._data_lake_service_client#DataLakeServiceClient.{}', client_factory=cf_adls_service, resource_type=ResourceType.DATA_STORAGE_FILEDATALAKE) adls_fs_sdk = CliCommandType( operations_tmpl= 'azure.multiapi.storagev2.filedatalake._file_system_client#FileSystemClient.{}', client_factory=cf_adls_file_system, resource_type=ResourceType.DATA_STORAGE_FILEDATALAKE) adls_directory_sdk = CliCommandType( operations_tmpl= 'azure.multiapi.storagev2.filedatalake._data_lake_directory_client#DataLakeDirectoryClient.{}', client_factory=cf_adls_directory, resource_type=ResourceType.DATA_STORAGE_FILEDATALAKE) adls_file_sdk = CliCommandType( operations_tmpl= 'azure.multiapi.storagev2.filedatalake._data_lake_file_client#DataLakeFileClient.{}', client_factory=cf_adls_file, resource_type=ResourceType.DATA_STORAGE_FILEDATALAKE) with self.command_group( 'storage fs', adls_fs_sdk, resource_type=ResourceType.DATA_STORAGE_FILEDATALAKE, custom_command_type=get_custom_sdk('filesystem', cf_adls_file_system), min_api='2018-11-09') as g: from ._transformers import transform_fs_list_public_access_output, transform_fs_public_access_output, \ transform_metadata g.storage_command_oauth('create', 'create_file_system') g.storage_command_oauth( 'list', 'list_file_systems', command_type=adls_service_sdk, transform=transform_fs_list_public_access_output) g.storage_command_oauth('show', 'get_file_system_properties', exception_handler=show_exception_handler, transform=transform_fs_public_access_output) g.storage_command_oauth('delete', 'delete_file_system', confirmation=True) g.storage_custom_command_oauth( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists')) g.storage_command_oauth('metadata update', 'set_file_system_metadata') g.storage_command_oauth('metadata show', 'get_file_system_properties', exception_handler=show_exception_handler, transform=transform_metadata) with self.command_group( 'storage fs directory', adls_directory_sdk, custom_command_type=get_custom_sdk('fs_directory', cf_adls_directory), resource_type=ResourceType.DATA_STORAGE_FILEDATALAKE, min_api='2018-11-09') as g: from ._transformers import transform_storage_list_output, transform_metadata g.storage_command_oauth('create', 'create_directory') g.storage_custom_command_oauth( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists')) g.storage_custom_command_oauth( 'show', 'get_directory_properties', exception_handler=show_exception_handler) g.storage_command_oauth('delete', 'delete_directory', confirmation=True) g.storage_command_oauth('move', 'rename_directory') g.storage_custom_command_oauth('list', 'list_fs_directories', client_factory=cf_adls_file_system, transform=transform_storage_list_output) g.storage_command_oauth('metadata update', 'set_metadata') g.storage_command_oauth('metadata show', 'get_directory_properties', exception_handler=show_exception_handler, transform=transform_metadata) with self.command_group( 'storage fs file', adls_file_sdk, resource_type=ResourceType.DATA_STORAGE_FILEDATALAKE, custom_command_type=get_custom_sdk('fs_file', cf_adls_file), min_api='2018-11-09') as g: from ._transformers import transform_storage_list_output, create_boolean_result_output_transformer g.storage_command_oauth('create', 'create_file') g.storage_custom_command_oauth('upload', 'upload_file') g.storage_custom_command_oauth( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists')) g.storage_custom_command_oauth('append', 'append_file') g.storage_custom_command_oauth('download', 'download_file') g.storage_custom_command_oauth( 'show', 'get_file_properties', exception_handler=show_exception_handler) g.storage_custom_command_oauth('list', 'list_fs_files', custom_command_type=get_custom_sdk( 'fs_file', cf_adls_file_system), transform=transform_storage_list_output) g.storage_command('move', 'rename_file') g.storage_command('delete', 'delete_file', confirmation=True) g.storage_command_oauth('metadata update', 'set_metadata') g.storage_command_oauth('metadata show', 'get_file_properties', exception_handler=show_exception_handler, transform=transform_metadata) with self.command_group( 'storage fs access', adls_directory_sdk, resource_type=ResourceType.DATA_STORAGE_FILEDATALAKE, min_api='2018-11-09') as g: from ._transformers import transform_fs_access_output g.storage_command('set', 'set_access_control') g.storage_command('show', 'get_access_control', transform=transform_fs_access_output)
def load_command_table(self, _): from azure.cli.command_modules.eventhubs._client_factory import ( namespaces_mgmt_client_factory, event_hub_mgmt_client_factory, consumer_groups_mgmt_client_factory, disaster_recovery_mgmt_client_factory, cluster_mgmt_client_factory, private_endpoint_connections_mgmt_client_factory, private_link_mgmt_client_factory) eh_namespace_util = CliCommandType( operations_tmpl= 'azure.mgmt.eventhub.operations#NamespacesOperations.{}', client_factory=namespaces_mgmt_client_factory, resource_type=ResourceType.MGMT_EVENTHUB) eh_clusters_util = CliCommandType( operations_tmpl='azure.mgmt.eventhub.operations#ClustersOperations.{}', client_factory=cluster_mgmt_client_factory, resource_type=ResourceType.MGMT_EVENTHUB) eh_event_hub_util = CliCommandType( operations_tmpl='azure.mgmt.eventhub.operations#EventHubsOperations.{}', client_factory=event_hub_mgmt_client_factory, resource_type=ResourceType.MGMT_EVENTHUB) eh_consumer_groups_util = CliCommandType( operations_tmpl= 'azure.mgmt.eventhub.operations#ConsumerGroupsOperations.{}', client_factory=consumer_groups_mgmt_client_factory, resource_type=ResourceType.MGMT_EVENTHUB) eh_geodr_util = CliCommandType( operations_tmpl= 'azure.mgmt.eventhub.operations#DisasterRecoveryConfigsOperations.{}', client_factory=disaster_recovery_mgmt_client_factory, resource_type=ResourceType.MGMT_EVENTHUB) eh_private_endpoints_util = CliCommandType( operations_tmpl= 'azure.mgmt.eventhub.operations#PrivateEndpointConnectionsOperations.{}', client_factory=private_endpoint_connections_mgmt_client_factory, resource_type=ResourceType.MGMT_EVENTHUB) eh_private_links_util = CliCommandType( operations_tmpl= 'azure.mgmt.eventhub.operations#PrivateLinkResourcesOperations.{}', client_factory=private_link_mgmt_client_factory, resource_type=ResourceType.MGMT_EVENTHUB) from ._validator import validate_subnet # Namespace Region custom_tmpl = 'azure.cli.command_modules.eventhubs.custom#{}' eventhubs_custom = CliCommandType(operations_tmpl=custom_tmpl) with self.command_group( 'eventhubs namespace', eh_namespace_util, resource_type=ResourceType.MGMT_EVENTHUB, client_factory=namespaces_mgmt_client_factory) as g: g.custom_command('create', 'cli_namespace_create') g.show_command('show', 'get') g.custom_command('list', 'cli_namespace_list') g.command('delete', 'begin_delete') g.custom_command('exists', 'cli_namespace_exists') g.generic_update_command('update', custom_func_name='cli_namespace_update', custom_func_type=eventhubs_custom, setter_name='begin_create_or_update') with self.command_group( 'eventhubs namespace authorization-rule', eh_namespace_util, resource_type=ResourceType.MGMT_EVENTHUB, client_factory=namespaces_mgmt_client_factory) as g: g.custom_command('create', 'cli_namespaceautho_create') g.show_command('show', 'get_authorization_rule') g.command('list', 'list_authorization_rules') g.command('keys list', 'list_keys') g.custom_command('keys renew', 'cli_keys_renew') g.command('delete', 'delete_authorization_rule') g.generic_update_command( 'update', getter_name='get_authorization_rule', setter_name='create_or_update_authorization_rule', custom_func_name='cli_autho_update') with self.command_group( 'eventhubs namespace private-endpoint-connection', eh_private_endpoints_util, resource_type=ResourceType.MGMT_EVENTHUB, custom_command_type=eventhubs_custom, is_preview=True, client_factory=private_endpoint_connections_mgmt_client_factory ) as g: from ._validator import validate_private_endpoint_connection_id g.command('delete', 'begin_delete', confirmation=True, validator=validate_private_endpoint_connection_id) g.show_command('show', 'get', validator=validate_private_endpoint_connection_id) g.command('list', 'list', validator=validate_private_endpoint_connection_id) g.custom_command('approve', 'approve_private_endpoint_connection', validator=validate_private_endpoint_connection_id) g.custom_command('reject', 'reject_private_endpoint_connection', validator=validate_private_endpoint_connection_id) with self.command_group('eventhubs namespace private-link-resource', eh_private_links_util, resource_type=ResourceType.MGMT_EVENTHUB) as g: from azure.cli.core.commands.transform import gen_dict_to_list_transform g.show_command('show', 'get', is_preview=True, min_api='2021-06-01-preview', transform=gen_dict_to_list_transform(key="value")) # Cluster Region with self.command_group('eventhubs cluster', eh_clusters_util, resource_type=ResourceType.MGMT_EVENTHUB, client_factory=cluster_mgmt_client_factory, min_api='2018-01-01-preview') as g: g.custom_command('create', 'cli_cluster_create') g.show_command('show', 'get') g.command('list', 'list_by_resource_group') g.command('namespace list', 'list_namespaces') g.wait_command('wait') g.command('delete', 'begin_delete', confirmation=True, supports_no_wait=True) g.command('available-region', 'list_available_cluster_region') g.generic_update_command('update', getter_name='get', setter_name='begin_update', custom_func_name='cli_cluster_update', custom_func_type=eventhubs_custom) # EventHub Region with self.command_group('eventhubs eventhub', eh_event_hub_util, resource_type=ResourceType.MGMT_EVENTHUB, client_factory=event_hub_mgmt_client_factory) as g: g.custom_command('create', 'cli_eheventhub_create') g.show_command('show', 'get') g.command('list', 'list_by_namespace') g.command('delete', 'delete') g.generic_update_command('update', custom_func_name='cli_eheventhub_update') with self.command_group('eventhubs eventhub authorization-rule', eh_event_hub_util, resource_type=ResourceType.MGMT_EVENTHUB, client_factory=event_hub_mgmt_client_factory) as g: g.custom_command('create', 'cli_eventhubautho_create') g.show_command('show', 'get_authorization_rule') g.command('list', 'list_authorization_rules') g.command('keys list', 'list_keys') g.custom_command('keys renew', 'cli_eventhub_keys_renew') g.command('delete', 'delete_authorization_rule') g.generic_update_command( 'update', getter_name='get_authorization_rule', setter_name='create_or_update_authorization_rule', custom_func_name='cli_autho_update') # ConsumerGroup Region with self.command_group( 'eventhubs eventhub consumer-group', eh_consumer_groups_util, resource_type=ResourceType.MGMT_EVENTHUB, client_factory=consumer_groups_mgmt_client_factory) as g: g.custom_command('create', 'cli_consumergroup_create') g.show_command('show', 'get') g.command('list', 'list_by_event_hub') g.command('delete', 'delete') g.generic_update_command('update', custom_func_name='cli_consumergroup_update', custom_func_type=eventhubs_custom) # DisasterRecoveryConfigs Region with self.command_group( 'eventhubs georecovery-alias', eh_geodr_util, resource_type=ResourceType.MGMT_EVENTHUB, client_factory=disaster_recovery_mgmt_client_factory) as g: g.custom_command('set', 'cli_geodr_create') g.show_command('show', 'get') g.command('list', 'list') g.command('break-pair', 'break_pairing') g.command('fail-over', 'fail_over') g.custom_command('exists', 'cli_geodr_name_exists') g.command('delete', 'delete') with self.command_group( 'eventhubs georecovery-alias authorization-rule', eh_geodr_util, resource_type=ResourceType.MGMT_EVENTHUB, client_factory=disaster_recovery_mgmt_client_factory) as g: g.command('list', 'list_authorization_rules') g.show_command('show', 'get_authorization_rule') g.command('keys list', 'list_keys') # NetwrokRuleSet Region with self.command_group( 'eventhubs namespace network-rule', eh_namespace_util, min_api='2021-06-01-preview', resource_type=ResourceType.MGMT_EVENTHUB, client_factory=namespaces_mgmt_client_factory) as g: g.custom_command('add', 'cli_networkrule_createupdate', validator=validate_subnet) g.show_command('list', 'get_network_rule_set') g.custom_command('remove', 'cli_networkrule_delete', validator=validate_subnet) # Identity Region with self.command_group( 'eventhubs namespace identity', eh_namespace_util, min_api='2021-06-01-preview', resource_type=ResourceType.MGMT_EVENTHUB, client_factory=namespaces_mgmt_client_factory) as g: g.custom_command('assign', 'cli_add_identity') g.custom_command('remove', 'cli_remove_identity') # Encryption Region with self.command_group( 'eventhubs namespace encryption', eh_namespace_util, min_api='2021-06-01-preview', resource_type=ResourceType.MGMT_EVENTHUB, client_factory=namespaces_mgmt_client_factory) as g: g.custom_command('add', 'cli_add_encryption') g.custom_command('remove', 'cli_remove_encryption')
def load_command_table(self, _): mgmt_api_version = str( get_api_version(self.cli_ctx, ResourceType.MGMT_KEYVAULT)) mgmt_api_version = mgmt_api_version.replace('-', '_') data_api_version = str( get_api_version(self.cli_ctx, ResourceType.DATA_KEYVAULT)) data_api_version = data_api_version.replace('.', '_') data_api_version = data_api_version.replace('-', '_') data_doc_string = 'azure.keyvault.v' + data_api_version + '.key_vault_client#KeyVaultClient.{}' # region Command Types kv_vaults_custom = CliCommandType( operations_tmpl='azure.cli.command_modules.keyvault.custom#{}', client_factory=keyvault_client_vaults_factory) kv_vaults_sdk = CliCommandType( operations_tmpl='azure.mgmt.keyvault.operations#VaultsOperations.{}', client_factory=keyvault_client_vaults_factory, resource_type=ResourceType.MGMT_KEYVAULT) kv_private_endpoint_connections_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.keyvault.operations#PrivateEndpointConnectionsOperations.{}', client_factory=keyvault_client_private_endpoint_connections_factory, resource_type=ResourceType.MGMT_KEYVAULT) kv_private_link_resources_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.keyvault.operations#PrivateLinkResourcesOperations.{}', client_factory=keyvault_client_private_link_resources_factory, resource_type=ResourceType.MGMT_KEYVAULT) kv_data_sdk = CliCommandType( operations_tmpl='azure.keyvault.key_vault_client#KeyVaultClient.{}', client_factory=keyvault_data_plane_factory, resource_type=ResourceType.DATA_KEYVAULT) # endregion # Management Plane Commands with self.command_group( 'keyvault', kv_vaults_sdk, client_factory=keyvault_client_vaults_factory) as g: g.custom_command('create', 'create_keyvault', doc_string_source='azure.mgmt.keyvault.v' + mgmt_api_version + '.models#VaultProperties') g.custom_command('recover', 'recover_keyvault') g.custom_command('list', 'list_keyvault') g.show_command('show', 'get') g.command('delete', 'delete') g.command('purge', 'purge_deleted') g.custom_command('set-policy', 'set_policy') g.custom_command('delete-policy', 'delete_policy') g.command('list-deleted', 'list_deleted') g.generic_update_command('update', setter_name='update_keyvault_setter', setter_type=kv_vaults_custom, custom_func_name='update_keyvault') with self.command_group( 'keyvault network-rule', kv_vaults_sdk, min_api='2018-02-14', client_factory=keyvault_client_vaults_factory) as g: g.custom_command('add', 'add_network_rule') g.custom_command('remove', 'remove_network_rule') g.custom_command('list', 'list_network_rules') with self.command_group( 'keyvault private-endpoint-connection', kv_private_endpoint_connections_sdk, min_api='2018-02-14', client_factory=keyvault_client_private_endpoint_connections_factory, is_preview=True) as g: g.custom_command('approve', 'approve_private_endpoint_connection', supports_no_wait=True, validator=validate_private_endpoint_connection_id) g.custom_command('reject', 'reject_private_endpoint_connection', supports_no_wait=True, validator=validate_private_endpoint_connection_id) g.command('delete', 'delete', validator=validate_private_endpoint_connection_id) g.show_command('show', 'get', validator=validate_private_endpoint_connection_id) g.wait_command('wait', validator=validate_private_endpoint_connection_id) with self.command_group( 'keyvault private-link-resource', kv_private_link_resources_sdk, min_api='2018-02-14', client_factory=keyvault_client_private_link_resources_factory, is_preview=True) as g: from azure.cli.core.commands.transform import gen_dict_to_list_transform g.command('list', 'list_by_vault', transform=gen_dict_to_list_transform(key='value')) # Data Plane Commands with self.command_group('keyvault key', kv_data_sdk) as g: g.keyvault_command('list', 'get_keys') g.keyvault_command('list-versions', 'get_key_versions') g.keyvault_command('list-deleted', 'get_deleted_keys') g.keyvault_custom( 'create', 'create_key', doc_string_source=data_doc_string.format('create_key')) g.keyvault_command('set-attributes', 'update_key') g.keyvault_command('show', 'get_key') g.keyvault_command('show-deleted', 'get_deleted_key') g.keyvault_command('delete', 'delete_key') g.keyvault_command('purge', 'purge_deleted_key') g.keyvault_command('recover', 'recover_deleted_key') g.keyvault_custom( 'backup', 'backup_key', doc_string_source=data_doc_string.format('backup_key')) g.keyvault_custom( 'restore', 'restore_key', doc_string_source=data_doc_string.format('restore_key')) g.keyvault_custom('import', 'import_key') g.keyvault_custom('download', 'download_key') with self.command_group('keyvault secret', kv_data_sdk) as g: g.keyvault_command('list', 'get_secrets') g.keyvault_command('list-versions', 'get_secret_versions') g.keyvault_command('list-deleted', 'get_deleted_secrets') g.keyvault_command('set', 'set_secret', validator=process_secret_set_namespace) g.keyvault_command('set-attributes', 'update_secret') g.keyvault_command('show', 'get_secret') g.keyvault_command('show-deleted', 'get_deleted_secret') g.keyvault_command('delete', 'delete_secret') g.keyvault_command('purge', 'purge_deleted_secret') g.keyvault_command('recover', 'recover_deleted_secret') g.keyvault_custom('download', 'download_secret') g.keyvault_custom( 'backup', 'backup_secret', doc_string_source=data_doc_string.format('backup_secret')) g.keyvault_custom( 'restore', 'restore_secret', doc_string_source=data_doc_string.format('restore_secret')) with self.command_group('keyvault certificate', kv_data_sdk) as g: g.keyvault_custom( 'create', 'create_certificate', doc_string_source=data_doc_string.format('create_certificate')) g.keyvault_command('list', 'get_certificates') g.keyvault_command('list-versions', 'get_certificate_versions') g.keyvault_command('list-deleted', 'get_deleted_certificates') g.keyvault_command('show', 'get_certificate') g.keyvault_command('show-deleted', 'get_deleted_certificate') g.keyvault_command('delete', 'delete_certificate') g.keyvault_command('purge', 'purge_deleted_certificate') g.keyvault_command('recover', 'recover_deleted_certificate') g.keyvault_command('set-attributes', 'update_certificate') g.keyvault_custom('import', 'import_certificate') g.keyvault_custom('download', 'download_certificate') g.keyvault_custom('get-default-policy', 'get_default_policy') with self.command_group('keyvault certificate pending', kv_data_sdk) as g: g.keyvault_command('merge', 'merge_certificate') g.keyvault_command('show', 'get_certificate_operation') g.keyvault_command('delete', 'delete_certificate_operation', validator=process_certificate_cancel_namespace) with self.command_group('keyvault certificate contact', kv_data_sdk) as g: g.keyvault_command('list', 'get_certificate_contacts') g.keyvault_custom('add', 'add_certificate_contact') g.keyvault_custom('delete', 'delete_certificate_contact') with self.command_group('keyvault certificate issuer', kv_data_sdk) as g: g.keyvault_custom('update', 'update_certificate_issuer') g.keyvault_command('list', 'get_certificate_issuers') g.keyvault_custom('create', 'create_certificate_issuer') g.keyvault_command('show', 'get_certificate_issuer') g.keyvault_command('delete', 'delete_certificate_issuer') with self.command_group('keyvault certificate issuer admin', kv_data_sdk) as g: g.keyvault_custom('list', 'list_certificate_issuer_admins') g.keyvault_custom('add', 'add_certificate_issuer_admin') g.keyvault_custom('delete', 'delete_certificate_issuer_admin') if data_api_version != '2016_10_01': with self.command_group('keyvault storage', kv_data_sdk) as g: g.keyvault_command('add', 'set_storage_account') g.keyvault_command('list', 'get_storage_accounts') g.keyvault_command('show', 'get_storage_account') g.keyvault_command('update', 'update_storage_account') g.keyvault_command('remove', 'delete_storage_account') g.keyvault_command('regenerate-key', 'regenerate_storage_account_key') g.keyvault_command('list-deleted', 'get_deleted_storage_accounts') g.keyvault_command('show-deleted', 'get_deleted_storage_account') g.keyvault_command('purge', 'purge_deleted_storage_account') g.keyvault_command('recover', 'recover_deleted_storage_account') g.keyvault_custom('backup', 'backup_storage_account', doc_string_source=data_doc_string.format( 'backup_storage_account')) g.keyvault_custom('restore', 'restore_storage_account', doc_string_source=data_doc_string.format( 'restore_storage_account')) if data_api_version != '2016_10_01': with self.command_group('keyvault storage sas-definition', kv_data_sdk) as g: g.keyvault_command( 'create', 'set_sas_definition', doc_string_source=data_doc_string.format('set_sas_definition')) g.keyvault_command('list', 'get_sas_definitions') g.keyvault_command('show', 'get_sas_definition') g.keyvault_command('update', 'update_sas_definition', doc_string_source=data_doc_string.format( 'update_sas_definition')) g.keyvault_command('delete', 'delete_sas_definition') g.keyvault_command('list-deleted', 'get_deleted_sas_definitions') g.keyvault_command('show-deleted', 'get_deleted_sas_definition') g.keyvault_command('recover', 'recover_deleted_sas_definition')
def load_command_table(self, _): mgmt_api_version = str(get_api_version(self.cli_ctx, ResourceType.MGMT_KEYVAULT)) mgmt_api_version = mgmt_api_version.replace('-', '_') data_api_version = str(get_api_version(self.cli_ctx, ResourceType.DATA_KEYVAULT)) data_api_version = data_api_version.replace('.', '_') data_api_version = data_api_version.replace('-', '_') data_doc_string = 'azure.keyvault.v' + data_api_version + '.key_vault_client#KeyVaultClient.{}' # region Command Types kv_vaults_custom = CliCommandType( operations_tmpl='azure.cli.command_modules.keyvault.custom#{}', client_factory=keyvault_client_vaults_factory ) kv_vaults_sdk = CliCommandType( operations_tmpl='azure.mgmt.keyvault.operations#VaultsOperations.{}', client_factory=keyvault_client_vaults_factory, resource_type=ResourceType.MGMT_KEYVAULT ) kv_private_endpoint_connections_sdk = CliCommandType( operations_tmpl='azure.mgmt.keyvault.operations#PrivateEndpointConnectionsOperations.{}', client_factory=keyvault_client_private_endpoint_connections_factory, resource_type=ResourceType.MGMT_KEYVAULT ) kv_private_link_resources_sdk = CliCommandType( operations_tmpl='azure.mgmt.keyvault.operations#PrivateLinkResourcesOperations.{}', client_factory=keyvault_client_private_link_resources_factory, resource_type=ResourceType.MGMT_KEYVAULT ) kv_data_sdk = CliCommandType( operations_tmpl='azure.keyvault.key_vault_client#KeyVaultClient.{}', client_factory=keyvault_data_plane_factory, resource_type=ResourceType.DATA_KEYVAULT ) # endregion # Management Plane Commands with self.command_group('keyvault', kv_vaults_sdk, client_factory=keyvault_client_vaults_factory) as g: g.custom_command('create', 'create_keyvault', supports_no_wait=True, doc_string_source='azure.mgmt.keyvault.v' + mgmt_api_version + '.models#VaultProperties') g.custom_command('recover', 'recover_keyvault', supports_no_wait=True) g.custom_command('list', 'list_keyvault') g.show_command('show', 'get') g.command('delete', 'delete', deprecate_info=g.deprecate( tag_func=lambda x: '', message_func=lambda x: 'Warning! If you have soft-delete protection enabled on this key vault, you will ' 'not be able to reuse this key vault name until the key vault has been purged from ' 'the soft deleted state. Please see the following documentation for additional ' 'guidance.\n' 'https://docs.microsoft.com/en-us/azure/key-vault/general/soft-delete-overview')) g.command('purge', 'begin_purge_deleted', supports_no_wait=True) g.custom_command('set-policy', 'set_policy', supports_no_wait=True) g.custom_command('delete-policy', 'delete_policy', supports_no_wait=True) g.command('list-deleted', 'list_deleted') g.generic_update_command( 'update', setter_name='update_keyvault_setter', setter_type=kv_vaults_custom, custom_func_name='update_keyvault', doc_string_source='azure.mgmt.keyvault.v' + mgmt_api_version + '.models#VaultProperties', supports_no_wait=True) g.wait_command('wait') with self.command_group('keyvault network-rule', kv_vaults_sdk, min_api='2018-02-14', client_factory=keyvault_client_vaults_factory) as g: g.custom_command('add', 'add_network_rule', supports_no_wait=True) g.custom_command('remove', 'remove_network_rule', supports_no_wait=True) g.custom_command('list', 'list_network_rules') g.wait_command('wait') with self.command_group('keyvault private-endpoint-connection', kv_private_endpoint_connections_sdk, min_api='2018-02-14', client_factory=keyvault_client_private_endpoint_connections_factory, is_preview=True) as g: g.custom_command('approve', 'approve_private_endpoint_connection', supports_no_wait=True, validator=validate_private_endpoint_connection_id) g.custom_command('reject', 'reject_private_endpoint_connection', supports_no_wait=True, validator=validate_private_endpoint_connection_id) g.command('delete', 'begin_delete', validator=validate_private_endpoint_connection_id, supports_no_wait=True) g.show_command('show', 'get', validator=validate_private_endpoint_connection_id) g.wait_command('wait', validator=validate_private_endpoint_connection_id) with self.command_group('keyvault private-link-resource', kv_private_link_resources_sdk, min_api='2018-02-14', client_factory=keyvault_client_private_link_resources_factory, is_preview=True) as g: from azure.cli.core.commands.transform import gen_dict_to_list_transform g.command('list', 'list_by_vault', transform=gen_dict_to_list_transform(key='value')) # Data Plane Commands with self.command_group('keyvault key', kv_data_sdk) as g: g.keyvault_command('list', 'get_keys', transform=multi_transformers( filter_out_managed_resources, extract_subresource_name(id_parameter='kid'))) g.keyvault_command('list-versions', 'get_key_versions', transform=extract_subresource_name(id_parameter='kid')) g.keyvault_command('list-deleted', 'get_deleted_keys', transform=extract_subresource_name(id_parameter='kid')) g.keyvault_custom('create', 'create_key', doc_string_source=data_doc_string.format('create_key')) g.keyvault_command('set-attributes', 'update_key') g.keyvault_command('show', 'get_key') g.keyvault_command('show-deleted', 'get_deleted_key') g.keyvault_command('delete', 'delete_key', deprecate_info=g.deprecate( tag_func=lambda x: '', message_func=lambda x: 'Warning! If you have soft-delete protection enabled on this key vault, this key ' 'will be moved to the soft deleted state. You will not be able to create a key with ' 'the same name within this key vault until the key has been purged from the ' 'soft-deleted state. Please see the following documentation for additional ' 'guidance.\n' 'https://docs.microsoft.com/en-us/azure/key-vault/general/soft-delete-overview')) g.keyvault_command('purge', 'purge_deleted_key') g.keyvault_command('recover', 'recover_deleted_key') g.keyvault_custom('backup', 'backup_key', doc_string_source=data_doc_string.format('backup_key')) g.keyvault_custom('restore', 'restore_key', doc_string_source=data_doc_string.format('restore_key')) g.keyvault_custom('import', 'import_key') g.keyvault_custom('download', 'download_key') g.keyvault_command('encrypt', 'encrypt', is_preview=True) g.keyvault_command('decrypt', 'decrypt', transform=transform_key_decryption_output, is_preview=True) with self.command_group('keyvault secret', kv_data_sdk) as g: g.keyvault_command('list', 'get_secrets', transform=multi_transformers(filter_out_managed_resources, extract_subresource_name())) g.keyvault_command('list-versions', 'get_secret_versions', transform=extract_subresource_name()) g.keyvault_command('list-deleted', 'get_deleted_secrets', transform=extract_subresource_name()) g.keyvault_command('set', 'set_secret', validator=process_secret_set_namespace, transform=extract_subresource_name()) g.keyvault_command('set-attributes', 'update_secret', transform=extract_subresource_name()) g.keyvault_command('show', 'get_secret', transform=extract_subresource_name()) g.keyvault_command('show-deleted', 'get_deleted_secret', transform=extract_subresource_name()) g.keyvault_command('delete', 'delete_secret', transform=extract_subresource_name(), deprecate_info=g.deprecate( tag_func=lambda x: '', message_func=lambda x: 'Warning! If you have soft-delete protection enabled on this key vault, this secret ' 'will be moved to the soft deleted state. You will not be able to create a secret ' 'with the same name within this key vault until the secret has been purged from the ' 'soft-deleted state. Please see the following documentation for additional guidance.' '\nhttps://docs.microsoft.com/en-us/azure/key-vault/general/soft-delete-overview')) g.keyvault_command('purge', 'purge_deleted_secret') g.keyvault_command('recover', 'recover_deleted_secret', transform=extract_subresource_name()) g.keyvault_custom('download', 'download_secret') g.keyvault_custom('backup', 'backup_secret', doc_string_source=data_doc_string.format('backup_secret')) g.keyvault_custom('restore', 'restore_secret', doc_string_source=data_doc_string.format('restore_secret'), transform=extract_subresource_name()) with self.command_group('keyvault certificate', kv_data_sdk) as g: g.keyvault_custom('create', 'create_certificate', doc_string_source=data_doc_string.format('create_certificate'), transform=extract_subresource_name()) g.keyvault_command('list', 'get_certificates', transform=extract_subresource_name()) g.keyvault_command('list-versions', 'get_certificate_versions', transform=extract_subresource_name()) g.keyvault_command('list-deleted', 'get_deleted_certificates', transform=extract_subresource_name()) g.keyvault_command('show', 'get_certificate', transform=extract_subresource_name()) g.keyvault_command('show-deleted', 'get_deleted_certificate', transform=extract_subresource_name()) g.keyvault_command('delete', 'delete_certificate', deprecate_info=g.deprecate( tag_func=lambda x: '', message_func=lambda x: 'Warning! If you have soft-delete protection enabled on this key vault, this ' 'certificate will be moved to the soft deleted state. You will not be able to ' 'create a certificate with the same name within this key vault until the ' 'certificate has been purged from the soft-deleted state. Please see the following ' 'documentation for additional guidance.\n' 'https://docs.microsoft.com/en-us/azure/key-vault/general/soft-delete-overview'), transform=extract_subresource_name()) g.keyvault_command('purge', 'purge_deleted_certificate') g.keyvault_command('recover', 'recover_deleted_certificate', transform=extract_subresource_name()) g.keyvault_command('set-attributes', 'update_certificate', transform=extract_subresource_name()) g.keyvault_custom('import', 'import_certificate', transform=extract_subresource_name()) g.keyvault_custom('download', 'download_certificate') g.keyvault_custom('get-default-policy', 'get_default_policy') with self.command_group('keyvault certificate pending', kv_data_sdk) as g: g.keyvault_command('merge', 'merge_certificate', transform=extract_subresource_name()) g.keyvault_command('show', 'get_certificate_operation', transform=extract_subresource_name()) g.keyvault_command('delete', 'delete_certificate_operation', validator=process_certificate_cancel_namespace, transform=extract_subresource_name()) with self.command_group('keyvault certificate contact', kv_data_sdk) as g: g.keyvault_command('list', 'get_certificate_contacts') g.keyvault_custom('add', 'add_certificate_contact') g.keyvault_custom('delete', 'delete_certificate_contact') with self.command_group('keyvault certificate issuer', kv_data_sdk) as g: g.keyvault_custom('update', 'update_certificate_issuer') g.keyvault_command('list', 'get_certificate_issuers') g.keyvault_custom('create', 'create_certificate_issuer') g.keyvault_command('show', 'get_certificate_issuer') g.keyvault_command('delete', 'delete_certificate_issuer') with self.command_group('keyvault certificate issuer admin', kv_data_sdk) as g: g.keyvault_custom('list', 'list_certificate_issuer_admins') g.keyvault_custom('add', 'add_certificate_issuer_admin') g.keyvault_custom('delete', 'delete_certificate_issuer_admin') if data_api_version != '2016_10_01': with self.command_group('keyvault certificate', kv_data_sdk) as g: g.keyvault_custom('backup', 'backup_certificate', doc_string_source=data_doc_string.format('backup_certificate')) g.keyvault_custom('restore', 'restore_certificate', doc_string_source=data_doc_string.format('restore_certificate')) if data_api_version != '2016_10_01': with self.command_group('keyvault storage', kv_data_sdk) as g: g.keyvault_command('add', 'set_storage_account') g.keyvault_command('list', 'get_storage_accounts') g.keyvault_command('show', 'get_storage_account') g.keyvault_command('update', 'update_storage_account') g.keyvault_command('remove', 'delete_storage_account') g.keyvault_command('regenerate-key', 'regenerate_storage_account_key') g.keyvault_command('list-deleted', 'get_deleted_storage_accounts') g.keyvault_command('show-deleted', 'get_deleted_storage_account') g.keyvault_command('purge', 'purge_deleted_storage_account') g.keyvault_command('recover', 'recover_deleted_storage_account') g.keyvault_custom('backup', 'backup_storage_account', doc_string_source=data_doc_string.format('backup_storage_account')) g.keyvault_custom('restore', 'restore_storage_account', doc_string_source=data_doc_string.format('restore_storage_account')) if data_api_version != '2016_10_01': with self.command_group('keyvault storage sas-definition', kv_data_sdk) as g: g.keyvault_command('create', 'set_sas_definition', doc_string_source=data_doc_string.format('set_sas_definition')) g.keyvault_command('list', 'get_sas_definitions') g.keyvault_command('show', 'get_sas_definition') g.keyvault_command('update', 'update_sas_definition', doc_string_source=data_doc_string.format('update_sas_definition')) g.keyvault_command('delete', 'delete_sas_definition') g.keyvault_command('list-deleted', 'get_deleted_sas_definitions') g.keyvault_command('show-deleted', 'get_deleted_sas_definition') g.keyvault_command('recover', 'recover_deleted_sas_definition')
def load_command_table(self, _): # pylint: disable=too-many-locals, too-many-statements storage_account_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.storage.operations#StorageAccountsOperations.{}', client_factory=cf_sa, resource_type=ResourceType.MGMT_STORAGE) blob_service_mgmt_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.storage.operations#BlobServicesOperations.{}', client_factory=cf_mgmt_blob_services, resource_type=ResourceType.MGMT_STORAGE) file_shares_mgmt_sdk = CliCommandType( operations_tmpl='azure.mgmt.storage.operations#FileSharesOperations.{}', client_factory=cf_mgmt_file_shares, resource_type=ResourceType.MGMT_STORAGE) storage_account_sdk_keys = CliCommandType( operations_tmpl= 'azure.mgmt.storage.operations#StorageAccountsOperations.{}', client_factory=cf_sa_for_keys, resource_type=ResourceType.MGMT_STORAGE) private_link_resource_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.storage.operations#PrivateLinkResourcesOperations.{}', client_factory=cf_private_link, resource_type=ResourceType.MGMT_STORAGE) private_endpoint_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.storage.operations#PrivateEndpointConnectionsOperations.{}', client_factory=cf_private_endpoint, resource_type=ResourceType.MGMT_STORAGE) private_endpoint_custom_type = CliCommandType( operations_tmpl= 'azure.cli.command_modules.storage.operations.account#{}', client_factory=cf_private_endpoint, resource_type=ResourceType.MGMT_STORAGE) storage_account_custom_type = CliCommandType( operations_tmpl= 'azure.cli.command_modules.storage.operations.account#{}', client_factory=cf_sa) cloud_data_plane_sdk = CliCommandType( operations_tmpl='azure.multiapi.storage.common#CloudStorageAccount.{}', client_factory=cloud_storage_account_service_factory) block_blob_sdk = CliCommandType( operations_tmpl= 'azure.multiapi.storage.blob.blockblobservice#BlockBlobService.{}', client_factory=blob_data_service_factory, resource_type=ResourceType.DATA_STORAGE) def get_custom_sdk(custom_module, client_factory, resource_type=ResourceType.DATA_STORAGE): """Returns a CliCommandType instance with specified operation template based on the given custom module name. This is useful when the command is not defined in the default 'custom' module but instead in a module under 'operations' package.""" return CliCommandType( operations_tmpl='azure.cli.command_modules.storage.operations.{}#'. format(custom_module) + '{}', client_factory=client_factory, resource_type=resource_type) with self.command_group('storage', command_type=block_blob_sdk, custom_command_type=get_custom_sdk( 'azcopy', blob_data_service_factory)) as g: g.storage_custom_command('remove', 'storage_remove', is_preview=True) with self.command_group('storage', custom_command_type=get_custom_sdk('azcopy', None)) as g: g.custom_command('copy', 'storage_copy', is_preview=True) with self.command_group( 'storage account', storage_account_sdk, resource_type=ResourceType.MGMT_STORAGE, custom_command_type=storage_account_custom_type) as g: g.command('check-name', 'check_name_availability') g.custom_command('create', 'create_storage_account') g.command('delete', 'delete', confirmation=True) g.show_command('show', 'get_properties') g.custom_command('list', 'list_storage_accounts') g.custom_command('show-usage', 'show_storage_account_usage', min_api='2018-02-01') g.custom_command('show-usage', 'show_storage_account_usage_no_location', max_api='2017-10-01') g.custom_command('show-connection-string', 'show_storage_account_connection_string') g.generic_update_command('update', getter_name='get_properties', setter_name='update', custom_func_name='update_storage_account', min_api='2016-12-01') with self.command_group('storage account', storage_account_sdk_keys, resource_type=ResourceType.MGMT_STORAGE) as g: from ._validators import validate_key_name g.command('keys renew', 'regenerate_key', validator=validate_key_name, transform=lambda x: getattr(x, 'keys', x)) g.command('keys list', 'list_keys', transform=lambda x: getattr(x, 'keys', x)) g.command('revoke-delegation-keys', 'revoke_user_delegation_keys', min_api='2019-04-01') with self.command_group('storage account', cloud_data_plane_sdk) as g: g.storage_command('generate-sas', 'generate_shared_access_signature') management_policy_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.storage.operations#ManagementPoliciesOperations.{}', client_factory=cf_mgmt_policy, resource_type=ResourceType.MGMT_STORAGE) management_policy_custom_type = CliCommandType( operations_tmpl= 'azure.cli.command_modules.storage.operations.account#{}', client_factory=cf_mgmt_policy) storage_blob_custom_type = CliCommandType( operations_tmpl='azure.cli.command_modules.storage.operations.blob#{}', client_factory=cf_sa, resource_type=ResourceType.MGMT_STORAGE) with self.command_group( 'storage account management-policy', management_policy_sdk, resource_type=ResourceType.MGMT_STORAGE, min_api='2018-11-01', custom_command_type=management_policy_custom_type) as g: g.show_command('show', 'get') g.custom_command('create', 'create_management_policies') g.generic_update_command('update', getter_name='get', setter_name='update_management_policies', setter_type=management_policy_custom_type) g.command('delete', 'delete') with self.command_group('storage account network-rule', storage_account_sdk, custom_command_type=storage_account_custom_type, resource_type=ResourceType.MGMT_STORAGE, min_api='2017-06-01') as g: g.custom_command('add', 'add_network_rule') g.custom_command('list', 'list_network_rules') g.custom_command('remove', 'remove_network_rule') with self.command_group('storage account private-endpoint-connection', private_endpoint_sdk, custom_command_type=private_endpoint_custom_type, is_preview=True, resource_type=ResourceType.MGMT_STORAGE, min_api='2019-06-01') as g: from ._validators import validate_private_endpoint_connection_id g.command('delete', 'delete', confirmation=True, validator=validate_private_endpoint_connection_id) g.command('show', 'get', validator=validate_private_endpoint_connection_id) g.custom_command('approve', 'approve_private_endpoint_connection', validator=validate_private_endpoint_connection_id) g.custom_command('reject', 'reject_private_endpoint_connection', validator=validate_private_endpoint_connection_id) with self.command_group('storage account private-link-resource', private_link_resource_sdk, resource_type=ResourceType.MGMT_STORAGE) as g: from azure.cli.core.commands.transform import gen_dict_to_list_transform g.command('list', 'list_by_storage_account', is_preview=True, min_api='2019-06-01', transform=gen_dict_to_list_transform(key="value")) with self.command_group('storage account blob-service-properties', blob_service_mgmt_sdk, custom_command_type=storage_account_custom_type, resource_type=ResourceType.MGMT_STORAGE, min_api='2018-07-01', is_preview=True) as g: g.show_command('show', 'get_service_properties') g.generic_update_command( 'update', getter_name='get_service_properties', setter_name='set_service_properties', custom_func_name='update_blob_service_properties') with self.command_group( 'storage logging', get_custom_sdk('logging', multi_service_properties_factory)) as g: from ._transformers import transform_logging_list_output g.storage_command('update', 'set_logging') g.storage_command('show', 'get_logging', table_transformer=transform_logging_list_output, exception_handler=show_exception_handler) with self.command_group( 'storage metrics', get_custom_sdk('metrics', multi_service_properties_factory)) as g: from ._transformers import transform_metrics_list_output g.storage_command('update', 'set_metrics') g.storage_command('show', 'get_metrics', table_transformer=transform_metrics_list_output, exception_handler=show_exception_handler) base_blob_sdk = CliCommandType( operations_tmpl= 'azure.multiapi.storage.blob.baseblobservice#BaseBlobService.{}', client_factory=blob_data_service_factory, resource_type=ResourceType.DATA_STORAGE) with self.command_group('storage blob', command_type=block_blob_sdk, custom_command_type=get_custom_sdk( 'blob', blob_data_service_factory)) as g: from ._format import transform_boolean_for_table, transform_blob_output from ._transformers import (transform_storage_list_output, transform_url, create_boolean_result_output_transformer) from ._validators import (process_blob_download_batch_parameters, process_blob_delete_batch_parameters, process_blob_upload_batch_parameters) g.storage_command_oauth('list', 'list_blobs', transform=transform_storage_list_output, table_transformer=transform_blob_output) g.storage_command_oauth('download', 'get_blob_to_path', table_transformer=transform_blob_output) g.storage_custom_command_oauth('generate-sas', 'generate_sas_blob_uri') g.storage_custom_command_oauth('url', 'create_blob_url', transform=transform_url) g.storage_command_oauth('snapshot', 'snapshot_blob') g.storage_command_oauth('update', 'set_blob_properties') g.storage_command_oauth( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists')) g.storage_command_oauth('delete', 'delete_blob') g.storage_command_oauth( 'undelete', 'undelete_blob', transform=create_boolean_result_output_transformer('undeleted'), table_transformer=transform_boolean_for_table, min_api='2017-07-29') g.storage_custom_command_oauth('set-tier', 'set_blob_tier') g.storage_custom_command_oauth( 'upload', 'upload_blob', doc_string_source='blob#BlockBlobService.create_blob_from_path') g.storage_custom_command_oauth( 'upload-batch', 'storage_blob_upload_batch', validator=process_blob_upload_batch_parameters) g.storage_custom_command_oauth( 'download-batch', 'storage_blob_download_batch', validator=process_blob_download_batch_parameters) g.storage_custom_command_oauth( 'delete-batch', 'storage_blob_delete_batch', validator=process_blob_delete_batch_parameters) g.storage_custom_command_oauth( 'show', 'show_blob', table_transformer=transform_blob_output, client_factory=page_blob_service_factory, doc_string_source='blob#PageBlobService.get_blob_properties', exception_handler=show_exception_handler) g.storage_command_oauth('metadata show', 'get_blob_metadata', exception_handler=show_exception_handler) g.storage_command_oauth('metadata update', 'set_blob_metadata') g.storage_command_oauth('lease acquire', 'acquire_blob_lease') g.storage_command_oauth('lease renew', 'renew_blob_lease') g.storage_command_oauth('lease release', 'release_blob_lease') g.storage_command_oauth('lease change', 'change_blob_lease') g.storage_command_oauth('lease break', 'break_blob_lease') g.storage_command_oauth('copy start', 'copy_blob') g.storage_command_oauth('copy cancel', 'abort_copy_blob') g.storage_custom_command_oauth('copy start-batch', 'storage_blob_copy_batch') with self.command_group('storage blob', storage_account_sdk, resource_type=ResourceType.MGMT_STORAGE, custom_command_type=storage_blob_custom_type) as g: g.custom_command('restore', 'restore_blob_ranges', min_api='2019-06-01', is_preview=True, supports_no_wait=True) with self.command_group( 'storage blob incremental-copy', operations_tmpl= 'azure.multiapi.storage.blob.pageblobservice#PageBlobService.{}', client_factory=page_blob_service_factory, resource_type=ResourceType.DATA_STORAGE, min_api='2016-05-31') as g: g.storage_command_oauth('start', 'incremental_copy_blob') with self.command_group( 'storage blob incremental-copy', operations_tmpl= 'azure.multiapi.storage.blob.blockblobservice#BlockBlobService.{}', client_factory=page_blob_service_factory, resource_type=ResourceType.DATA_STORAGE, min_api='2016-05-31') as g: g.storage_command_oauth('cancel', 'abort_copy_blob') with self.command_group('storage blob service-properties delete-policy', command_type=base_blob_sdk, min_api='2017-07-29', custom_command_type=get_custom_sdk( 'blob', blob_data_service_factory)) as g: g.storage_command_oauth( 'show', 'get_blob_service_properties', transform=lambda x: getattr(x, 'delete_retention_policy', x), exception_handler=show_exception_handler) g.storage_custom_command_oauth('update', 'set_delete_policy') with self.command_group('storage blob service-properties', command_type=base_blob_sdk) as g: g.storage_command_oauth('show', 'get_blob_service_properties', exception_handler=show_exception_handler) g.storage_command_oauth('update', generic_update=True, getter_name='get_blob_service_properties', setter_type=get_custom_sdk( 'blob', cf_blob_data_gen_update), setter_name='set_service_properties', client_factory=cf_blob_data_gen_update) with self.command_group('storage blob', command_type=block_blob_sdk, custom_command_type=get_custom_sdk( 'azcopy', blob_data_service_factory)) as g: g.storage_custom_command_oauth('sync', 'storage_blob_sync', is_preview=True) with self.command_group('storage container', command_type=block_blob_sdk, custom_command_type=get_custom_sdk( 'blob', blob_data_service_factory)) as g: from azure.cli.command_modules.storage._transformers import ( transform_storage_list_output, transform_container_permission_output, transform_acl_list_output) from azure.cli.command_modules.storage._format import ( transform_container_list, transform_boolean_for_table, transform_container_show) from ._validators import process_container_delete_parameters g.storage_command_oauth('list', 'list_containers', transform=transform_storage_list_output, table_transformer=transform_container_list) g.storage_custom_command_oauth( 'delete', 'delete_container', validator=process_container_delete_parameters, transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) g.storage_command_oauth('show', 'get_container_properties', table_transformer=transform_container_show, exception_handler=show_exception_handler) g.storage_command_oauth( 'create', 'create_container', transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) g.storage_custom_command_oauth( 'generate-sas', 'generate_container_shared_access_signature', min_api='2018-11-09') g.storage_command_oauth('generate-sas', 'generate_container_shared_access_signature', max_api='2018-03-28') g.storage_command_oauth( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists'), table_transformer=transform_boolean_for_table) g.storage_command_oauth('set-permission', 'set_container_acl') g.storage_command_oauth( 'show-permission', 'get_container_acl', transform=transform_container_permission_output) g.storage_command_oauth('metadata update', 'set_container_metadata') g.storage_command_oauth('metadata show', 'get_container_metadata', exception_handler=show_exception_handler) g.storage_command_oauth('lease acquire', 'acquire_container_lease') g.storage_command_oauth('lease renew', 'renew_container_lease') g.storage_command_oauth('lease release', 'release_container_lease') g.storage_command_oauth('lease change', 'change_container_lease') g.storage_command_oauth('lease break', 'break_container_lease') with self.command_group('storage container', command_type=block_blob_sdk, custom_command_type=get_custom_sdk( 'acl', blob_data_service_factory)) as g: g.storage_custom_command_oauth('policy create', 'create_acl_policy') g.storage_custom_command_oauth('policy delete', 'delete_acl_policy') g.storage_custom_command_oauth('policy update', 'set_acl_policy', min_api='2017-04-17') g.storage_custom_command_oauth( 'policy show', 'get_acl_policy', exception_handler=show_exception_handler) g.storage_custom_command_oauth( 'policy list', 'list_acl_policies', table_transformer=transform_acl_list_output) blob_container_mgmt_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.storage.operations#BlobContainersOperations.{}', client_factory=cf_blob_container_mgmt, resource_type=ResourceType.MGMT_STORAGE) with self.command_group('storage container immutability-policy', command_type=blob_container_mgmt_sdk, min_api='2018-02-01') as g: g.show_command('show', 'get_immutability_policy', transform=transform_immutability_policy) g.command('create', 'create_or_update_immutability_policy') g.command('delete', 'delete_immutability_policy', transform=lambda x: None) g.command('lock', 'lock_immutability_policy') g.command('extend', 'extend_immutability_policy') with self.command_group('storage container legal-hold', command_type=blob_container_mgmt_sdk, min_api='2018-02-01') as g: g.command('set', 'set_legal_hold') g.command('clear', 'clear_legal_hold') g.show_command('show', 'get', transform=lambda x: getattr(x, 'legal_hold', x)) file_sdk = CliCommandType( operations_tmpl= 'azure.multiapi.storage.file.fileservice#FileService.{}', client_factory=file_data_service_factory, resource_type=ResourceType.DATA_STORAGE) with self.command_group('storage share-rm', command_type=file_shares_mgmt_sdk, custom_command_type=get_custom_sdk( 'file', cf_mgmt_file_shares, resource_type=ResourceType.MGMT_STORAGE), resource_type=ResourceType.MGMT_STORAGE, min_api='2019-04-01', is_preview=True) as g: g.command('create', 'create') g.command('delete', 'delete', confirmation=True) g.custom_command( 'exists', '_file_share_exists', transform=create_boolean_result_output_transformer('exists')) g.command('list', 'list') g.show_command('show', 'get') g.command('update', 'update') with self.command_group('storage share', command_type=file_sdk, custom_command_type=get_custom_sdk( 'file', file_data_service_factory)) as g: from ._format import (transform_share_list, transform_boolean_for_table) g.storage_command('list', 'list_shares', transform=transform_storage_list_output, table_transformer=transform_share_list) g.storage_command( 'create', 'create_share', transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) g.storage_command( 'delete', 'delete_share', transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) g.storage_command('generate-sas', 'generate_share_shared_access_signature') g.storage_command('stats', 'get_share_stats') g.storage_command('show', 'get_share_properties', exception_handler=show_exception_handler) g.storage_command('update', 'set_share_properties') g.storage_command('snapshot', 'snapshot_share', min_api='2017-04-17') g.storage_command( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists')) g.storage_custom_command('url', 'create_share_url', transform=transform_url) g.storage_command('metadata show', 'get_share_metadata', exception_handler=show_exception_handler) g.storage_command('metadata update', 'set_share_metadata') with self.command_group('storage share policy', command_type=file_sdk, custom_command_type=get_custom_sdk( 'acl', file_data_service_factory)) as g: g.storage_custom_command('create', 'create_acl_policy') g.storage_custom_command('delete', 'delete_acl_policy') g.storage_custom_command('show', 'get_acl_policy', exception_handler=show_exception_handler) g.storage_custom_command('list', 'list_acl_policies', table_transformer=transform_acl_list_output) g.storage_custom_command('update', 'set_acl_policy') with self.command_group('storage directory', command_type=file_sdk, custom_command_type=get_custom_sdk( 'directory', file_data_service_factory)) as g: from ._format import transform_file_directory_result, transform_file_output g.storage_command( 'create', 'create_directory', transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) g.storage_command( 'delete', 'delete_directory', transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) g.storage_command('show', 'get_directory_properties', table_transformer=transform_file_output, exception_handler=show_exception_handler) g.storage_command( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists')) g.storage_command('metadata show', 'get_directory_metadata', exception_handler=show_exception_handler) g.storage_command('metadata update', 'set_directory_metadata') g.storage_custom_command( 'list', 'list_share_directories', transform=transform_file_directory_result(self.cli_ctx), table_transformer=transform_file_output, doc_string_source='file#FileService.list_directories_and_files') with self.command_group('storage file', command_type=file_sdk, custom_command_type=get_custom_sdk( 'file', file_data_service_factory)) as g: from ._format import transform_file_directory_result, transform_boolean_for_table, transform_file_output from ._transformers import transform_url g.storage_custom_command( 'list', 'list_share_files', transform=transform_file_directory_result(self.cli_ctx), table_transformer=transform_file_output, doc_string_source='file#FileService.list_directories_and_files') g.storage_command( 'delete', 'delete_file', transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) g.storage_command('resize', 'resize_file') g.storage_custom_command('url', 'create_file_url', transform=transform_url) g.storage_command('generate-sas', 'generate_file_shared_access_signature') g.storage_command('show', 'get_file_properties', table_transformer=transform_file_output, exception_handler=show_exception_handler) g.storage_command('update', 'set_file_properties') g.storage_command( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists')) g.storage_command('download', 'get_file_to_path') g.storage_command('upload', 'create_file_from_path') g.storage_command('metadata show', 'get_file_metadata', exception_handler=show_exception_handler) g.storage_command('metadata update', 'set_file_metadata') g.storage_command('copy start', 'copy_file') g.storage_command('copy cancel', 'abort_copy_file') g.storage_custom_command('upload-batch', 'storage_file_upload_batch') g.storage_custom_command('download-batch', 'storage_file_download_batch') g.storage_custom_command('delete-batch', 'storage_file_delete_batch') g.storage_custom_command('copy start-batch', 'storage_file_copy_batch') with self.command_group( 'storage cors', get_custom_sdk('cors', multi_service_properties_factory)) as g: from ._transformers import transform_cors_list_output g.storage_command('add', 'add_cors') g.storage_command('clear', 'clear_cors') g.storage_command('list', 'list_cors', transform=transform_cors_list_output) queue_sdk = CliCommandType( operations_tmpl= 'azure.multiapi.storage.queue.queueservice#QueueService.{}', client_factory=queue_data_service_factory, resource_type=ResourceType.DATA_STORAGE) with self.command_group('storage queue', queue_sdk, custom_command_type=get_custom_sdk( 'acl', queue_data_service_factory)) as g: from ._format import transform_boolean_for_table from ._transformers import create_boolean_result_output_transformer g.storage_command_oauth('list', 'list_queues', transform=transform_storage_list_output) g.storage_command_oauth( 'create', 'create_queue', transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) g.storage_command_oauth( 'delete', 'delete_queue', transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) g.storage_command_oauth('generate-sas', 'generate_queue_shared_access_signature') g.storage_command_oauth('stats', 'get_queue_service_stats', min_api='2016-05-31') g.storage_command_oauth( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists')) g.storage_command_oauth('metadata show', 'get_queue_metadata', exception_handler=show_exception_handler) g.storage_command_oauth('metadata update', 'set_queue_metadata') g.storage_custom_command_oauth('policy create', 'create_acl_policy') g.storage_custom_command_oauth('policy delete', 'delete_acl_policy') g.storage_custom_command_oauth( 'policy show', 'get_acl_policy', exception_handler=show_exception_handler) g.storage_custom_command_oauth( 'policy list', 'list_acl_policies', table_transformer=transform_acl_list_output) g.storage_custom_command_oauth('policy update', 'set_acl_policy') with self.command_group('storage message', queue_sdk) as g: from ._transformers import create_boolean_result_output_transformer from ._format import transform_message_show g.storage_command_oauth('put', 'put_message') g.storage_command_oauth('get', 'get_messages', table_transformer=transform_message_show) g.storage_command_oauth('peek', 'peek_messages', table_transformer=transform_message_show) g.storage_command_oauth( 'delete', 'delete_message', transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) g.storage_command_oauth('clear', 'clear_messages') g.storage_command_oauth('update', 'update_message') if cosmosdb_table_exists(self.cli_ctx): table_sdk = CliCommandType( operations_tmpl= 'azure.multiapi.cosmosdb.table.tableservice#TableService.{}', client_factory=table_data_service_factory, resource_type=ResourceType.DATA_COSMOS_TABLE) else: table_sdk = CliCommandType( operations_tmpl= 'azure.multiapi.storage.table.tableservice#TableService.{}', client_factory=table_data_service_factory, resource_type=ResourceType.DATA_COSMOS_TABLE) with self.command_group('storage table', table_sdk, custom_command_type=get_custom_sdk( 'acl', table_data_service_factory)) as g: from ._format import transform_boolean_for_table from ._transformers import create_boolean_result_output_transformer g.storage_command( 'create', 'create_table', transform=create_boolean_result_output_transformer('created'), table_transformer=transform_boolean_for_table) g.storage_command( 'delete', 'delete_table', transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) g.storage_command( 'exists', 'exists', transform=create_boolean_result_output_transformer('exists')) g.storage_command('generate-sas', 'generate_table_shared_access_signature') g.storage_command('list', 'list_tables', transform=transform_storage_list_output) g.storage_command('stats', 'get_table_service_stats', min_api='2016-05-31') g.storage_custom_command('policy create', 'create_acl_policy') g.storage_custom_command('policy delete', 'delete_acl_policy') g.storage_custom_command('policy show', 'get_acl_policy', exception_handler=show_exception_handler) g.storage_custom_command('policy list', 'list_acl_policies', table_transformer=transform_acl_list_output) g.storage_custom_command('policy update', 'set_acl_policy') with self.command_group('storage entity', table_sdk, custom_command_type=get_custom_sdk( 'table', table_data_service_factory)) as g: from ._format import transform_boolean_for_table, transform_entity_show from ._transformers import (create_boolean_result_output_transformer, transform_entity_query_output, transform_entities_result, transform_entity_result) g.storage_command('query', 'query_entities', table_transformer=transform_entity_query_output, transform=transform_entities_result) g.storage_command('replace', 'update_entity') g.storage_command('merge', 'merge_entity') g.storage_command( 'delete', 'delete_entity', transform=create_boolean_result_output_transformer('deleted'), table_transformer=transform_boolean_for_table) g.storage_command('show', 'get_entity', table_transformer=transform_entity_show, exception_handler=show_exception_handler, transform=transform_entity_result) g.storage_custom_command('insert', 'insert_table_entity')
def load_command_table(self, _): with self.command_group('timeseriesinsights', is_experimental=True) as g: pass # region environment from ._client_factory import cf_environments timeseriesinsights_environments = CliCommandType( operations_tmpl= 'azext_timeseriesinsights.vendored_sdks.timeseriesinsights.operations._environments_operations#EnvironmentsOperations.{}', client_factory=cf_environments) with self.command_group('timeseriesinsights environment standard', timeseriesinsights_environments, client_factory=cf_environments) as g: g.custom_command( 'create', 'create_timeseriesinsights_environment_standard', doc_string_source= "azext_timeseriesinsights.vendored_sdks.timeseriesinsights.models#StandardEnvironmentCreateOrUpdateParameters", supports_no_wait=True) g.custom_command( 'update', 'update_timeseriesinsights_environment_standard', doc_string_source= "azext_timeseriesinsights.vendored_sdks.timeseriesinsights.models#StandardEnvironmentCreateOrUpdateParameters", supports_no_wait=True) with self.command_group('timeseriesinsights environment longterm', timeseriesinsights_environments, client_factory=cf_environments) as g: g.custom_command( 'create', 'create_timeseriesinsights_environment_longterm', doc_string_source= "azext_timeseriesinsights.vendored_sdks.timeseriesinsights.models#LongTermEnvironmentCreateOrUpdateParameters", supports_no_wait=True) g.custom_command( 'update', 'update_timeseriesinsights_environment_longterm', doc_string_source= "azext_timeseriesinsights.vendored_sdks.timeseriesinsights.models#LongTermEnvironmentUpdateParameters", supports_no_wait=True) with self.command_group('timeseriesinsights environment', timeseriesinsights_environments, client_factory=cf_environments) as g: g.command('delete', 'delete', confirmation=True) g.show_command('show', 'get') g.custom_command('list', 'list_timeseriesinsights_environment', transform=gen_dict_to_list_transform(key='value')) # endregion # region event-source from ._client_factory import cf_event_sources timeseriesinsights_event_sources = CliCommandType( operations_tmpl= 'azext_timeseriesinsights.vendored_sdks.timeseriesinsights.operations._event_sources_operations#EventSourcesOperations.{}', client_factory=cf_event_sources) with self.command_group('timeseriesinsights event-source eventhub', timeseriesinsights_event_sources, client_factory=cf_event_sources) as g: g.custom_command( 'create', 'create_timeseriesinsights_event_source_eventhub', doc_string_source= "azext_timeseriesinsights.vendored_sdks.timeseriesinsights.models#EventHubEventSourceCreateOrUpdateParameters" ) g.custom_command( 'update', 'update_timeseriesinsights_event_source_eventhub', doc_string_source= "azext_timeseriesinsights.vendored_sdks.timeseriesinsights.models#EventHubEventSourceUpdateParameters" ) with self.command_group('timeseriesinsights event-source iothub', timeseriesinsights_event_sources, client_factory=cf_event_sources) as g: g.custom_command( 'create', 'create_timeseriesinsights_event_source_iothub', doc_string_source= "azext_timeseriesinsights.vendored_sdks.timeseriesinsights.models#IoTHubEventSourceCreateOrUpdateParameters" ) g.custom_command( 'update', 'update_timeseriesinsights_event_source_iothub', doc_string_source= "azext_timeseriesinsights.vendored_sdks.timeseriesinsights.models#IoTHubEventSourceUpdateParameters" ) with self.command_group('timeseriesinsights event-source', timeseriesinsights_event_sources, client_factory=cf_event_sources) as g: g.command('delete', 'delete', confirmation=True) g.show_command('show', 'get') g.command('list', 'list_by_environment') # endregion # region reference-data-set from ._client_factory import cf_reference_data_sets timeseriesinsights_reference_data_sets = CliCommandType( operations_tmpl= 'azext_timeseriesinsights.vendored_sdks.timeseriesinsights.operations._reference_data_sets_operations#ReferenceDataSetsOperations.{}', client_factory=cf_reference_data_sets) with self.command_group('timeseriesinsights reference-data-set', timeseriesinsights_reference_data_sets, client_factory=cf_reference_data_sets) as g: g.custom_command( 'create', 'create_timeseriesinsights_reference_data_set', doc_string_source= "azext_timeseriesinsights.vendored_sdks.timeseriesinsights.models#ReferenceDataSetCreateOrUpdateParameters" ) g.custom_command('update', 'update_timeseriesinsights_reference_data_set') g.command('delete', 'delete', confirmation=True) g.show_command('show', 'get') g.command('list', 'list_by_environment') # endregion # region access-policy from ._client_factory import cf_access_policies timeseriesinsights_access_policies = CliCommandType( operations_tmpl= 'azext_timeseriesinsights.vendored_sdks.timeseriesinsights.operations._access_policies_operations#AccessPoliciesOperations.{}', client_factory=cf_access_policies) with self.command_group('timeseriesinsights access-policy', timeseriesinsights_access_policies, client_factory=cf_access_policies) as g: g.custom_command( 'create', 'create_timeseriesinsights_access_policy', doc_string_source= "azext_timeseriesinsights.vendored_sdks.timeseriesinsights.models#AccessPolicyCreateOrUpdateParameters" ) g.custom_command( 'update', 'update_timeseriesinsights_access_policy', doc_string_source= "azext_timeseriesinsights.vendored_sdks.timeseriesinsights.models#AccessPolicyUpdateParameters" ) g.command('delete', 'delete', confirmation=True) g.show_command('show', 'get') g.command('list', 'list_by_environment')
def load_command_table(self, _): cosmosdb_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#DatabaseAccountsOperations.{}', client_factory=cf_db_accounts) cosmosdb_private_endpoint_connections_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#PrivateEndpointConnectionsOperations.{}', client_factory=cf_db_private_endpoint_connections) cosmosdb_private_link_resources_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#PrivateLinkResourcesOperations.{}', client_factory=cf_db_private_link_resources) cosmosdb_sql_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#SqlResourcesOperations.{}', client_factory=cf_sql_resources) cosmosdb_mongo_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#MongoDBResourcesOperations.{}', client_factory=cf_mongo_db_resources) cosmosdb_cassandra_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#CassandraResourcesOperations.{}', client_factory=cf_cassandra_resources) cosmosdb_gremlin_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#GremlinResourcesOperations.{}', client_factory=cf_gremlin_resources) cosmosdb_table_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#TableResourcesOperations.{}', client_factory=cf_table_resources) cosmosdb_restorable_database_accounts_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#RestorableDatabaseAccountsOperations.{}', client_factory=cf_restorable_database_accounts) cosmosdb_sql_restorable_database_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#RestorableSqlDatabasesOperations.{}', client_factory=cf_restorable_sql_databases) cosmosdb_sql_restorable_container_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#RestorableSqlContainersOperations.{}', client_factory=cf_restorable_sql_containers) cosmosdb_sql_restorable_resources_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#RestorableSqlResourcesOperations.{}', client_factory=cf_restorable_sql_resources) cosmosdb_mongodb_restorable_database_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#RestorableMongodbDatabasesOperations.{}', client_factory=cf_restorable_mongodb_databases) cosmosdb_mongodb_restorable_collection_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#RestorableMongodbCollectionsOperations.{}', client_factory=cf_restorable_mongodb_collections) cosmosdb_mongodb_restorable_resources_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#RestorableMongodbResourcesOperations.{}', client_factory=cf_restorable_mongodb_resources) cosmosdb_locations_sdk = CliCommandType( operations_tmpl='azure.mgmt.cosmosdb.operations#LocationsOperations.{}', client_factory=cf_db_locations) cosmosdb_managed_cassandra_cluster_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#CassandraClustersOperations.{}', client_factory=cf_cassandra_cluster) cosmosdb_managed_cassandra_datacenter_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.cosmosdb.operations#CassandraDataCentersOperations.{}', client_factory=cf_cassandra_data_center) with self.command_group('cosmosdb', cosmosdb_sdk, client_factory=cf_db_accounts) as g: g.show_command('show', 'get', transform=transform_db_account_json_output) g.command('list-keys', 'list_keys', deprecate_info=g.deprecate(redirect='cosmosdb keys list', hide=True)) g.command('list-read-only-keys', 'list_read_only_keys', deprecate_info=g.deprecate( redirect='cosmosdb keys list --type read-only-keys', hide=True)) g.command('list-connection-strings', 'list_connection_strings', table_transformer=list_connection_strings_output, deprecate_info=g.deprecate( redirect='cosmosdb keys list --type connection-strings', hide=True)) g.custom_command('regenerate-key', 'cli_cosmosdb_regenerate_key', deprecate_info=g.deprecate( redirect='cosmosdb keys regenerate', hide=True)) g.command('check-name-exists', 'check_name_exists') g.command('delete', 'begin_delete', confirmation=True) g.command('failover-priority-change', 'begin_failover_priority_change') g.custom_command('create', 'cli_cosmosdb_create', transform=transform_db_account_json_output) g.custom_command('update', 'cli_cosmosdb_update', transform=transform_db_account_json_output) g.custom_command('list', 'cli_cosmosdb_list', transform=transform_db_account_list_output) g.custom_command('restore', 'cli_cosmosdb_restore', transform=transform_db_account_json_output) with self.command_group( 'cosmosdb private-endpoint-connection', cosmosdb_private_endpoint_connections_sdk, client_factory=cf_db_private_endpoint_connections) as g: g.custom_command('approve', 'approve_private_endpoint_connection', validator=validate_private_endpoint_connection_id) g.custom_command('reject', 'reject_private_endpoint_connection', validator=validate_private_endpoint_connection_id) g.command('delete', 'begin_delete', validator=validate_private_endpoint_connection_id) g.show_command('show', 'get', validator=validate_private_endpoint_connection_id) with self.command_group('cosmosdb private-link-resource', cosmosdb_private_link_resources_sdk, client_factory=cf_db_private_link_resources) as g: from azure.cli.core.commands.transform import gen_dict_to_list_transform g.show_command('list', 'list_by_database_account', transform=gen_dict_to_list_transform(key='values')) # SQL api with self.command_group('cosmosdb sql'): pass with self.command_group('cosmosdb sql database', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.custom_command('create', 'cli_cosmosdb_sql_database_create') g.custom_command('exists', 'cli_cosmosdb_sql_database_exists') g.command('list', 'list_sql_databases') g.show_command('show', 'get_sql_database') g.command('delete', 'begin_delete_sql_database', confirmation=True) with self.command_group('cosmosdb sql container', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.custom_command('create', 'cli_cosmosdb_sql_container_create') g.custom_command('update', 'cli_cosmosdb_sql_container_update') g.custom_command('exists', 'cli_cosmosdb_sql_container_exists') g.command('list', 'list_sql_containers') g.show_command('show', 'get_sql_container') g.command('delete', 'begin_delete_sql_container', confirmation=True) with self.command_group('cosmosdb sql stored-procedure', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.custom_command('create', 'cli_cosmosdb_sql_stored_procedure_create_update') g.custom_command('update', 'cli_cosmosdb_sql_stored_procedure_create_update') g.command('list', 'list_sql_stored_procedures') g.show_command('show', 'get_sql_stored_procedure') g.command('delete', 'begin_delete_sql_stored_procedure', confirmation=True) with self.command_group('cosmosdb sql trigger', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.custom_command('create', 'cli_cosmosdb_sql_trigger_create') g.custom_command('update', 'cli_cosmosdb_sql_trigger_update') g.command('list', 'list_sql_triggers') g.show_command('show', 'get_sql_trigger') g.command('delete', 'begin_delete_sql_trigger', confirmation=True) with self.command_group('cosmosdb sql user-defined-function', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.custom_command( 'create', 'cli_cosmosdb_sql_user_defined_function_create_update') g.custom_command( 'update', 'cli_cosmosdb_sql_user_defined_function_create_update') g.command('list', 'list_sql_user_defined_functions') g.show_command('show', 'get_sql_user_defined_function') g.command('delete', 'begin_delete_sql_user_defined_function', confirmation=True) # MongoDB api with self.command_group('cosmosdb mongodb'): pass with self.command_group('cosmosdb mongodb database', cosmosdb_mongo_sdk, client_factory=cf_mongo_db_resources) as g: g.custom_command('create', 'cli_cosmosdb_mongodb_database_create') g.custom_command('exists', 'cli_cosmosdb_mongodb_database_exists') g.command('list', 'list_mongo_db_databases') g.show_command('show', 'get_mongo_db_database') g.command('delete', 'begin_delete_mongo_db_database', confirmation=True) with self.command_group('cosmosdb mongodb collection', cosmosdb_mongo_sdk, client_factory=cf_mongo_db_resources) as g: g.custom_command('create', 'cli_cosmosdb_mongodb_collection_create') g.custom_command('update', 'cli_cosmosdb_mongodb_collection_update') g.custom_command('exists', 'cli_cosmosdb_mongodb_collection_exists') g.command('list', 'list_mongo_db_collections') g.show_command('show', 'get_mongo_db_collection') g.command('delete', 'begin_delete_mongo_db_collection', confirmation=True) # Cassandra api with self.command_group('cosmosdb cassandra'): pass with self.command_group('cosmosdb cassandra keyspace', cosmosdb_cassandra_sdk, client_factory=cf_cassandra_resources) as g: g.custom_command('create', 'cli_cosmosdb_cassandra_keyspace_create') g.custom_command('exists', 'cli_cosmosdb_cassandra_keyspace_exists') g.command('list', 'list_cassandra_keyspaces') g.show_command('show', 'get_cassandra_keyspace') g.command('delete', 'begin_delete_cassandra_keyspace', confirmation=True) with self.command_group('cosmosdb cassandra table', cosmosdb_cassandra_sdk, client_factory=cf_cassandra_resources) as g: g.custom_command('create', 'cli_cosmosdb_cassandra_table_create') g.custom_command('update', 'cli_cosmosdb_cassandra_table_update') g.custom_command('exists', 'cli_cosmosdb_cassandra_table_exists') g.command('list', 'list_cassandra_tables') g.show_command('show', 'get_cassandra_table') g.command('delete', 'begin_delete_cassandra_table', confirmation=True) # Gremlin api with self.command_group('cosmosdb gremlin'): pass with self.command_group('cosmosdb gremlin database', cosmosdb_gremlin_sdk, client_factory=cf_gremlin_resources) as g: g.custom_command('create', 'cli_cosmosdb_gremlin_database_create') g.custom_command('exists', 'cli_cosmosdb_gremlin_database_exists') g.command('list', 'list_gremlin_databases') g.show_command('show', 'get_gremlin_database') g.command('delete', 'begin_delete_gremlin_database', confirmation=True) with self.command_group('cosmosdb gremlin graph', cosmosdb_gremlin_sdk, client_factory=cf_gremlin_resources) as g: g.custom_command('create', 'cli_cosmosdb_gremlin_graph_create') g.custom_command('update', 'cli_cosmosdb_gremlin_graph_update') g.custom_command('exists', 'cli_cosmosdb_gremlin_graph_exists') g.command('list', 'list_gremlin_graphs') g.show_command('show', 'get_gremlin_graph') g.command('delete', 'begin_delete_gremlin_graph', confirmation=True) # Table api with self.command_group('cosmosdb table', cosmosdb_table_sdk, client_factory=cf_table_resources) as g: g.custom_command('create', 'cli_cosmosdb_table_create') g.custom_command('exists', 'cli_cosmosdb_table_exists') g.command('list', 'list_tables') g.show_command('show', 'get_table') g.command('delete', 'begin_delete_table', confirmation=True) # Offer throughput with self.command_group('cosmosdb sql database throughput', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.show_command('show', 'get_sql_database_throughput') g.custom_command('migrate', 'cli_cosmosdb_sql_database_throughput_migrate') g.custom_command('update', 'cli_cosmosdb_sql_database_throughput_update') with self.command_group('cosmosdb sql container throughput', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.show_command('show', 'get_sql_container_throughput') g.custom_command('update', 'cli_cosmosdb_sql_container_throughput_update') g.custom_command('migrate', 'cli_cosmosdb_sql_container_throughput_migrate') with self.command_group('cosmosdb mongodb database throughput', cosmosdb_mongo_sdk, client_factory=cf_mongo_db_resources) as g: g.show_command('show', 'get_mongo_db_database_throughput') g.custom_command('update', 'cli_cosmosdb_mongodb_database_throughput_update') g.custom_command('migrate', 'cli_cosmosdb_mongodb_database_throughput_migrate') with self.command_group('cosmosdb mongodb collection throughput', cosmosdb_mongo_sdk, client_factory=cf_mongo_db_resources) as g: g.show_command('show', 'get_mongo_db_collection_throughput') g.custom_command('update', 'cli_cosmosdb_mongodb_collection_throughput_update') g.custom_command('migrate', 'cli_cosmosdb_mongodb_collection_throughput_migrate') with self.command_group('cosmosdb cassandra keyspace throughput', cosmosdb_cassandra_sdk, client_factory=cf_cassandra_resources) as g: g.show_command('show', 'get_cassandra_keyspace_throughput') g.custom_command('update', 'cli_cosmosdb_cassandra_keyspace_throughput_update') g.custom_command('migrate', 'cli_cosmosdb_cassandra_keyspace_throughput_migrate') with self.command_group('cosmosdb cassandra table throughput', cosmosdb_cassandra_sdk, client_factory=cf_cassandra_resources) as g: g.show_command('show', 'get_cassandra_table_throughput') g.custom_command('update', 'cli_cosmosdb_cassandra_table_throughput_update') g.custom_command('migrate', 'cli_cosmosdb_cassandra_table_throughput_migrate') with self.command_group('cosmosdb gremlin database throughput', cosmosdb_gremlin_sdk, client_factory=cf_gremlin_resources) as g: g.show_command('show', 'get_gremlin_database_throughput') g.custom_command('update', 'cli_cosmosdb_gremlin_database_throughput_update') g.custom_command('migrate', 'cli_cosmosdb_gremlin_database_throughput_migrate') with self.command_group('cosmosdb gremlin graph throughput', cosmosdb_gremlin_sdk, client_factory=cf_gremlin_resources) as g: g.show_command('show', 'get_gremlin_graph_throughput') g.custom_command('update', 'cli_cosmosdb_gremlin_graph_throughput_update') g.custom_command('migrate', 'cli_cosmosdb_gremlin_graph_throughput_migrate') with self.command_group('cosmosdb table throughput', cosmosdb_table_sdk, client_factory=cf_table_resources) as g: g.show_command('show', 'get_table_throughput') g.custom_command('update', 'cli_cosmosdb_table_throughput_update') g.custom_command('migrate', 'cli_cosmosdb_table_throughput_migrate') with self.command_group('cosmosdb identity', client_factory=cf_db_accounts, is_preview=True) as g: g.custom_show_command('show', 'cli_cosmosdb_identity_show') g.custom_command('assign', 'cli_cosmosdb_identity_assign') g.custom_command('remove', 'cli_cosmosdb_identity_remove') # virtual network rules with self.command_group('cosmosdb network-rule', None, client_factory=cf_db_accounts) as g: g.custom_command('list', 'cli_cosmosdb_network_rule_list', transform=transform_network_rule_list_output) g.custom_command('add', 'cli_cosmosdb_network_rule_add', transform=transform_db_account_json_output) g.custom_command('remove', 'cli_cosmosdb_network_rule_remove', transform=transform_db_account_json_output) # key operations with self.command_group('cosmosdb keys', cosmosdb_sdk, client_factory=cf_db_accounts) as g: g.custom_command('list', 'cli_cosmosdb_keys', table_transformer=list_connection_strings_output) g.custom_command('regenerate', 'cli_cosmosdb_regenerate_key') # # database operations with self.command_group( 'cosmosdb database', deprecate_info=self.deprecate(redirect=DATABASE_DEPRECATION_INFO, hide=True)) as g: g.cosmosdb_custom('show', 'cli_cosmosdb_database_show', table_transformer=database_output) g.cosmosdb_custom('list', 'cli_cosmosdb_database_list', table_transformer=list_database_output) g.cosmosdb_custom('exists', 'cli_cosmosdb_database_exists') g.cosmosdb_custom('create', 'cli_cosmosdb_database_create', table_transformer=database_output) g.cosmosdb_custom('delete', 'cli_cosmosdb_database_delete', confirmation=True) # collection operations with self.command_group( 'cosmosdb collection', deprecate_info=self.deprecate(redirect=COLLECTION_DEPRECATON_INFO, hide=True)) as g: g.cosmosdb_custom('show', 'cli_cosmosdb_collection_show', table_transformer=collection_output) g.cosmosdb_custom('list', 'cli_cosmosdb_collection_list', table_transformer=list_collection_output) g.cosmosdb_custom('exists', 'cli_cosmosdb_collection_exists') g.cosmosdb_custom('create', 'cli_cosmosdb_collection_create', table_transformer=collection_output) g.cosmosdb_custom('delete', 'cli_cosmosdb_collection_delete', confirmation=True) g.cosmosdb_custom('update', 'cli_cosmosdb_collection_update') # SQL role definition operations with self.command_group('cosmosdb sql role definition', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.custom_command('create', 'cli_cosmosdb_sql_role_definition_create', supports_no_wait=True) g.custom_command('update', 'cli_cosmosdb_sql_role_definition_update', supports_no_wait=True) g.custom_command('exists', 'cli_cosmosdb_sql_role_definition_exists') g.command('list', 'list_sql_role_definitions') g.show_command('show', 'get_sql_role_definition') g.command('delete', 'begin_delete_sql_role_definition', confirmation=True, supports_no_wait=True) g.wait_command('wait', 'get_sql_role_definition') # SQL role assignment operations with self.command_group('cosmosdb sql role assignment', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.custom_command('create', 'cli_cosmosdb_sql_role_assignment_create', supports_no_wait=True) g.custom_command('update', 'cli_cosmosdb_sql_role_assignment_update', supports_no_wait=True) g.custom_command('exists', 'cli_cosmosdb_sql_role_assignment_exists') g.command('list', 'list_sql_role_assignments') g.show_command('show', 'get_sql_role_assignment') g.command('delete', 'begin_delete_sql_role_assignment', confirmation=True, supports_no_wait=True) g.wait_command('wait', 'get_sql_role_assignment') with self.command_group( 'cosmosdb restorable-database-account', cosmosdb_restorable_database_accounts_sdk, client_factory=cf_restorable_database_accounts) as g: g.show_command('show', 'get_by_location') g.custom_command('list', 'cli_cosmosdb_restorable_database_account_list') with self.command_group('cosmosdb sql restorable-database', cosmosdb_sql_restorable_database_sdk, client_factory=cf_restorable_sql_databases) as g: g.command('list', 'list') with self.command_group('cosmosdb sql restorable-container', cosmosdb_sql_restorable_container_sdk, client_factory=cf_restorable_sql_containers) as g: g.command('list', 'list') with self.command_group('cosmosdb sql restorable-resource', cosmosdb_sql_restorable_resources_sdk, client_factory=cf_restorable_sql_resources) as g: g.command('list', 'list') with self.command_group( 'cosmosdb mongodb restorable-database', cosmosdb_mongodb_restorable_database_sdk, client_factory=cf_restorable_mongodb_databases) as g: g.command('list', 'list') with self.command_group( 'cosmosdb mongodb restorable-collection', cosmosdb_mongodb_restorable_collection_sdk, client_factory=cf_restorable_mongodb_collections) as g: g.command('list', 'list') with self.command_group( 'cosmosdb mongodb restorable-resource', cosmosdb_mongodb_restorable_resources_sdk, client_factory=cf_restorable_mongodb_resources) as g: g.command('list', 'list') # Get account locations with self.command_group('cosmosdb locations', cosmosdb_locations_sdk, client_factory=cf_db_locations) as g: g.show_command('show', 'get') g.command('list', 'list') # Retrieve backup info for sql with self.command_group('cosmosdb sql', cosmosdb_sql_sdk, client_factory=cf_sql_resources) as g: g.custom_command('retrieve-latest-backup-time', 'cli_sql_retrieve_latest_backup_time') # Retrieve backup info for mongodb with self.command_group('cosmosdb mongodb', cosmosdb_mongo_sdk, client_factory=cf_mongo_db_resources) as g: g.custom_command('retrieve-latest-backup-time', 'cli_mongo_db_retrieve_latest_backup_time') # managed cassandra cluster with self.command_group('managed-cassandra cluster', cosmosdb_managed_cassandra_cluster_sdk, client_factory=cf_cassandra_cluster) as g: g.custom_command('create', 'cli_cosmosdb_managed_cassandra_cluster_create', supports_no_wait=True) g.custom_command('update', 'cli_cosmosdb_managed_cassandra_cluster_update', supports_no_wait=True) g.custom_command('deallocate', 'cli_cosmosdb_managed_cassandra_cluster_deallocate', supports_no_wait=True) g.custom_command( 'invoke-command', 'cli_cosmosdb_managed_cassandra_cluster_invoke_command', supports_no_wait=True) g.custom_command('start', 'cli_cosmosdb_managed_cassandra_cluster_start', supports_no_wait=True) g.custom_command('status', 'cli_cosmosdb_managed_cassandra_cluster_status', table_transformer=mc_cluster_status_output_table) g.custom_command('list', 'cli_cosmosdb_managed_cassandra_cluster_list') g.show_command('show', 'get') g.command('delete', 'begin_delete', confirmation=True, supports_no_wait=True) # managed cassandra datacenter with self.command_group('managed-cassandra datacenter', cosmosdb_managed_cassandra_datacenter_sdk, client_factory=cf_cassandra_data_center) as g: g.custom_command('create', 'cli_cosmosdb_managed_cassandra_datacenter_create', supports_no_wait=True) g.custom_command('update', 'cli_cosmosdb_managed_cassandra_datacenter_update', supports_no_wait=True) g.command('list', 'list') g.show_command('show', 'get') g.command('delete', 'begin_delete', confirmation=True, supports_no_wait=True)
def load_command_table(self, _): # pylint: disable=too-many-statements update_custom_util = CliCommandType( operations_tmpl='azure.cli.command_modules.iot.custom#{}') iot_central_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.iotcentral.operations#IoTCentralOperations.{}') private_endpoint_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.iotcentral.operations#PrivateEndpointConnectionsOperations.{}', # client_factory=cf_private_endpoint, ) private_link_resource_sdk = CliCommandType( operations_tmpl= 'azure.mgmt.iotcentral.operations#PrivateLinksOperations.{}', # client_factory=cf_private_link, ) # iot dps commands with self.command_group( 'iot dps', client_factory=iot_service_provisioning_factory) as g: g.custom_command('list', 'iot_dps_list') g.custom_show_command('show', 'iot_dps_get') g.custom_command('create', 'iot_dps_create') g.custom_command('delete', 'iot_dps_delete') g.generic_update_command('update', getter_name='iot_dps_get', setter_name='iot_dps_update', command_type=update_custom_util) # iot dps linked-hub commands with self.command_group( 'iot dps linked-hub', client_factory=iot_service_provisioning_factory) as g: g.custom_command('list', 'iot_dps_linked_hub_list') g.custom_show_command('show', 'iot_dps_linked_hub_get') g.custom_command('create', 'iot_dps_linked_hub_create', supports_no_wait=True) g.custom_command('update', 'iot_dps_linked_hub_update', supports_no_wait=True) g.custom_command('delete', 'iot_dps_linked_hub_delete', supports_no_wait=True) # iot dps certificate commands with self.command_group( 'iot dps certificate', client_factory=iot_service_provisioning_factory, transform=_dps_certificate_response_transform) as g: g.custom_command('list', 'iot_dps_certificate_list') g.custom_show_command('show', 'iot_dps_certificate_get') g.custom_command('create', 'iot_dps_certificate_create') g.custom_command('delete', 'iot_dps_certificate_delete') g.custom_command('generate-verification-code', 'iot_dps_certificate_gen_code') g.custom_command('verify', 'iot_dps_certificate_verify') g.custom_command('update', 'iot_dps_certificate_update') # iot dps policy commands with self.command_group( 'iot dps policy', client_factory=iot_service_provisioning_factory) as g: g.custom_command('list', 'iot_dps_policy_list') g.custom_show_command('show', 'iot_dps_policy_get') g.custom_command('create', 'iot_dps_policy_create', supports_no_wait=True) g.custom_command('update', 'iot_dps_policy_update', supports_no_wait=True) g.custom_command('delete', 'iot_dps_policy_delete', supports_no_wait=True) # iot hub certificate commands with self.command_group('iot hub certificate', client_factory=iot_hub_service_factory) as g: g.custom_command('list', 'iot_hub_certificate_list') g.custom_show_command('show', 'iot_hub_certificate_get') g.custom_command('create', 'iot_hub_certificate_create') g.custom_command('delete', 'iot_hub_certificate_delete') g.custom_command('generate-verification-code', 'iot_hub_certificate_gen_code') g.custom_command('verify', 'iot_hub_certificate_verify') g.custom_command('update', 'iot_hub_certificate_update') # iot hub commands with self.command_group('iot hub', client_factory=iot_hub_service_factory) as g: g.custom_command('create', 'iot_hub_create') g.custom_command('list', 'iot_hub_list') g.custom_command( 'show-connection-string', 'iot_hub_show_connection_string', deprecate_info=self.deprecate(redirect=CS_DEPRECATION_INFO)) g.custom_show_command('show', 'iot_hub_get') g.generic_update_command('update', getter_name='iot_hub_get', setter_name='iot_hub_update', command_type=update_custom_util, custom_func_name='update_iot_hub_custom') g.custom_command('delete', 'iot_hub_delete', transform=HubDeleteResultTransform(self.cli_ctx)) g.custom_command('list-skus', 'iot_hub_sku_list') g.custom_command('show-quota-metrics', 'iot_hub_get_quota_metrics') g.custom_command('show-stats', 'iot_hub_get_stats') g.custom_command('manual-failover', 'iot_hub_manual_failover', supports_no_wait=True) # iot hub consumer group commands with self.command_group('iot hub consumer-group', client_factory=iot_hub_service_factory) as g: g.custom_command('create', 'iot_hub_consumer_group_create') g.custom_command('list', 'iot_hub_consumer_group_list') g.custom_show_command('show', 'iot_hub_consumer_group_get') g.custom_command('delete', 'iot_hub_consumer_group_delete') # iot hub identity commands with self.command_group('iot hub identity', client_factory=iot_hub_service_factory) as g: g.custom_command('assign', 'iot_hub_identity_assign') g.custom_show_command('show', 'iot_hub_identity_show') g.custom_command('remove', 'iot_hub_identity_remove') # iot hub policy commands with self.command_group('iot hub policy', client_factory=iot_hub_service_factory) as g: g.custom_command('list', 'iot_hub_policy_list') g.custom_show_command('show', 'iot_hub_policy_get') g.custom_command('create', 'iot_hub_policy_create', transform=PolicyUpdateResultTransform(self.cli_ctx)) g.custom_command('delete', 'iot_hub_policy_delete', transform=PolicyUpdateResultTransform(self.cli_ctx)) g.custom_command('renew-key', 'iot_hub_policy_key_renew', supports_no_wait=True) # iot hub routing endpoint commands with self.command_group('iot hub routing-endpoint', client_factory=iot_hub_service_factory) as g: g.custom_command('create', 'iot_hub_routing_endpoint_create', transform=EndpointUpdateResultTransform(self.cli_ctx)) g.custom_show_command('show', 'iot_hub_routing_endpoint_show') g.custom_command('list', 'iot_hub_routing_endpoint_list') g.custom_command('delete', 'iot_hub_routing_endpoint_delete', transform=EndpointUpdateResultTransform(self.cli_ctx)) # iot hub message enrichment commands with self.command_group('iot hub message-enrichment', client_factory=iot_hub_service_factory, min_api="2019-07-01-preview") as g: g.custom_command('create', 'iot_message_enrichment_create') g.custom_command('list', 'iot_message_enrichment_list') g.custom_command('delete', 'iot_message_enrichment_delete') g.custom_command('update', 'iot_message_enrichment_update') # iot hub route commands with self.command_group('iot hub route', client_factory=iot_hub_service_factory) as g: g.custom_command('create', 'iot_hub_route_create', transform=RouteUpdateResultTransform(self.cli_ctx)) g.custom_show_command('show', 'iot_hub_route_show') g.custom_command('list', 'iot_hub_route_list') g.custom_command('delete', 'iot_hub_route_delete', transform=RouteUpdateResultTransform(self.cli_ctx)) g.custom_command('update', 'iot_hub_route_update', transform=RouteUpdateResultTransform(self.cli_ctx)) g.custom_command('test', 'iot_hub_route_test') # iot hub device stream commands with self.command_group('iot hub devicestream', client_factory=iot_hub_service_factory, min_api="2019-07-01-preview") as g: g.custom_show_command('show', 'iot_hub_devicestream_show') # iot central commands with self.command_group('iot central app', iot_central_sdk, client_factory=iot_central_service_factory) as g: g.custom_command('create', 'iot_central_app_create', supports_no_wait=True) g.custom_command('list', 'iot_central_app_list') g.custom_show_command('show', 'iot_central_app_get') g.generic_update_command('update', getter_name='iot_central_app_get', setter_name='iot_central_app_update', command_type=update_custom_util) g.custom_command('delete', 'iot_central_app_delete', confirmation=True, supports_no_wait=True) g.custom_command('identity assign', 'iot_central_app_assign_identity') g.custom_command('identity remove', 'iot_central_app_remove_identity') g.custom_show_command('identity show', 'iot_central_app_show_identity') with self.command_group('iot central app private-endpoint-connection', private_endpoint_sdk, client_factory=iot_central_service_factory) as g: from azure.cli.command_modules.iot._validators import validate_private_endpoint_connection_id g.custom_command('delete', 'delete_private_endpoint_connection', confirmation=True, validator=validate_private_endpoint_connection_id) g.custom_show_command( 'show', 'show_private_endpoint_connection', validator=validate_private_endpoint_connection_id) g.custom_command('approve', 'approve_private_endpoint_connection', validator=validate_private_endpoint_connection_id) g.custom_command('reject', 'reject_private_endpoint_connection', validator=validate_private_endpoint_connection_id) g.custom_command('list', 'list_private_endpoint_connection') with self.command_group('iot central app private-link-resource', private_link_resource_sdk, client_factory=iot_central_service_factory) as g: from azure.cli.core.commands.transform import gen_dict_to_list_transform g.custom_command('list', 'list_private_link_resource', transform=gen_dict_to_list_transform(key="value")) g.custom_show_command('show', 'get_private_link_resource')
def load_command_table(self, _): from azure.cli.command_modules.servicebus._client_factory import ( namespaces_mgmt_client_factory, queues_mgmt_client_factory, topics_mgmt_client_factory, subscriptions_mgmt_client_factory, rules_mgmt_client_factory, disaster_recovery_mgmt_client_factory, migration_mgmt_client_factory, private_endpoint_connections_mgmt_client_factory, private_link_mgmt_client_factory) sb_namespace_util = CliCommandType( operations_tmpl= 'azure.mgmt.servicebus.operations#NamespacesOperations.{}', client_factory=namespaces_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) sb_queue_util = CliCommandType( operations_tmpl='azure.mgmt.servicebus.operations#QueuesOperations.{}', client_factory=queues_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) sb_topic_util = CliCommandType( operations_tmpl='azure.mgmt.servicebus.operations#TopicsOperations.{}', client_factory=topics_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) sb_subscriptions_util = CliCommandType( operations_tmpl= 'azure.mgmt.servicebus.operations#SubscriptionsOperations.{}', client_factory=subscriptions_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) sb_rule_util = CliCommandType( operations_tmpl='azure.mgmt.servicebus.operations#RulesOperations.{}', client_factory=rules_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) sb_geodr_util = CliCommandType( operations_tmpl= 'azure.mgmt.servicebus.operations#DisasterRecoveryConfigsOperations.{}', client_factory=disaster_recovery_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) sb_migration_util = CliCommandType( operations_tmpl= 'azure.mgmt.servicebus.operations#MigrationConfigsOperations.{}', client_factory=migration_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) sb_private_endpoints_util = CliCommandType( operations_tmpl= 'azure.mgmt.servicebus.operations#PrivateEndpointConnectionsOperations.{}', client_factory=private_endpoint_connections_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) sb_private_links_util = CliCommandType( operations_tmpl= 'azure.mgmt.servicebus.operations#PrivateLinkResourcesOperations.{}', client_factory=private_link_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) from ._validators import validate_subnet # Namespace Region custom_tmpl = 'azure.cli.command_modules.servicebus.custom#{}' servicebus_custom = CliCommandType(operations_tmpl=custom_tmpl) with self.command_group('servicebus namespace', sb_namespace_util, client_factory=namespaces_mgmt_client_factory, min_api='2021-06-01-preview') as g: g.custom_command('create', 'cli_namespace_create') g.show_command('show', 'get') g.custom_command('list', 'cli_namespace_list') g.command('delete', 'begin_delete') g.custom_command('exists', 'cli_namespace_exists') g.generic_update_command('update', custom_func_name='cli_namespace_update', custom_func_type=servicebus_custom, setter_name='begin_create_or_update') with self.command_group('servicebus namespace authorization-rule', sb_namespace_util, client_factory=namespaces_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) as g: g.custom_command('create', 'cli_namespaceautho_create') g.show_command('show', 'get_authorization_rule') g.command('list', 'list_authorization_rules') g.command('keys list', 'list_keys') g.custom_command('keys renew', 'cli_keys_renew') g.command('delete', 'delete_authorization_rule') g.generic_update_command( 'update', getter_name='get_authorization_rule', setter_name='create_or_update_authorization_rule', custom_func_name='cli_namespaceautho_update') with self.command_group( 'servicebus namespace private-endpoint-connection', sb_private_endpoints_util, resource_type=ResourceType.MGMT_SERVICEBUS, custom_command_type=servicebus_custom, is_preview=True, client_factory=private_endpoint_connections_mgmt_client_factory ) as g: from ._validators import validate_private_endpoint_connection_id g.command('delete', 'begin_delete', confirmation=True, validator=validate_private_endpoint_connection_id) g.show_command('show', 'get', validator=validate_private_endpoint_connection_id) g.command('list', 'list', validator=validate_private_endpoint_connection_id) g.custom_command('approve', 'approve_private_endpoint_connection', validator=validate_private_endpoint_connection_id) g.custom_command('reject', 'reject_private_endpoint_connection', validator=validate_private_endpoint_connection_id) with self.command_group('servicebus namespace private-link-resource', sb_private_links_util, resource_type=ResourceType.MGMT_SERVICEBUS) as g: from azure.cli.core.commands.transform import gen_dict_to_list_transform g.show_command('show', 'get', is_preview=True, min_api='2021-06-01-preview', transform=gen_dict_to_list_transform(key="value")) # Queue Region with self.command_group('servicebus queue', sb_queue_util, client_factory=queues_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) as g: g.custom_command('create', 'cli_sbqueue_create') g.show_command('show', 'get') g.command('list', 'list_by_namespace') g.command('delete', 'delete') g.generic_update_command('update', custom_func_name='cli_sbqueue_update') with self.command_group('servicebus queue authorization-rule', sb_queue_util, client_factory=queues_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) as g: g.custom_command('create', 'cli_queueautho_create') g.show_command('show', 'get_authorization_rule') g.command('list', 'list_authorization_rules') g.command('keys list', 'list_keys') g.custom_command('keys renew', 'cli_queueauthokey_renew') g.command('delete', 'delete_authorization_rule') g.generic_update_command( 'update', getter_name='get_authorization_rule', setter_name='create_or_update_authorization_rule', custom_func_name='cli_namespaceautho_update') # Topic Region with self.command_group('servicebus topic', sb_topic_util, client_factory=topics_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) as g: g.custom_command('create', 'cli_sbtopic_create') g.show_command('show', 'get') g.command('list', 'list_by_namespace') g.command('delete', 'delete') g.generic_update_command('update', custom_func_name='cli_sbtopic_update') with self.command_group('servicebus topic authorization-rule', sb_topic_util, client_factory=topics_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) as g: g.custom_command('create', 'cli_topicautho_create') g.show_command('show', 'get_authorization_rule') g.command('list', 'list_authorization_rules') g.command('keys list', 'list_keys') g.custom_command('keys renew', 'cli_topicauthokey_renew') g.command('delete', 'delete_authorization_rule') g.generic_update_command( 'update', getter_name='get_authorization_rule', setter_name='create_or_update_authorization_rule', custom_func_name='cli_namespaceautho_update') # Subscription Region with self.command_group('servicebus topic subscription', sb_subscriptions_util, client_factory=subscriptions_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) as g: g.custom_command('create', 'cli_sbsubscription_create') g.show_command('show', 'get') g.command('list', 'list_by_topic') g.command('delete', 'delete') g.generic_update_command('update', custom_func_name='cli_sbsubscription_update') # Rules Region with self.command_group('servicebus topic subscription rule', sb_rule_util, client_factory=rules_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) as g: g.custom_command('create', 'cli_rules_create') g.show_command('show', 'get') g.command('list', 'list_by_subscriptions') g.command('delete', 'delete') g.generic_update_command('update', custom_func_name='cli_rules_update') # DisasterRecoveryConfigs Region with self.command_group( 'servicebus georecovery-alias', sb_geodr_util, client_factory=disaster_recovery_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) as g: g.custom_command('set', 'cli_georecovery_alias_create') g.show_command('show', 'get') g.command('list', 'list') g.command('break-pair', 'break_pairing') g.command('fail-over', 'fail_over') g.custom_command('exists', 'cli_georecovery_alias_exists') g.command('delete', 'delete') # DisasterRecoveryConfigs Authorization Region with self.command_group( 'servicebus georecovery-alias authorization-rule', sb_geodr_util, client_factory=disaster_recovery_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) as g: g.command('list', 'list_authorization_rules') g.show_command('show', 'get_authorization_rule') g.command('keys list', 'list_keys') # MigrationConfigs Region with self.command_group('servicebus migration', sb_migration_util, client_factory=migration_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) as g: g.custom_command('start', 'cli_migration_start') g.custom_show_command('show', 'cli_migration_show') g.custom_command('complete', 'cli_migration_complete') g.command('abort', 'revert') # NetwrokRuleSet Region with self.command_group('servicebus namespace network-rule', sb_namespace_util, client_factory=namespaces_mgmt_client_factory, resource_type=ResourceType.MGMT_SERVICEBUS) as g: g.custom_command('add', 'cli_networkrule_createupdate', validator=validate_subnet) g.command('list', 'get_network_rule_set') g.custom_command('remove', 'cli_networkrule_delete', validator=validate_subnet) # Identity Region with self.command_group( 'servicebus namespace identity', sb_namespace_util, min_api='2021-06-01-preview', resource_type=ResourceType.MGMT_SERVICEBUS, client_factory=namespaces_mgmt_client_factory) as g: g.custom_command('assign', 'cli_add_identity') g.custom_command('remove', 'cli_remove_identity') # Encryption Region with self.command_group( 'servicebus namespace encryption', sb_namespace_util, min_api='2021-06-01-preview', resource_type=ResourceType.MGMT_SERVICEBUS, client_factory=namespaces_mgmt_client_factory) as g: g.custom_command('add', 'cli_add_encryption') g.custom_command('remove', 'cli_remove_encryption')