Exemple #1
0
    transform_release_definitions_table_output,
    transform_release_definition_table_output,
    transform_runs_artifact_table_output,
    transform_pipelines_pools_table_output,
    transform_pipelines_pool_table_output,
    transform_pipelines_agents_table_output,
    transform_pipelines_agent_table_output,
    transform_pipelines_queues_table_output,
    transform_pipelines_queue_table_output,
    transform_pipelines_variable_groups_table_output,
    transform_pipelines_variable_group_table_output,
    transform_pipelines_variables_table_output,
    transform_pipelines_var_group_variables_table_output)

buildOps = CliCommandType(
    operations_tmpl='azext_devops.dev.pipelines.build#{}',
    exception_handler=azure_devops_exception_handler)

buildDefOps = CliCommandType(
    operations_tmpl='azext_devops.dev.pipelines.build_definition#{}',
    exception_handler=azure_devops_exception_handler)

buildTaskOps = CliCommandType(
    operations_tmpl='azext_devops.dev.pipelines.task#{}',
    exception_handler=azure_devops_exception_handler)

releaseOps = CliCommandType(
    operations_tmpl='azext_devops.dev.pipelines.release#{}',
    exception_handler=azure_devops_exception_handler)

releaseDefinitionOps = CliCommandType(
Exemple #2
0
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)

    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)

    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 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',
                         min_api='2016-01-01')
        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')
        g.command('keys renew',
                  'regenerate_key',
                  transform=lambda x: getattr(x, 'keys', x))
        g.command('keys list',
                  'list_keys',
                  transform=lambda x: getattr(x, 'keys', x))

    with self.command_group('storage account', cloud_data_plane_sdk) as g:
        g.storage_command('generate-sas', 'generate_shared_access_signature')

    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 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)

    block_blob_sdk = CliCommandType(
        operations_tmpl=
        'azure.multiapi.storage.blob.blockblobservice#BlockBlobService.{}',
        client_factory=blob_data_service_factory,
        resource_type=ResourceType.DATA_STORAGE)

    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 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 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_command_oauth('generate-sas',
                                'generate_container_shared_access_signature')
        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.blob_containers_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',
                            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')
Exemple #3
0
 def get_mgmt_type(name):
     return CliCommandType(
         operations_tmpl=mgmt_path.format(name, _operation(name)) + "{}",
         client_factory=get_mgmt_factory(name),
         exception_handler=batch_exception_handler
     )
Exemple #4
0
 def __init__(self, cli_ctx=None):
     from azure.cli.core.commands import CliCommandType
     aem_custom = CliCommandType(operations_tmpl='azext_aem.custom#{}')
     super(AEMCommandsLoader, self).__init__(cli_ctx=cli_ctx,
                                             custom_command_type=aem_custom)
Exemple #5
0
 def get_custom_sdk(custom_module, client_factory):
     return CliCommandType(
         operations_tmpl='azure.cli.command_modules.synapse.operations.{}#'.
         format(custom_module) + '{}',
         client_factory=client_factory,
     )
Exemple #6
0
 def __init__(self, cli_ctx=None):
     from azure.cli.core.commands import CliCommandType
     custom_type = CliCommandType(operations_tmpl='azext_connect.custom#{}')
     super(ConnectCommandsLoader,
           self).__init__(cli_ctx=cli_ctx, custom_command_type=custom_type)
Exemple #7
0
def load_command_table(self, _):

    vmware_sdk = CliCommandType(
        operations_tmpl=
        'azext_vmware.vendored_sdks.operations#PrivateCloudOperations.{}',
        client_factory=cf_vmware)

    with self.command_group('vmware private-cloud',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('list', 'privatecloud_list')
        g.custom_show_command('show', 'privatecloud_show')
        g.custom_command('create', 'privatecloud_create')
        g.custom_command('update', 'privatecloud_update')
        g.custom_command('delete', 'privatecloud_delete')
        g.custom_command('listadmincredentials',
                         'privatecloud_listadmincredentials')
        g.custom_command('addidentitysource', 'privatecloud_addidentitysource')
        g.custom_command('deleteidentitysource',
                         'privatecloud_deleteidentitysource')
        g.custom_command('rotate-vcenter-password',
                         'privatecloud_rotate_vcenter_password')
        g.custom_command('rotate-nsxt-password',
                         'privatecloud_rotate_nsxt_password')

    with self.command_group('vmware cluster',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('create', 'cluster_create')
        g.custom_command('update', 'cluster_update')
        g.custom_command('list', 'cluster_list')
        g.custom_command('delete', 'cluster_delete')
        g.custom_show_command('show', 'cluster_show')

    with self.command_group('vmware authorization',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('create', 'authorization_create')
        g.custom_command('list', 'authorization_list')
        g.custom_command('delete', 'authorization_delete')
        g.custom_show_command('show', 'authorization_show')

    with self.command_group('vmware hcx-enterprise-site',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('create', 'hcxenterprisesite_create')
        g.custom_command('list', 'hcxenterprisesite_list')
        g.custom_command('delete', 'hcxenterprisesite_delete')
        g.custom_show_command('show', 'hcxenterprisesite_show')

    with self.command_group('vmware location',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('checkquotaavailability', 'check_quota_availability')
        g.custom_command('checktrialavailability', 'check_trial_availability')

    with self.command_group('vmware datastore',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('create', 'datastore_create')
        g.custom_command('list', 'datastore_list')
        g.custom_show_command('show', 'datastore_show')
        g.custom_command('delete', 'datastore_delete')
Exemple #8
0
def load_command_table(self, _):
    from azure.cli.core.commands import CliCommandType
    from azure.cli.command_modules.search._client_factory import cf_search_services, cf_search_private_endpoint_connections, \
        cf_search_private_link_resources, cf_search_shared_private_link_resources, cf_search_admin_keys, cf_search_query_keys

    search_services_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.search.operations#ServicesOperations.{}',
        client_factory=cf_search_services
    )

    search_private_endpoint_connections_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.search.operations#PrivateEndpointConnectionsOperations.{}',
        client_factory=cf_search_private_endpoint_connections
    )

    search_private_link_resources_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.search.operations#PrivateLinkResourcesOperations.{}',
        client_factory=cf_search_private_link_resources
    )

    search_shared_private_link_resources_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.search.operations#SharedPrivateLinkResourcesOperations.{}',
        client_factory=cf_search_shared_private_link_resources
    )

    search_admin_keys_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.search.operations#AdminKeysOperations.{}',
        client_factory=cf_search_admin_keys
    )

    search_query_keys_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.search.operations#QueryKeysOperations.{}',
        client_factory=cf_search_query_keys
    )

    with self.command_group('search service', search_services_sdk) as g:
        # right now list_by_resource_group is the only way to list, so directly map to list_by_resource_group.
        g.command('list', 'list_by_resource_group')
        g.show_command('show', 'get')
        g.command('delete', 'delete', confirmation=True)
        g.generic_update_command('update', custom_func_name='update_search_service', setter_name='begin_create_or_update', setter_arg_name='service')
        g.custom_command('create', 'create_search_service')

    with self.command_group('search private-endpoint-connection', search_private_endpoint_connections_sdk) as g:
        g.command('list', 'list_by_service')
        g.show_command('show', 'get')
        g.command('delete', 'delete', confirmation=True)
        g.custom_command('update', 'update_private_endpoint_connection')

    with self.command_group('search private-link-resource', search_private_link_resources_sdk) as g:
        g.command('list', 'list_supported')

    with self.command_group('search shared-private-link-resource', search_shared_private_link_resources_sdk) as g:
        g.command('list', 'list_by_service')
        g.show_command('show', 'get')
        g.command('delete', 'begin_delete', confirmation=True)
        g.custom_command('create', 'create_shared_private_link_resource')
        g.custom_command('update', 'update_shared_private_link_resource')

    with self.command_group('search admin-key', search_admin_keys_sdk) as g:
        g.show_command('show', 'get')
        g.command('renew', 'regenerate')

    with self.command_group('search query-key', search_query_keys_sdk) as g:
        g.command('list', 'list_by_search_service')
        g.command('create', 'create')
        g.command('delete', 'delete')

    with self.command_group('search'):
        pass
Exemple #9
0
def load_command_table(self, _):
    from ._validators import (validate_subnet)
    adls_format_path = 'azure.mgmt.datalake.store.operations.{}#{}.{{}}'

    dls_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.dls.custom#{}')

    dls_account_sdk = CliCommandType(operations_tmpl=adls_format_path.format(
        'accounts_operations', 'AccountsOperations'),
                                     client_factory=cf_dls_account)

    dls_firewall_sdk = CliCommandType(operations_tmpl=adls_format_path.format(
        'firewall_rules_operations', 'FirewallRulesOperations'),
                                      client_factory=cf_dls_account)

    dls_virtual_network_sdk = CliCommandType(
        operations_tmpl=adls_format_path.format(
            'virtual_network_rules_operations',
            'VirtualNetworkRulesOperations'),
        client_factory=cf_dls_account)

    dls_provider_sdk = CliCommandType(
        operations_tmpl=adls_format_path.format(
            'trusted_id_providers_operations', 'TrustedIdProvidersOperations'),
        client_factory=cf_dls_account_trusted_provider)

    # account operations
    with self.command_group('dls account',
                            dls_account_sdk,
                            client_factory=cf_dls_account) as g:
        g.custom_command('create', 'create_adls_account')
        g.custom_command('update', 'update_adls_account')
        g.custom_command('list', 'list_adls_account')
        g.command('delete', 'delete')
        g.show_command('show', 'get')
        g.command('enable-key-vault', 'enable_key_vault')

    # account firewall operations
    with self.command_group('dls account firewall',
                            dls_firewall_sdk,
                            client_factory=cf_dls_account_firewall) as g:
        g.custom_command('create', 'add_adls_firewall_rule')
        g.command('update', 'update')
        g.command('list', 'list_by_account')
        g.show_command('show', 'get')
        g.command('delete', 'delete')

    # account virtual network rule operations
    with self.command_group(
            'dls account network-rule',
            dls_virtual_network_sdk,
            client_factory=cf_dls_account_virtual_network) as g:
        g.custom_command('create',
                         'add_adls_virtual_network_rule',
                         validator=validate_subnet)
        g.generic_update_command('update')
        g.command('list', 'list_by_account')
        g.show_command('show', 'get')
        g.command('delete', 'delete')

    # account trusted id provider operations
    with self.command_group('dls account trusted-provider',
                            dls_provider_sdk) as g:
        g.command('create', 'create_or_update')
        g.command('update', 'update')
        g.command('list', 'list_by_account')
        g.show_command('show', 'get')
        g.command('delete', 'delete')

    # filesystem operations
    with self.command_group('dls fs', dls_custom) as g:
        g.show_command('show', 'get_adls_item')
        g.command('list', 'list_adls_items')
        g.command('create', 'create_adls_item')
        g.command('append', 'append_adls_item')
        g.command('delete', 'remove_adls_item')
        g.command('upload', 'upload_to_adls')
        g.command('download', 'download_from_adls')
        g.command('download', 'download_from_adls')
        g.command('test', 'test_adls_item')
        g.command('preview', 'preview_adls_item')
        g.command('join', 'join_adls_items')
        g.command('move', 'move_adls_item')
        g.command('set-expiry', 'set_adls_item_expiry')
        g.command('remove-expiry', 'remove_adls_item_expiry')

    # filesystem permission operations
    with self.command_group('dls fs access', dls_custom) as g:
        g.command('set-permission', 'set_adls_item_permissions')
        g.command('set-owner', 'set_adls_item_owner')
        g.show_command('show', 'get_adls_item_acl')
        g.command('set-entry', 'set_adls_item_acl_entry')
        g.command('set', 'set_adls_item_acl')
        g.command('remove-entry', 'remove_adls_item_acl_entry')
        g.command('remove-all', 'remove_adls_item_acl')
Exemple #10
0
def load_command_table(self, _):

    security_tasks_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.security.operations#TasksOperations.{}',
        client_factory=cf_security_tasks,
        operation_group='security_tasks')

    security_alerts_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.security.operations#AlertsOperations.{}',
        client_factory=cf_security_alerts,
        operation_group='security_alerts')

    security_settings_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.security.operations#SettingsOperations.{}',
        client_factory=cf_security_settings,
        operation_group='security_settings')

    security_contacts_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.security.operations#SecurityContactsOperations.{}',
        client_factory=cf_security_contacts,
        operation_group='security_contacts')

    security_auto_provisioning_settings_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.security.operations#AutoProvisioningSettingsOperations.{}',
        client_factory=cf_security_auto_provisioning_settings,
        operation_group='security_auto_provisioning_settings')

    security_discovered_security_solutions_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.security.operations#DiscoveredSecuritySolutionsOperations.{}',
        client_factory=cf_security_discovered_security_solutions,
        operation_group='security_discovered_security_solutions')

    security_external_security_solutions_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.security.operations#ExternalSecuritySolutionsOperations.{}',
        client_factory=cf_security_external_security_solutions,
        operation_group='security_external_security_solutions')

    security_jit_network_access_policies_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.security.operations#JitNetworkAccessPoliciesOperations.{}',
        client_factory=cf_security_jit_network_access_policies,
        operation_group='security_jit_network_access_policies')

    security_locations_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.security.operations#LocationsOperations.{}',
        client_factory=cf_security_locations,
        operation_group='security_locations')

    security_pricings_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.security.operations#PricingsOperations.{}',
        client_factory=cf_security_pricings,
        operation_group='security_pricings')

    security_topology_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.security.operations#TopologyOperations.{}',
        client_factory=cf_security_topology,
        operation_group='security_topology')

    security_workspace_settings_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.security.operations#WorkspaceSettingsOperations.{}',
        client_factory=cf_security_workspace_settings,
        operation_group='security_workspace_settings')

    with self.command_group('security task',
                            security_tasks_sdk,
                            client_factory=cf_security_tasks) as g:
        g.custom_command('list', 'list_security_tasks')
        g.custom_command('show', 'get_security_task')

    with self.command_group('security alert',
                            security_alerts_sdk,
                            client_factory=cf_security_alerts) as g:
        g.custom_command('list', 'list_security_alerts')
        g.custom_command('show', 'get_security_alert')
        g.custom_command('update', 'update_security_alert')

    with self.command_group('security setting',
                            security_settings_sdk,
                            client_factory=cf_security_settings) as g:
        g.custom_command('list', 'list_security_settings')
        g.custom_command('show', 'get_security_setting')

    with self.command_group('security contact',
                            security_contacts_sdk,
                            client_factory=cf_security_contacts) as g:
        g.custom_command('list', 'list_security_contacts')
        g.custom_command('show', 'get_security_contact')
        g.custom_command('create', 'create_security_contact')
        g.custom_command('delete', 'delete_security_contact')

    with self.command_group(
            'security auto-provisioning-setting',
            security_auto_provisioning_settings_sdk,
            client_factory=cf_security_auto_provisioning_settings) as g:
        g.custom_command('list', 'list_security_auto_provisioning_settings')
        g.custom_command('show', 'get_security_auto_provisioning_setting')
        g.custom_command('update', 'update_security_auto_provisioning_setting')

    with self.command_group(
            'security discovered-security-solution',
            security_discovered_security_solutions_sdk,
            client_factory=cf_security_discovered_security_solutions) as g:
        g.custom_command('list', 'list_security_discovered_security_solutions')
        g.custom_command('show', 'get_security_discovered_security_solution')

    with self.command_group(
            'security external-security-solution',
            security_external_security_solutions_sdk,
            client_factory=cf_security_external_security_solutions) as g:
        g.custom_command('list', 'list_security_external_security_solutions')
        g.custom_command('show', 'get_security_external_security_solution')

    with self.command_group(
            'security jit-policy',
            security_jit_network_access_policies_sdk,
            client_factory=cf_security_jit_network_access_policies) as g:
        g.custom_command('list', 'list_security_jit_network_access_policies')
        g.custom_command('show', 'get_security_jit_network_access_policy')

    with self.command_group('security location',
                            security_locations_sdk,
                            client_factory=cf_security_locations) as g:
        g.custom_command('list', 'list_security_locations')
        g.custom_command('show', 'get_security_location')

    with self.command_group('security pricing',
                            security_pricings_sdk,
                            client_factory=cf_security_pricings) as g:
        g.custom_command('list', 'list_security_pricings')
        g.custom_command('show', 'get_security_pricing')
        g.custom_command('create', 'create_security_pricing')

    with self.command_group('security topology',
                            security_topology_sdk,
                            client_factory=cf_security_topology) as g:
        g.custom_command('list', 'list_security_topology')
        g.custom_command('show', 'get_security_topology')

    with self.command_group(
            'security workspace-setting',
            security_workspace_settings_sdk,
            client_factory=cf_security_workspace_settings) as g:
        g.custom_command('list', 'list_security_workspace_settings')
        g.custom_command('show', 'get_security_workspace_setting')
        g.custom_command('create', 'create_security_workspace_setting')
        g.custom_command('delete', 'delete_security_workspace_setting')

    with self.command_group('security', is_preview=True):
        pass
Exemple #11
0
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core.commands import CliCommandType

from azext_devops.dev.common.exception_handler import azure_devops_exception_handler

artifactOps = CliCommandType(
    operations_tmpl='azext_devops.dev.artifacts.universal#{}',
    exception_handler=azure_devops_exception_handler
)


def load_package_commands(self, _):
    with self.command_group('artifacts universal', command_type=artifactOps) as g:
        g.command('publish', 'publish_package')
        g.command('download', 'download_package')
Exemple #12
0
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_diagnostics_category)
    from ._exception_handler import monitor_exception_handler, missing_resource_handler
    from .transformers import (action_group_list_table)
    from .validators import process_autoscale_create_namespace

    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)

    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)

    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_schema')
        g.command('list-usages', 'list_usages')
        g.command('list-management-groups', 'list_management_groups')
        g.command('get-shared-keys', 'get_shared_keys')

    with self.command_group(
            'monitor log-analytics workspace pack',
            log_analytics_workspace_sdk,
            custom_command_type=log_analytics_workspace_custom) as g:
        g.command('list', 'list_intelligence_packs')
        g.command('enable', 'enable_intelligence_pack')
        g.command('disable', 'disable_intelligence_pack')

    with self.command_group('monitor',
                            metric_alert_sdk,
                            custom_command_type=monitor_general_custom,
                            is_preview=True) as g:
        g.custom_command('clone', 'clone_existed_settings')
def load_command_table(self, _):
    topics_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.mgmt.eventgrid.operations.topics_operations#TopicsOperations.{}',
        client_factory=topics_factory,
        client_arg_name='self')

    domains_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.mgmt.eventgrid.operations.domains_operations#DomainsOperations.{}',
        client_factory=domains_factory,
        client_arg_name='self')

    domain_topics_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.mgmt.eventgrid.operations.domain_topics_operations#DomainTopicsOperations.{}',
        client_factory=domain_topics_factory,
        client_arg_name='self')

    topic_type_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.mgmt.eventgrid.operations.topic_types_operations#TopicTypesOperations.{}',
        client_factory=topic_types_factory,
        client_arg_name='self')

    with self.command_group('eventgrid topic',
                            topics_mgmt_util,
                            client_factory=topics_factory) as g:
        g.command('show', 'get')
        g.command('key list', 'list_shared_access_keys')
        g.command('key regenerate', 'regenerate_key')
        g.command('delete', 'delete')
        g.custom_command('list', 'cli_topic_list')
        g.custom_command('create', 'cli_topic_create_or_update')
        g.generic_update_command('update',
                                 getter_name='get',
                                 setter_name='update',
                                 client_factory=topics_factory)

    with self.command_group('eventgrid domain topic',
                            domain_topics_mgmt_util,
                            client_factory=domain_topics_factory) as g:
        g.command('show', 'get')
        g.command('list', 'list_by_domain')

    with self.command_group('eventgrid domain',
                            domains_mgmt_util,
                            client_factory=domains_factory) as g:
        g.command('show', 'get')
        g.command('key list', 'list_shared_access_keys')
        g.command('key regenerate', 'regenerate_key')
        g.command('delete', 'delete')
        g.custom_command('list', 'cli_domain_list')
        g.custom_command('create', 'cli_domain_create_or_update')
        g.generic_update_command('update',
                                 getter_name='get',
                                 setter_name='update',
                                 client_factory=domains_factory)

    custom_tmpl = 'azext_eventgrid.custom#{}'
    eventgrid_custom = CliCommandType(operations_tmpl=custom_tmpl)

    with self.command_group('eventgrid event-subscription',
                            client_factory=event_subscriptions_factory) as g:
        g.custom_command('create', 'cli_eventgrid_event_subscription_create')
        g.custom_command('show', 'cli_eventgrid_event_subscription_get')
        g.custom_command('delete', 'cli_eventgrid_event_subscription_delete')
        g.custom_command('list', 'cli_event_subscription_list')
        g.generic_update_command('update',
                                 getter_type=eventgrid_custom,
                                 setter_type=eventgrid_custom,
                                 getter_name='event_subscription_getter',
                                 setter_name='event_subscription_setter',
                                 custom_func_name='update_event_subscription')

    with self.command_group('eventgrid topic-type', topic_type_mgmt_util) as g:
        g.command('list', 'list')
        g.command('show', 'get')
        g.command('list-event-types', 'list_event_types')
Exemple #14
0
def load_command_table(self, _):  # pylint: disable=too-many-statements
    from azure.cli.core.commands import CliCommandType
    from ._client_factory import cf_hdinsight_applications
    from ._client_factory import cf_hdinsight_clusters
    from ._client_factory import cf_hdinsight_extensions
    from ._client_factory import cf_hdinsight_locations
    from ._client_factory import cf_hdinsight_script_execution_history
    from ._client_factory import cf_hdinsight_script_actions
    from ._client_factory import cf_hdinsight_virtual_machines

    hdinsight_clusters_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.hdinsight.operations#ClustersOperations.{}',
        client_factory=cf_hdinsight_clusters)

    hdinsight_script_actions_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.hdinsight.operations#ScriptActionsOperations.{}',
        client_factory=cf_hdinsight_script_actions)

    hdinsight_applications_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.hdinsight.operations#ApplicationsOperations.{}',
        client_factory=cf_hdinsight_applications)

    hdinsight_extensions_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.hdinsight.operations#ExtensionsOperations.{}',
        client_factory=cf_hdinsight_extensions)

    hdinsight_locations_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.hdinsight.operations#LocationsOperations.{}',
        client_factory=cf_hdinsight_locations)

    hdinsight_script_execution_history_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.hdinsight.operations#ScriptExecutionHistoryOperations.{}',
        client_factory=cf_hdinsight_script_execution_history)

    hdinsight_virtual_machines_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.hdinsight.operations#VirtualMachinesOperations.{}',
        client_factory=cf_hdinsight_virtual_machines)

    # cluster operations
    with self.command_group('hdinsight',
                            hdinsight_clusters_sdk,
                            client_factory=cf_hdinsight_clusters) as g:
        g.custom_command('create', 'create_cluster', supports_no_wait=True)
        g.custom_command('resize', 'resize_cluster', supports_no_wait=True)
        g.show_command('show', 'get')
        g.custom_command('list', 'list_clusters')
        g.wait_command('wait')
        g.command('delete',
                  'begin_delete',
                  confirmation=True,
                  supports_no_wait=True)
        g.custom_command('rotate-disk-encryption-key',
                         'rotate_hdi_cluster_key',
                         supports_no_wait=True)
        g.custom_command('update', 'update_cluster', supports_no_wait=True)

    # usage operations
    with self.command_group('hdinsight',
                            hdinsight_locations_sdk,
                            client_factory=cf_hdinsight_locations) as g:
        g.command('list-usage', 'list_usages')

    # script action operations
    with self.command_group('hdinsight script-action',
                            hdinsight_script_actions_sdk,
                            client_factory=cf_hdinsight_script_actions) as g:
        g.show_command('show-execution-details', 'get_execution_detail')
        g.command('list', 'list_by_cluster')
        g.command('delete', 'delete')
        g.custom_command('execute',
                         'execute_hdi_script_action',
                         command_type=hdinsight_clusters_sdk,
                         client_factory=cf_hdinsight_clusters)
        g.command('list-execution-history',
                  'list_by_cluster',
                  command_type=hdinsight_script_execution_history_sdk,
                  client_factory=cf_hdinsight_script_execution_history)
        g.command('promote',
                  'promote',
                  command_type=hdinsight_script_execution_history_sdk,
                  client_factory=cf_hdinsight_script_execution_history)

    # application operations
    with self.command_group('hdinsight application',
                            hdinsight_applications_sdk,
                            client_factory=cf_hdinsight_applications) as g:
        g.custom_command('create', 'create_hdi_application')
        g.show_command('show', 'get')
        g.command('list', 'list_by_cluster')
        g.wait_command('wait')
        g.command('delete',
                  'begin_delete',
                  confirmation=True,
                  supports_no_wait=True)

    # Monitoring operations
    with self.command_group('hdinsight monitor',
                            hdinsight_extensions_sdk,
                            client_factory=cf_hdinsight_extensions) as g:
        g.show_command('show', 'get_monitoring_status')
        g.custom_command('enable', 'enable_hdi_monitoring')
        g.command('disable', 'begin_disable_monitoring')

    # VirtualMachine operations
    with self.command_group('hdinsight host',
                            hdinsight_virtual_machines_sdk,
                            client_factory=cf_hdinsight_virtual_machines) as g:
        g.command('list', 'list_hosts')
        g.command('restart', 'begin_restart_hosts', confirmation=True)

    # Autoscale operations
    with self.command_group('hdinsight autoscale',
                            hdinsight_clusters_sdk,
                            client_factory=cf_hdinsight_clusters) as g:
        g.custom_command('create', 'create_autoscale', supports_no_wait=True)
        g.custom_command('update', 'update_autoscale', supports_no_wait=True)
        g.custom_show_command('show', 'show_autoscale')
        g.custom_command('delete',
                         'delete_autoscale',
                         supports_no_wait=True,
                         confirmation=True)
        g.custom_command('list-timezones', 'list_timezones')
        g.wait_command('wait')

    with self.command_group('hdinsight autoscale condition',
                            hdinsight_clusters_sdk,
                            client_factory=cf_hdinsight_clusters) as g:
        g.custom_command('create',
                         'create_autoscale_condition',
                         supports_no_wait=True)
        g.custom_command('update',
                         'update_autoscale_condition',
                         supports_no_wait=True)
        g.custom_command('list', 'list_autoscale_condition')
        g.custom_command('delete',
                         'delete_autoscale_condition',
                         supports_no_wait=True,
                         confirmation=True)
        g.wait_command('wait')
def load_command_table(self, _):

    managed_clusters_sdk = CliCommandType(
        operations_tmpl='azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks.'
        'operations._managed_clusters_operations#ManagedClustersOperations.{}',
        operation_group='managed_clusters',
        client_factory=cf_managed_clusters)

    container_services_sdk = CliCommandType(
        operations_tmpl='azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks.'
        'operations.container_service_operations#ContainerServicesOperations.{}',
        operation_group='container_services',
        client_factory=cf_container_services)

    agent_pools_sdk = CliCommandType(
        operations_tmpl='azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks.'
        'operations._agent_pools_operations#AgentPoolsOperations.{}',
        client_factory=cf_managed_clusters)

    maintenance_configuration_sdk = CliCommandType(
        operations_tmpl='azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks.'
        'operations._maintenance_configurations_operations#MaintenanceConfigurationsOperations.{}',
        client_factory=cf_maintenance_configurations)

    # AKS managed cluster commands
    with self.command_group('aks',
                            managed_clusters_sdk,
                            client_factory=cf_managed_clusters) as g:
        g.custom_command('kollect', 'aks_kollect')
        g.custom_command('kanalyze', 'aks_kanalyze')
        g.custom_command('browse', 'aks_browse')
        g.custom_command('create', 'aks_create', supports_no_wait=True)
        g.custom_command('update', 'aks_update', supports_no_wait=True)
        g.custom_command('scale', 'aks_scale', supports_no_wait=True)
        g.custom_command('disable-addons',
                         'aks_disable_addons',
                         supports_no_wait=True)
        g.custom_command('enable-addons',
                         'aks_enable_addons',
                         supports_no_wait=True)
        g.custom_command('get-credentials', 'aks_get_credentials')
        g.custom_show_command('show',
                              'aks_show',
                              table_transformer=aks_show_table_format)
        g.custom_command('upgrade', 'aks_upgrade', supports_no_wait=True)
        g.command('get-upgrades',
                  'get_upgrade_profile',
                  table_transformer=aks_upgrades_table_format)
        g.custom_command(
            'rotate-certs',
            'aks_rotate_certs',
            supports_no_wait=True,
            confirmation=
            'Kubernetes will be unavailable during certificate rotation process.\n'
            + 'Are you sure you want to perform this operation?')
        g.wait_command('wait')
        g.command('stop', 'begin_stop', supports_no_wait=True)
        g.command('start', 'begin_start', supports_no_wait=True)
        g.custom_command('get-os-options', 'aks_get_os_options')

    # AKS container service commands
    with self.command_group('aks',
                            container_services_sdk,
                            client_factory=cf_container_services) as g:
        g.custom_command('get-versions',
                         'aks_get_versions',
                         table_transformer=aks_versions_table_format)

    # AKS maintenance configuration commands
    with self.command_group('aks maintenanceconfiguration',
                            maintenance_configuration_sdk,
                            client_factory=cf_maintenance_configurations) as g:
        g.custom_command('list', 'aks_maintenanceconfiguration_list')
        g.custom_show_command('show', 'aks_maintenanceconfiguration_show')
        g.custom_command('add', 'aks_maintenanceconfiguration_add')
        g.custom_command('update', 'aks_maintenanceconfiguration_update')
        g.custom_command('delete', 'aks_maintenanceconfiguration_delete')

    # AKS addon commands
    with self.command_group('aks addon',
                            managed_clusters_sdk,
                            client_factory=cf_managed_clusters) as g:
        g.custom_command(
            'list-available',
            'aks_addon_list_available',
            table_transformer=aks_addon_list_available_table_format)
        g.custom_command('list',
                         'aks_addon_list',
                         table_transformer=aks_addon_list_table_format)
        g.custom_show_command('show',
                              'aks_addon_show',
                              table_transformer=aks_addon_show_table_format)
        g.custom_command('enable', 'aks_addon_enable', supports_no_wait=True)
        g.custom_command('disable', 'aks_addon_disable', supports_no_wait=True)
        g.custom_command('update', 'aks_addon_update', supports_no_wait=True)

    # AKS agent pool commands
    with self.command_group('aks nodepool',
                            agent_pools_sdk,
                            client_factory=cf_agent_pools) as g:
        g.custom_command('list',
                         'aks_agentpool_list',
                         table_transformer=aks_agentpool_list_table_format)
        g.custom_show_command(
            'show',
            'aks_agentpool_show',
            table_transformer=aks_agentpool_show_table_format)
        g.custom_command('add', 'aks_agentpool_add', supports_no_wait=True)
        g.custom_command('scale', 'aks_agentpool_scale', supports_no_wait=True)
        g.custom_command('upgrade',
                         'aks_agentpool_upgrade',
                         supports_no_wait=True)
        g.custom_command('update',
                         'aks_agentpool_update',
                         supports_no_wait=True)
        g.custom_command('delete',
                         'aks_agentpool_delete',
                         supports_no_wait=True)
        g.custom_command('get-upgrades', 'aks_agentpool_get_upgrade_profile')

    # AKS pod identity commands
    with self.command_group('aks pod-identity',
                            managed_clusters_sdk,
                            client_factory=cf_managed_clusters) as g:
        g.custom_command('add', 'aks_pod_identity_add')
        g.custom_command('delete', 'aks_pod_identity_delete')
        g.custom_command('list',
                         'aks_pod_identity_list',
                         table_transformer=aks_pod_identities_table_format)

    # AKS pod identity exception commands
    with self.command_group('aks pod-identity exception',
                            managed_clusters_sdk,
                            client_factory=cf_managed_clusters) as g:
        g.custom_command('add', 'aks_pod_identity_exception_add')
        g.custom_command('delete', 'aks_pod_identity_exception_delete')
        g.custom_command('update', 'aks_pod_identity_exception_update')
        g.custom_command(
            'list',
            'aks_pod_identity_exception_list',
            table_transformer=aks_pod_identity_exceptions_table_format)

    # AKS egress commands
    with self.command_group('aks egress-endpoints',
                            managed_clusters_sdk,
                            client_factory=cf_managed_clusters) as g:
        g.custom_command('list', 'aks_egress_endpoints_list')
Exemple #16
0
    cf_integration_runtime_node_ip_address,
    cf_integration_runtime_object_metadata,
    cf_integration_runtime_node,
    cf_integration_runtime_credentials,
    cf_integration_runtime_connection_info,
    cf_integration_runtime_auth_key,
    cf_integration_runtime_monitoring_data,
    cf_integration_runtime_status,
    cf_private_link_resource,
    cf_private_endpoint_connection,
    cf_private_link_hub,
)


synapse_big_data_pool = CliCommandType(
    operations_tmpl='azext_synapse.vendored_sdks.synapse.operations._big_data_pool_operations#BigDataPoolOperations.{}',
    client_factory=cf_big_data_pool,
)


synapse_integration_runtime = CliCommandType(
    operations_tmpl=(
        'azext_synapse.vendored_sdks.synapse.operations._integration_runtime_operations#IntegrationRuntimeOperations.{}'
    ),
    client_factory=cf_integration_runtime,
)


synapse_integration_runtime_auth_key = CliCommandType(
    operations_tmpl='azext_synapse.vendored_sdks.synapse.operations._integration_runtime_auth_key_operations#IntegrationRuntimeAuthKeyOperations.{}',
    client_factory=cf_integration_runtime_auth_key,
)
Exemple #17
0
# pylint: disable=too-many-locals
# pylint: disable=bad-continuation
# pylint: disable=line-too-long

from azure.cli.core.commands import CliCommandType
from azext_datafactory_preview.generated._client_factory import (
    cf_factory,
    cf_trigger,
    cf_integration_runtime,
    cf_domain_service,
    cf_group,
)


datafactory_factory = CliCommandType(
    operations_tmpl='azext_datafactory_preview.vendored_sdks.azure_mgmt_datafactory.operations._factories_operations#FactoriesOperations.{}',
    client_factory=cf_factory,
)


datafactory_domain_service = CliCommandType(
    operations_tmpl='azext_datafactory_preview.vendored_sdks.azure_mgmt_datafactory.operations._domain_services_operations#DomainServicesOperations.{}',
    client_factory=cf_domain_service,
)


datafactory_group = CliCommandType(
    operations_tmpl='azext_datafactory_preview.vendored_sdks.azure_mgmt_datafactory.operations._groups_operations#GroupsOperations.{}',
    client_factory=cf_group,
)

# pylint: disable=bad-continuation
# pylint: disable=line-too-long

from azure.cli.core.commands import CliCommandType
from azext_dataprotection.generated._client_factory import (
    cf_backup_vault,
    cf_backup_policy,
    cf_backup_instance,
    cf_recovery_point,
    cf_job,
    cf_restorable_time_range,
)

dataprotection_backup_vault = CliCommandType(
    operations_tmpl=
    'azext_dataprotection.vendored_sdks.dataprotection.operations._backup_vaults_operations#BackupVaultsOperations.{}',
    client_factory=cf_backup_vault,
)

dataprotection_backup_policy = CliCommandType(
    operations_tmpl=
    'azext_dataprotection.vendored_sdks.dataprotection.operations._backup_policies_operations#BackupPoliciesOperations.{}',
    client_factory=cf_backup_policy,
)

dataprotection_backup_instance = CliCommandType(
    operations_tmpl=
    'azext_dataprotection.vendored_sdks.dataprotection.operations._backup_instances_operations#BackupInstancesOperations.{}',
    client_factory=cf_backup_instance,
)
Exemple #19
0
def load_command_table(self, _):

    from azext_datafactory.generated._client_factory import cf_factory
    datafactory_factory = CliCommandType(
        operations_tmpl=
        'azext_datafactory.vendored_sdks.datafactory.operations._factory_operations#FactoryOperations.{'
        '}',
        client_factory=cf_factory)
    with self.command_group('datafactory',
                            datafactory_factory,
                            client_factory=cf_factory) as g:
        g.custom_command('list', 'datafactory_list')
        g.custom_show_command('show', 'datafactory_show')
        g.custom_command('create', 'datafactory_create')
        g.custom_command('update', 'datafactory_update')
        g.custom_command('delete', 'datafactory_delete')
        g.custom_command('configure-factory-repo',
                         'datafactory_configure_factory_repo')
        g.custom_command('get-data-plane-access',
                         'datafactory_get_data_plane_access')
        g.custom_command('get-git-hub-access-token',
                         'datafactory_get_git_hub_access_token')

    from azext_datafactory.generated._client_factory import cf_trigger
    datafactory_trigger = CliCommandType(
        operations_tmpl=
        'azext_datafactory.vendored_sdks.datafactory.operations._trigger_operations#TriggerOperations.{'
        '}',
        client_factory=cf_trigger)
    with self.command_group('datafactory trigger',
                            datafactory_trigger,
                            client_factory=cf_trigger,
                            is_experimental=True) as g:
        g.custom_command('list', 'datafactory_trigger_list')
        g.custom_show_command('show', 'datafactory_trigger_show')
        g.custom_command('create', 'datafactory_trigger_create')
        g.generic_update_command('update',
                                 setter_arg_name='properties',
                                 custom_func_name='datafactory_trigger_upda'
                                 'te')
        g.custom_command('delete', 'datafactory_trigger_delete')
        g.custom_command('get-event-subscription-status',
                         'datafactory_trigger_get_event_subscription_status')
        g.custom_command('query-by-factory',
                         'datafactory_trigger_query_by_factory')
        g.custom_command('start',
                         'datafactory_trigger_start',
                         supports_no_wait=True)
        g.custom_command('stop',
                         'datafactory_trigger_stop',
                         supports_no_wait=True)
        g.custom_command('subscribe-to-event',
                         'datafactory_trigger_subscribe_to_event',
                         supports_no_wait=True)
        g.custom_command('unsubscribe-from-event',
                         'datafactory_trigger_unsubscribe_from_event',
                         supports_no_wait=True)
        g.custom_wait_command('wait', 'datafactory_trigger_show')

    from azext_datafactory.generated._client_factory import cf_integration_runtime
    datafactory_integration_runtime = CliCommandType(
        operations_tmpl=
        'azext_datafactory.vendored_sdks.datafactory.operations._integration_runtime_operations#Integra'
        'tionRuntimeOperations.{}',
        client_factory=cf_integration_runtime)
    with self.command_group('datafactory integration-runtime',
                            datafactory_integration_runtime,
                            client_factory=cf_integration_runtime,
                            is_experimental=True) as g:
        g.custom_command('list', 'datafactory_integration_runtime_list')
        g.custom_show_command('show', 'datafactory_integration_runtime_show')
        g.custom_command(
            'linked-integration-runtime create',
            'datafactory_integration_runtime_linked_integration_runti'
            'me_create')
        g.custom_command('managed create',
                         'datafactory_integration_runtime_managed_create')
        g.custom_command('self-hosted create',
                         'datafactory_integration_runtime_self_hosted_create')
        g.custom_command('update', 'datafactory_integration_runtime_update')
        g.custom_command('delete', 'datafactory_integration_runtime_delete')
        g.custom_command(
            'get-connection-info',
            'datafactory_integration_runtime_get_connection_info')
        g.custom_command(
            'get-monitoring-data',
            'datafactory_integration_runtime_get_monitoring_data')
        g.custom_command('get-status',
                         'datafactory_integration_runtime_get_status')
        g.custom_command('list-auth-key',
                         'datafactory_integration_runtime_list_auth_key')
        g.custom_command(
            'regenerate-auth-key',
            'datafactory_integration_runtime_regenerate_auth_key')
        g.custom_command('remove-link',
                         'datafactory_integration_runtime_remove_link')
        g.custom_command('start',
                         'datafactory_integration_runtime_start',
                         supports_no_wait=True)
        g.custom_command('stop',
                         'datafactory_integration_runtime_stop',
                         supports_no_wait=True)
        g.custom_command('sync-credentials',
                         'datafactory_integration_runtime_sync_credentials')
        g.custom_command('upgrade', 'datafactory_integration_runtime_upgrade')
        g.custom_wait_command('wait', 'datafactory_integration_runtime_show')
Exemple #20
0
def load_command_table(self, _):
    from azure.cli.core.commands.arm import deployment_validate_table_format

    resource_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.resource.custom#{}')

    resource_group_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.resources.operations.resource_groups_operations#ResourceGroupsOperations.{}',
        client_factory=cf_resource_groups,
        resource_type=ResourceType.MGMT_RESOURCE_RESOURCES)

    resource_provider_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.resources.operations.providers_operations#ProvidersOperations.{}',
        client_factory=cf_providers,
        resource_type=ResourceType.MGMT_RESOURCE_RESOURCES)

    resource_feature_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.features.operations.features_operations#FeaturesOperations.{}',
        client_factory=cf_features,
        resource_type=ResourceType.MGMT_RESOURCE_FEATURES)

    resource_tag_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.resources.operations.tags_operations#TagsOperations.{}',
        client_factory=cf_tags,
        resource_type=ResourceType.MGMT_RESOURCE_RESOURCES)

    resource_deployment_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.resources.operations.deployments_operations#DeploymentsOperations.{}',
        client_factory=cf_deployments,
        resource_type=ResourceType.MGMT_RESOURCE_RESOURCES)

    resource_deployment_operation_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.resources.operations.deployment_operations#DeploymentOperations.{}',
        client_factory=cf_deployment_operations,
        resource_type=ResourceType.MGMT_RESOURCE_RESOURCES)

    resource_policy_definitions_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.policy.operations#PolicyDefinitionsOperations.{}',
        client_factory=cf_policy_definitions,
        resource_type=ResourceType.MGMT_RESOURCE_POLICY)

    resource_policy_set_definitions_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.policy.operations#PolicySetDefinitionsOperations.{}',
        client_factory=cf_policy_set_definitions,
        resource_type=ResourceType.MGMT_RESOURCE_POLICY)

    resource_lock_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.locks.operations#ManagementLocksOperations.{}',
        resource_type=ResourceType.MGMT_RESOURCE_LOCKS)

    resource_link_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.links.operations#ResourceLinksOperations.{}',
        client_factory=cf_resource_links,
        resource_type=ResourceType.MGMT_RESOURCE_LINKS)
    resource_managedapp_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.managedapplications.operations#ApplicationsOperations.{}',
        client_factory=cf_resource_managedapplications,
        resource_type=ResourceType.MGMT_RESOURCE_RESOURCES)

    resource_managedapp_def_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.managedapplications.operations#ApplicationDefinitionsOperations.{}',
        client_factory=cf_resource_managedappdefinitions,
        resource_type=ResourceType.MGMT_RESOURCE_RESOURCES)

    resource_managementgroups_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.managementgroups.operations.management_groups_operations#ManagementGroupsOperations.{}',
        client_factory=cf_management_groups,
        exception_handler=managementgroups_exception_handler)

    resource_managementgroups_subscriptions_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.managementgroups.operations.management_group_subscriptions_operations#ManagementGroupSubscriptionsOperations.{}',
        client_factory=cf_management_group_subscriptions,
        exception_handler=managementgroups_exception_handler)

    resource_managementgroups_update_type = CliCommandType(
        operations_tmpl='azure.cli.command_modules.resource.custom#{}',
        client_factory=cf_management_groups,
        exception_handler=managementgroups_exception_handler)

    with self.command_group(
            'account lock',
            resource_lock_sdk,
            resource_type=ResourceType.MGMT_RESOURCE_LOCKS) as g:
        g.custom_command('create', 'create_lock')
        g.custom_command('delete', 'delete_lock')
        g.custom_command('list', 'list_locks')
        g.custom_show_command('show', 'get_lock')
        g.custom_command('update', 'update_lock')

    with self.command_group(
            'group',
            resource_group_sdk,
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.command('delete', 'delete', supports_no_wait=True, confirmation=True)
        g.show_command('show', 'get')
        g.command('exists', 'check_existence')
        g.custom_command('list',
                         'list_resource_groups',
                         table_transformer=transform_resource_group_list)
        g.custom_command('create', 'create_resource_group')
        g.custom_command('export', 'export_group_as_template')
        g.generic_update_command('update',
                                 custom_func_name='update_resource_group',
                                 custom_func_type=resource_custom)
        g.wait_command('wait')

    with self.command_group(
            'group lock', resource_type=ResourceType.MGMT_RESOURCE_LOCKS) as g:
        g.custom_command('create', 'create_lock')
        g.custom_command('delete', 'delete_lock')
        g.custom_command('list', 'list_locks')
        g.custom_show_command('show', 'get_lock')
        g.custom_command('update', 'update_lock')

    with self.command_group(
            'resource',
            resource_custom,
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('create', 'create_resource')
        g.custom_command('delete', 'delete_resource')
        g.custom_show_command('show', 'show_resource')
        g.custom_command('list',
                         'list_resources',
                         table_transformer=transform_resource_list)
        g.custom_command('tag', 'tag_resource')
        g.custom_command('move', 'move_resource')
        g.custom_command('invoke-action', 'invoke_resource_action')
        g.generic_update_command('update',
                                 getter_name='show_resource',
                                 setter_name='update_resource',
                                 client_factory=None)

    with self.command_group(
            'resource lock',
            resource_type=ResourceType.MGMT_RESOURCE_LOCKS) as g:
        g.custom_command('create', 'create_lock')
        g.custom_command('delete', 'delete_lock')
        g.custom_command('list', 'list_locks')
        g.custom_show_command('show', 'get_lock')
        g.custom_command('update', 'update_lock')

    # Resource provider commands
    with self.command_group(
            'provider',
            resource_provider_sdk,
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.command('list', 'list')
        g.show_command('show', 'get')
        g.custom_command('register', 'register_provider')
        g.custom_command('unregister', 'unregister_provider')
        g.custom_command('operation list', 'list_provider_operations')
        g.custom_command('operation show', 'show_provider_operations')

    # Resource feature commands
    with self.command_group(
            'feature',
            resource_feature_sdk,
            client_factory=cf_features,
            resource_type=ResourceType.MGMT_RESOURCE_FEATURES) as g:
        feature_table_transform = '{Name:name, RegistrationState:properties.state}'
        g.custom_command('list',
                         'list_features',
                         table_transformer='[].' + feature_table_transform)
        g.show_command('show',
                       'get',
                       table_transformer=feature_table_transform)
        g.custom_command('register', 'register_feature')

    # Tag commands
    with self.command_group('tag', resource_tag_sdk) as g:
        g.command('list', 'list')
        g.command('create', 'create_or_update')
        g.command('delete', 'delete')
        g.command('add-value', 'create_or_update_value')
        g.command('remove-value', 'delete_value')

    with self.command_group('group deployment', resource_deployment_sdk) as g:
        g.custom_command('create',
                         'deploy_arm_template',
                         supports_no_wait=True,
                         validator=process_deployment_create_namespace,
                         exception_handler=handle_template_based_exception)
        g.command('list',
                  'list_by_resource_group',
                  table_transformer=transform_deployments_list,
                  min_api='2017-05-10')
        g.command('list',
                  'list',
                  table_transformer=transform_deployments_list,
                  max_api='2016-09-01')
        g.show_command('show', 'get')
        g.command('delete', 'delete', supports_no_wait=True)
        g.custom_command('validate',
                         'validate_arm_template',
                         table_transformer=deployment_validate_table_format,
                         exception_handler=handle_template_based_exception)
        g.custom_command('export', 'export_deployment_as_template')
        g.wait_command('wait')

    with self.command_group('group deployment operation',
                            resource_deployment_operation_sdk) as g:
        g.command('list', 'list')
        g.custom_show_command('show',
                              'get_deployment_operations',
                              client_factory=cf_deployment_operations)

    with self.command_group(
            'deployment',
            resource_deployment_sdk,
            min_api='2018-05-01',
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.command('list',
                  'list_at_subscription_scope',
                  table_transformer=transform_deployments_list)
        g.show_command('show', 'get_at_subscription_scope')
        g.command('delete',
                  'delete_at_subscription_scope',
                  supports_no_wait=True)
        g.custom_command('validate',
                         'validate_arm_template_at_subscription_scope',
                         table_transformer=deployment_validate_table_format,
                         exception_handler=handle_template_based_exception)
        g.custom_command('create',
                         'deploy_arm_template_at_subscription_scope',
                         supports_no_wait=True,
                         validator=process_deployment_create_namespace,
                         exception_handler=handle_template_based_exception)
        g.custom_command('export', 'export_subscription_deployment_template')
        g.wait_command('wait', getter_name='get_at_subscription_scope')

    with self.command_group(
            'deployment operation',
            resource_deployment_operation_sdk,
            min_api='2018-05-01',
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.command('list', 'list_at_subscription_scope')
        g.custom_show_command(
            'show',
            'get_deployment_operations_at_subscription_scope',
            client_factory=cf_deployment_operations)

    with self.command_group(
            'policy assignment',
            resource_type=ResourceType.MGMT_RESOURCE_POLICY) as g:
        g.custom_command('create', 'create_policy_assignment')
        g.custom_command('delete', 'delete_policy_assignment')
        g.custom_command('list', 'list_policy_assignment')
        g.custom_show_command('show', 'show_policy_assignment')

    with self.command_group(
            'policy definition',
            resource_policy_definitions_sdk,
            resource_type=ResourceType.MGMT_RESOURCE_POLICY) as g:
        g.custom_command('create', 'create_policy_definition')
        g.command('delete', 'delete')
        g.command('list', 'list')
        g.custom_show_command('show', 'get_policy_definition')
        g.generic_update_command('update',
                                 custom_func_name='update_policy_definition',
                                 custom_func_type=resource_custom)

    with self.command_group('policy set-definition',
                            resource_policy_set_definitions_sdk,
                            resource_type=ResourceType.MGMT_RESOURCE_POLICY,
                            min_api='2017-06-01-preview') as g:
        g.custom_command('create', 'create_policy_setdefinition')
        g.command('delete', 'delete')
        g.command('list', 'list')
        g.custom_show_command('show', 'get_policy_setdefinition')
        g.custom_command('update', 'update_policy_setdefinition')

    with self.command_group(
            'lock', resource_type=ResourceType.MGMT_RESOURCE_LOCKS) as g:
        g.custom_command('create', 'create_lock')
        g.custom_command('delete', 'delete_lock')
        g.custom_command('list', 'list_locks')
        g.custom_show_command('show', 'get_lock')
        g.custom_command('update', 'update_lock')

    with self.command_group(
            'resource link',
            resource_link_sdk,
            resource_type=ResourceType.MGMT_RESOURCE_LINKS) as g:
        g.custom_command('create', 'create_resource_link')
        g.command('delete', 'delete')
        g.show_command('show', 'get')
        g.custom_command('list', 'list_resource_links')
        g.custom_command('update', 'update_resource_link')

    with self.command_group(
            'managedapp',
            resource_managedapp_sdk,
            min_api='2017-05-10',
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('create', 'create_application')
        g.command('delete', 'delete')
        g.custom_show_command('show', 'show_application')
        g.custom_command('list', 'list_applications')

    with self.command_group(
            'managedapp definition',
            resource_managedapp_def_sdk,
            min_api='2017-05-10',
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('create', 'create_applicationdefinition')
        g.command('delete', 'delete')
        g.custom_show_command('show', 'show_applicationdefinition')
        g.command('list',
                  'list_by_resource_group',
                  exception_handler=empty_on_404)

    with self.command_group('account management-group',
                            resource_managementgroups_sdk,
                            client_factory=cf_management_groups) as g:
        g.custom_command('list', 'cli_managementgroups_group_list')
        g.custom_show_command('show', 'cli_managementgroups_group_show')
        g.custom_command('create', 'cli_managementgroups_group_create')
        g.custom_command('delete', 'cli_managementgroups_group_delete')
        g.generic_update_command(
            'update',
            getter_name='cli_managementgroups_group_update_get',
            getter_type=resource_managementgroups_update_type,
            setter_name='cli_managementgroups_group_update_set',
            setter_type=resource_managementgroups_update_type,
            custom_func_name='cli_managementgroups_group_update_custom_func',
            custom_func_type=resource_managementgroups_update_type,
            exception_handler=managementgroups_exception_handler)

    with self.command_group(
            'account management-group subscription',
            resource_managementgroups_subscriptions_sdk,
            client_factory=cf_management_group_subscriptions) as g:
        g.custom_command('add', 'cli_managementgroups_subscription_add')
        g.custom_command('remove', 'cli_managementgroups_subscription_remove')
# coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

"""
Load CLI commands
"""
from azure.cli.core.commands import CliCommandType

pnp_repo_ops = CliCommandType(operations_tmpl="azext_iot.pnp.commands_repository#{}")
pnp_model_ops = CliCommandType(operations_tmpl="azext_iot.pnp.commands_api#{}")


def load_pnp_commands(self, _):
    """
    Load CLI commands
    """
    with self.command_group(
        "iot pnp role-assignment", command_type=pnp_repo_ops, is_preview=True
    ) as cmd_group:
        cmd_group.command("create", "iot_pnp_role_create")
        cmd_group.command("list", "iot_pnp_role_list")
        cmd_group.command("delete", "iot_pnp_role_delete")

    with self.command_group(
        "iot pnp repo", command_type=pnp_repo_ops, is_preview=True
    ) as cmd_group:
        cmd_group.command("create", "iot_pnp_tenant_create")
        cmd_group.command("list", "iot_pnp_tenant_show")
def load_command_table(self, _):

    network_util = CliCommandType(operations_tmpl='azext_firewall._util#{}',
                                  client_factory=None)

    network_firewall_sdk = CliCommandType(
        operations_tmpl=
        'azext_firewall.vendored_sdks.v2020_05_01.operations#AzureFirewallsOperations.{}',
        client_factory=cf_firewalls,
        resource_type=CUSTOM_FIREWALL,
        min_api='2018-08-01')

    network_firewall_fqdn_tags_sdk = CliCommandType(
        operations_tmpl=
        'azext_firewall.vendored_sdks.v2020_05_01.operations#AzureFirewallFqdnTagsOperations.{}',
        client_factory=cf_firewall_fqdn_tags,
        resource_type=CUSTOM_FIREWALL,
        min_api='2018-08-01')

    network_firewall_policies_sdk = CliCommandType(
        operations_tmpl=
        'azext_firewall.vendored_sdks.v2020_05_01.operations#FirewallPoliciesOperations.{}',
        client_factory=cf_firewall_policies,
        resource_type=CUSTOM_FIREWALL,
        min_api='2019-07-01')

    network_firewall_policy_rule_groups = CliCommandType(
        operations_tmpl=
        'azext_firewall.vendored_sdks.v2020_05_01.operations#FirewallPolicyRuleCollectionGroupsOperations.{}',
        client_factory=cf_firewall_policy_rule_collection_groups,
        resource_type=CUSTOM_FIREWALL,
        min_api='2019-07-01')

    # region AzureFirewalls
    with self.command_group('network firewall', network_firewall_sdk) as g:
        g.custom_command('create', 'create_azure_firewall')
        g.command('delete', 'delete')
        g.custom_command('list', 'list_azure_firewalls')
        g.show_command('show')
        g.generic_update_command('update',
                                 custom_func_name='update_azure_firewall')

    with self.command_group('network firewall threat-intel-whitelist',
                            network_firewall_sdk,
                            is_preview=True,
                            min_api='2019-09-01') as g:
        g.custom_command('create',
                         'create_azure_firewall_threat_intel_whitelist')
        g.custom_command('delete',
                         'delete_azure_firewall_threat_intel_whitelist')
        g.custom_command('show', 'show_azure_firewall_threat_intel_whitelist')
        g.generic_update_command(
            'update',
            custom_func_name='update_azure_firewall_threat_intel_whitelist')

    with self.command_group('network firewall ip-config', network_util) as g:
        g.custom_command('create', 'create_af_ip_configuration')
        g.command(
            'list',
            list_network_resource_property('azure_firewalls',
                                           'ip_configurations'))
        g.show_command(
            'show',
            get_network_resource_property_entry('azure_firewalls',
                                                'ip_configurations'))
        g.custom_command('delete', 'delete_af_ip_configuration')

    with self.command_group('network firewall management-ip-config',
                            network_util,
                            is_preview=True) as g:
        # https://github.com/Azure/azure-cli-extensions/issues/1270
        # disable it by service limitation.
        # g.custom_command('create', 'create_af_management_ip_configuration')
        g.custom_show_command('show', 'show_af_management_ip_configuration')
        g.generic_update_command(
            'update',
            command_type=network_firewall_sdk,
            custom_func_name='update_af_management_ip_configuration',
            setter_type=CliCommandType(
                operations_tmpl='azext_firewall.custom#{}'),
            setter_name='set_af_management_ip_configuration')
        # Discussed with service team to hide this command for now.
        # g.custom_command('delete', 'delete_af_management_ip_configuration')

    af_rules = {
        'network_rule': {
            'scope': 'network-rule',
            'validator': validate_af_network_rule
        },
        'nat_rule': {
            'scope': 'nat-rule',
            'validator': validate_af_nat_rule
        },
        'application_rule': {
            'scope': 'application-rule',
            'validator': validate_af_application_rule
        }
    }

    for rule_type, af_rule in af_rules.items():
        with self.command_group('network firewall {}'.format(af_rule['scope']),
                                network_firewall_sdk) as g:
            g.custom_command('create',
                             'create_af_{}'.format(rule_type),
                             validator=af_rule['validator'])
            g.custom_command(
                'list',
                build_af_rule_list(rule_type,
                                   '{}_collections'.format(rule_type)))
            g.custom_command(
                'show',
                build_af_rule_show(rule_type,
                                   '{}_collections'.format(rule_type)))
            g.custom_command(
                'delete',
                build_af_rule_delete(rule_type,
                                     '{}_collections'.format(rule_type)))

    af_collections = {
        'network_rule_collections': 'network-rule collection',
        'nat_rule_collections': 'nat-rule collection',
        'application_rule_collections': 'application-rule collection'
    }
    for subresource, scope in af_collections.items():
        with self.command_group('network firewall {}'.format(scope),
                                network_util) as g:
            g.command(
                'list',
                list_network_resource_property('azure_firewalls', subresource))
            g.show_command(
                'show',
                get_network_resource_property_entry('azure_firewalls',
                                                    subresource))
            g.command(
                'delete',
                delete_network_resource_property_entry('azure_firewalls',
                                                       subresource))

    with self.command_group('network firewall',
                            network_firewall_fqdn_tags_sdk) as g:
        g.command('list-fqdn-tags', 'list_all')
    # endregion

    # region AzureFirewallPolicies
    with self.command_group('network firewall policy',
                            network_firewall_policies_sdk,
                            resource_type=CUSTOM_FIREWALL,
                            is_preview=True,
                            min_api='2019-07-01') as g:
        g.custom_command('create', 'create_azure_firewall_policies')
        g.command('delete', 'delete')
        g.custom_command('list', 'list_azure_firewall_policies')
        g.show_command('show')
        g.generic_update_command(
            'update', custom_func_name='update_azure_firewall_policies')

    with self.command_group('network firewall policy rule-collection-group',
                            network_firewall_policy_rule_groups,
                            resource_type=CUSTOM_FIREWALL,
                            is_preview=True) as g:
        g.custom_command('create',
                         'create_azure_firewall_policy_rule_collection_group')
        g.generic_update_command(
            'update',
            custom_func_name=
            'update_azure_firewall_policy_rule_collection_group')
        g.command('delete', 'delete')
        g.show_command('show')
        g.command('list', 'list')

    with self.command_group(
            'network firewall policy rule-collection-group collection',
            network_firewall_policy_rule_groups,
            resource_type=CUSTOM_FIREWALL,
            is_preview=True) as g:
        g.custom_command('add-nat-collection',
                         'add_azure_firewall_policy_nat_rule_collection')
        g.custom_command('add-filter-collection',
                         'add_azure_firewall_policy_filter_rule_collection')
        g.custom_command('remove',
                         'remove_azure_firewall_policy_rule_collection')
        g.custom_command('list', 'list_azure_firewall_policy_rule_collection')

    with self.command_group(
            'network firewall policy rule-collection-group collection rule',
            network_firewall_policy_rule_groups,
            resource_type=CUSTOM_FIREWALL,
            is_preview=True) as g:
        g.custom_command('add', 'add_azure_firewall_policy_filter_rule')
        g.custom_command('remove', 'remove_azure_firewall_policy_filter_rule')
Exemple #23
0
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)

    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, 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:
        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')

    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)
Exemple #24
0
def load_command_table(self, _):
    from azure.cli.core.commands import CliCommandType
    from ._client_factory import cf_hdinsight_applications
    from ._client_factory import cf_hdinsight_clusters
    from ._client_factory import cf_hdinsight_extensions
    from ._client_factory import cf_hdinsight_locations
    from ._client_factory import cf_hdinsight_script_execution_history
    from ._client_factory import cf_hdinsight_script_actions

    hdinsight_clusters_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.hdinsight.operations#ClustersOperations.{}',
        client_factory=cf_hdinsight_clusters)

    hdinsight_script_actions_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.hdinsight.operations#ScriptActionsOperations.{}',
        client_factory=cf_hdinsight_script_actions)

    hdinsight_applications_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.hdinsight.operations#ApplicationsOperations.{}',
        client_factory=cf_hdinsight_applications)

    hdinsight_extensions_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.hdinsight.operations#ExtensionsOperations.{}',
        client_factory=cf_hdinsight_extensions)

    hdinsight_locations_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.hdinsight.operations#LocationsOperations.{}',
        client_factory=cf_hdinsight_locations)

    hdinsight_script_execution_history_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.hdinsight.operations#ScriptExecutionHistoryOperations.{}',
        client_factory=cf_hdinsight_script_execution_history)

    # cluster operations
    with self.command_group('hdinsight',
                            hdinsight_clusters_sdk,
                            client_factory=cf_hdinsight_clusters) as g:
        g.custom_command('create', 'create_cluster', supports_no_wait=True)
        g.command('resize', 'resize', supports_no_wait=True)
        g.show_command('show', 'get')
        g.custom_command('list', 'list_clusters')
        g.wait_command('wait')
        g.command('delete', 'delete', confirmation=True, supports_no_wait=True)
        g.custom_command('rotate-disk-encryption-key',
                         'rotate_hdi_cluster_key',
                         supports_no_wait=True)
        g.command('update', 'update', supports_no_wait=True)

    # usage operations
    with self.command_group('hdinsight',
                            hdinsight_locations_sdk,
                            client_factory=cf_hdinsight_locations) as g:
        g.command('list-usage', 'list_usages')

    # script action operations
    with self.command_group('hdinsight script-action',
                            hdinsight_script_actions_sdk,
                            client_factory=cf_hdinsight_script_actions) as g:
        g.show_command('show', 'get_execution_detail')
        g.custom_command('list', 'list_hdi_script_actions')
        g.command('delete', 'delete')
        g.custom_command('execute',
                         'execute_hdi_script_action',
                         command_type=hdinsight_clusters_sdk,
                         client_factory=cf_hdinsight_clusters)
        g.command('promote',
                  'promote',
                  command_type=hdinsight_script_execution_history_sdk,
                  client_factory=cf_hdinsight_script_execution_history)

    # application operations
    with self.command_group('hdinsight application',
                            hdinsight_applications_sdk,
                            client_factory=cf_hdinsight_applications) as g:
        g.custom_command('create', 'create_hdi_application')
        g.show_command('show', 'get')
        g.command('list', 'list_by_cluster')
        g.wait_command('wait')
        g.command('delete', 'delete', confirmation=True, supports_no_wait=True)

    # Monitoring operations
    with self.command_group('hdinsight monitor',
                            hdinsight_extensions_sdk,
                            client_factory=cf_hdinsight_extensions) as g:
        g.show_command('show', 'get_monitoring_status')
        g.custom_command('enable', 'enable_hdi_monitoring')
        g.command('disable', 'disable_monitoring')

    with self.command_group('hdinsight', is_preview=True):
        pass
Exemple #25
0
def load_command_table(self, _):
    from ._client_factory import cf_synapse_client_workspace_factory
    from ._client_factory import cf_synapse_client_operations_factory
    from ._client_factory import cf_synapse_client_bigdatapool_factory
    from ._client_factory import cf_synapse_client_sqlpool_factory
    from ._client_factory import cf_synapse_client_ipfirewallrules_factory
    from ._client_factory import cf_synapse_client_sqlpool_sensitivity_labels_factory
    from ._client_factory import cf_synapse_client_restorable_dropped_sqlpools_factory
    from ._client_factory import cf_synapse_client_sqlpool_transparent_data_encryptions_factory
    from ._client_factory import cf_synapse_client_sqlpool_security_alert_policies_factory
    from ._client_factory import cf_synapse_client_sqlpool_blob_auditing_policies_factory
    from ._client_factory import cf_synapse_client_workspace_aad_admins_factory
    from ._client_factory import cf_synapse_client_sqlserver_blob_auditing_policies_factory
    from ._client_factory import cf_synapse_client_integrationruntimes_factory
    from ._client_factory import cf_synapse_client_integrationruntimeauthkeys_factory
    from ._client_factory import cf_synapse_client_integrationruntimemonitoringdata_factory
    from ._client_factory import cf_synapse_client_integrationruntimenodeipaddress_factory
    from ._client_factory import cf_synapse_client_integrationruntimenodes_factory
    from ._client_factory import cf_synapse_client_integrationruntimecredentials_factory
    from ._client_factory import cf_synapse_client_integrationruntimeconnectioninfos_factory
    from ._client_factory import cf_synapse_client_integrationruntimestatus_factory

    def get_custom_sdk(custom_module, client_factory):
        return CliCommandType(
            operations_tmpl='azure.cli.command_modules.synapse.operations.{}#'.
            format(custom_module) + '{}',
            client_factory=client_factory,
        )

    synapse_workspace_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.synapse.operations#WorkspacesOperations.{}',
        client_factory=cf_synapse_client_workspace_factory)

    synapse_operations_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.synapse.operations#Operations.{}',
        client_factory=cf_synapse_client_operations_factory)

    synapse_bigdatapool_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#BigDataPoolsOperations.{}',
        client_factory=cf_synapse_client_bigdatapool_factory)

    synapse_workspace_aad_admin_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#WorkspaceAadAdminsOperations.{}')

    synapse_sqlpool_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.synapse.operations#SqlPoolsOperations.{}',
        client_factory=cf_synapse_client_sqlpool_factory)

    # Classification operation
    synapse_sqlpool_sensitivity_labels_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#SqlPoolSensitivityLabelsOperations.{}',
        client_factory=cf_synapse_client_sqlpool_sensitivity_labels_factory)

    # List deleted
    synapse_restorable_dropped_sqlpools_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#RestorableDroppedSqlPoolsOperations.{}',
        client_factory=cf_synapse_client_restorable_dropped_sqlpools_factory)

    # Tde operation
    synapse_sqlpool_transparent_data_encryptions_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#SqlPoolTransparentDataEncryptionsOperations.{}',
        client_factory=
        cf_synapse_client_sqlpool_transparent_data_encryptions_factory)

    # Threat policy operation
    synapse_sqlpool_security_alert_policies_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#SqlPoolSecurityAlertPoliciesOperations.{}',
        client_factory=cf_synapse_client_sqlpool_security_alert_policies_factory
    )

    # Audit policy operation
    synapse_sqlpool_blob_auditing_policies_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#SqlPoolBlobAuditingPoliciesOperations.{}',
        client_factory=cf_synapse_client_sqlpool_blob_auditing_policies_factory
    )

    # Workspace managed sql server audit policy operation
    synapse_workspace_managed_sqlserver_blob_auditing_policies_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#WorkspaceManagedSqlServerBlobAuditingPoliciesOperations.{}',
        client_factory=
        cf_synapse_client_sqlserver_blob_auditing_policies_factory)

    synapse_firewallrules_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#IpFirewallRulesOperations.{}',
        client_factory=cf_synapse_client_ipfirewallrules_factory)

    synapse_integrationruntimes_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#IntegrationRuntimesOperations.{}',
        client_factory=cf_synapse_client_integrationruntimes_factory)

    synapse_integrationruntimeauthkeys_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#IntegrationRuntimeAuthKeysOperations.{}',
        client_factory=cf_synapse_client_integrationruntimeauthkeys_factory)

    synapse_integrationruntimemonitoringdata_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#IntegrationRuntimeMonitoringDataOperations.{}',
        client_factory=
        cf_synapse_client_integrationruntimemonitoringdata_factory)

    synapse_integrationruntimenodes_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#IntegrationRuntimeNodesOperations.{}',
        client_factory=cf_synapse_client_integrationruntimenodes_factory)

    synapse_integrationruntimenodeipaddress_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#IntegrationRuntimeNodeIpAddressOperations.{}',
        client_factory=cf_synapse_client_integrationruntimenodeipaddress_factory
    )

    synapse_integrationruntimecredentials_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#IntegrationRuntimeCredentialsOperations.{}',
        client_factory=cf_synapse_client_integrationruntimecredentials_factory)

    synapse_integrationruntimeconnectioninfos_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#IntegrationRuntimeConnectionInfosOperations.{}',
        client_factory=
        cf_synapse_client_integrationruntimeconnectioninfos_factory)

    synapse_integrationruntimestatus_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#IntegrationRuntimeStatusOperations.{}',
        client_factory=cf_synapse_client_integrationruntimestatus_factory)

    synapse_spark_session_sdk = CliCommandType(
        operations_tmpl=
        'azure.synapse.spark.operations#SparkSessionOperations.{}',
        client_factory=None)

    synapse_spark_batch_sdk = CliCommandType(
        operations_tmpl=
        'azure.synapse.spark.operations#SparkBatchOperations.{}',
        client_factory=None)

    synapse_accesscontrol_sdk = CliCommandType(
        operations_tmpl=
        'azure.synapse.accesscontrol.operations#AccessControlClientOperationsMixin.{}',
        client_factory=None)

    synapse_linked_service_sdk = CliCommandType(
        operation_tmpl=
        'azure.synapse.artifacts.operations#LinkedServiceOperations.{}',
        client_factory=None)

    synapse_dataset_sdk = CliCommandType(
        operation_tmpl=
        'azure.synapse.artifacts.operations#DatasetOperations.{}',
        client_factory=None)

    synapse_pipeline_sdk = CliCommandType(
        operation_tmpl=
        'azure.synapse.artifacts.operations#PipelineOperations.{}',
        client_factory=None)

    synapse_pipeline_run_sdk = CliCommandType(
        operation_tmpl=
        'azure.synapse.artifacts.operations#PipelineRunOperations.{}',
        client_factory=None)

    synapse_trigger_sdk = CliCommandType(
        operation_tmpl=
        'azure.synapse.artifacts.operations#TriggerOperations.{}',
        client_factory=None)

    synapse_data_flow_sdk = CliCommandType(
        operation_tmpl=
        'azure.synapse.artifacts.operations#DataFlowOperations.{}',
        client_factory=None)

    synapse_trigger_run_sdk = CliCommandType(
        operation_tmpl=
        'azure.synapse.artifacts.operations#TriggerRunOperations.{}',
        client_factory=None)

    synapse_notebook_sdk = CliCommandType(
        operation_tmpl=
        'azure.synapse.artifacts.operations#NotebookOperations.{}',
        client_factory=None)

    # Management Plane Commands --Workspace
    with self.command_group(
            'synapse workspace',
            command_type=synapse_workspace_sdk,
            custom_command_type=get_custom_sdk(
                'workspace', cf_synapse_client_workspace_factory),
            client_factory=cf_synapse_client_workspace_factory) as g:
        g.show_command('show', 'get')
        g.custom_command('list', 'list_workspaces')
        g.custom_command('create', 'create_workspace', supports_no_wait=True)
        g.custom_command('update', 'update_workspace', supports_no_wait=True)
        g.custom_command('check-name',
                         'custom_check_name_availability',
                         command_type=synapse_operations_sdk,
                         client_factory=cf_synapse_client_operations_factory)
        g.command('delete', 'delete', confirmation=True, supports_no_wait=True)
        g.wait_command('wait')

    # Management Plane Commands --SparkPool
    with self.command_group(
            'synapse spark pool',
            command_type=synapse_bigdatapool_sdk,
            custom_command_type=get_custom_sdk(
                'sparkpool', cf_synapse_client_bigdatapool_factory),
            client_factory=cf_synapse_client_bigdatapool_factory) as g:
        g.custom_show_command('show', 'get_spark_pool')
        g.command('list', 'list_by_workspace')
        g.custom_command('create', 'create_spark_pool', supports_no_wait=True)
        g.custom_command('update', 'update_spark_pool', supports_no_wait=True)
        g.custom_command('delete',
                         'delete_spark_pool',
                         confirmation=True,
                         supports_no_wait=True)
        g.wait_command('wait')

    # Management Plane Commands --SqlPool
    with self.command_group(
            'synapse sql pool',
            command_type=synapse_sqlpool_sdk,
            custom_command_type=get_custom_sdk(
                'sqlpool', cf_synapse_client_sqlpool_factory),
            client_factory=cf_synapse_client_sqlpool_factory) as g:
        g.show_command('show', 'get')
        g.command('list', 'list_by_workspace')
        g.custom_command('create', 'create_sql_pool', supports_no_wait=True)
        g.command('delete', 'delete', confirmation=True, supports_no_wait=True)
        g.custom_command('update', 'update_sql_pool')
        g.command('pause', 'pause')
        g.command('resume', 'resume')
        g.custom_command('restore', 'restore_sql_pool')
        g.custom_command('show-connection-string',
                         'sql_pool_show_connection_string')
        g.wait_command('wait')

    # Management Plane Commands --SqlPool list-deleted
    with self.command_group(
            'synapse sql pool',
            command_type=synapse_restorable_dropped_sqlpools_sdk,
            client_factory=cf_synapse_client_restorable_dropped_sqlpools_factory
    ) as g:
        g.command('list-deleted', 'list_by_workspace')

    #  Management Plane Commands --SqlPool Classification
    with self.command_group(
            'synapse sql pool classification',
            command_type=synapse_sqlpool_sensitivity_labels_sdk,
            custom_command_type=get_custom_sdk(
                'sqlpoolsensitivitylabel',
                cf_synapse_client_sqlpool_sensitivity_labels_factory),
            client_factory=cf_synapse_client_sqlpool_sensitivity_labels_factory
    ) as g:
        g.custom_show_command('show', 'sqlpool_sensitivity_label_show')
        g.command('list', 'list_current')
        g.custom_command('create', 'sqlpool_sensitivity_label_create')
        g.command('delete', 'delete')
        g.custom_command('update', 'sqlpool_sensitivity_label_update')

    with self.command_group(
            'synapse sql pool classification recommendation',
            command_type=synapse_sqlpool_sensitivity_labels_sdk,
            custom_command_type=get_custom_sdk(
                'sqlpoolsensitivitylabel',
                cf_synapse_client_sqlpool_sensitivity_labels_factory),
            client_factory=cf_synapse_client_sqlpool_sensitivity_labels_factory
    ) as g:
        g.command('list', 'list_recommended')
        g.command('enable', 'enable_recommendation')
        g.command('disable', 'disable_recommendation')

    #  Management Plane Commands --SqlPool Tde
    with self.command_group(
            'synapse sql pool tde',
            command_type=synapse_sqlpool_transparent_data_encryptions_sdk,
            client_factory=
            cf_synapse_client_sqlpool_transparent_data_encryptions_factory
    ) as g:
        g.command('set', 'create_or_update')
        g.show_command('show', 'get')

    #  Management Plane Commands --SqlPool Threat-policy
    with self.command_group(
            'synapse sql pool threat-policy',
            command_type=synapse_sqlpool_security_alert_policies_sdk,
            custom_command_type=get_custom_sdk(
                'sqlpoolsecurityalertpolicy',
                cf_synapse_client_sqlpool_security_alert_policies_factory),
            client_factory=
            cf_synapse_client_sqlpool_security_alert_policies_factory) as g:
        g.show_command('show', 'get')
        g.generic_update_command(
            'update', custom_func_name='sqlpool_security_alert_policy_update')

    #  Management Plane Commands --SqlPool Audit-policy
    with self.command_group(
            'synapse sql pool audit-policy',
            command_type=synapse_sqlpool_blob_auditing_policies_sdk,
            custom_command_type=get_custom_sdk(
                'sqlpoolblobauditingpolicy',
                cf_synapse_client_sqlpool_blob_auditing_policies_factory),
            client_factory=
            cf_synapse_client_sqlpool_blob_auditing_policies_factory) as g:
        g.show_command('show', 'get')
        g.generic_update_command(
            'update',
            custom_func_name='sqlpool_blob_auditing_policy_update',
            validator=validate_audit_policy_arguments)

    # Management Plane Commands --Sql Ad-Admin
    with self.command_group(
            'synapse sql ad-admin',
            command_type=synapse_workspace_aad_admin_sdk,
            custom_command_type=get_custom_sdk(
                'workspacesqlaadadmin',
                cf_synapse_client_workspace_aad_admins_factory),
            client_factory=cf_synapse_client_workspace_aad_admins_factory
    ) as g:
        g.show_command('show', 'get')
        g.custom_command('create',
                         'create_workspace_sql_aad_admin',
                         supports_no_wait=True)
        g.generic_update_command(
            'update',
            custom_func_name='update_workspace_sql_aad_admin',
            setter_arg_name='aad_admin_info',
            supports_no_wait=True)
        g.command('delete', 'delete', confirmation=True, supports_no_wait=True)
        g.wait_command('wait')

    # Management Plane Commands --Sql audit-policy
    with self.command_group(
            'synapse sql audit-policy',
            command_type=
            synapse_workspace_managed_sqlserver_blob_auditing_policies_sdk,
            custom_command_type=get_custom_sdk(
                'sqlpoolblobauditingpolicy',
                cf_synapse_client_sqlserver_blob_auditing_policies_factory),
            client_factory=
            cf_synapse_client_sqlserver_blob_auditing_policies_factory) as g:
        g.show_command('show', 'get')
        g.generic_update_command(
            'update',
            custom_func_name='sqlserver_blob_auditing_policy_update',
            supports_no_wait=True,
            validator=validate_audit_policy_arguments)
        g.wait_command('wait')

    # Management Plane Commands --FirewallRule
    with self.command_group(
            'synapse workspace firewall-rule',
            command_type=synapse_firewallrules_sdk,
            custom_command_type=get_custom_sdk(
                'workspace', cf_synapse_client_ipfirewallrules_factory),
            client_factory=cf_synapse_client_ipfirewallrules_factory) as g:
        g.command('list', 'list_by_workspace')
        g.show_command('show', 'get')
        g.custom_command('create',
                         'create_firewall_rule',
                         supports_no_wait=True)
        g.custom_command('update',
                         'update_firewall_rule',
                         supports_no_wait=True)
        g.command('delete', 'delete', confirmation=True, supports_no_wait=True)
        g.wait_command('wait')

    # Management Plane Commands --IntegrationRuntime
    with self.command_group(
            'synapse integration-runtime',
            command_type=synapse_integrationruntimes_sdk,
            custom_command_type=get_custom_sdk(
                'integrationruntime',
                cf_synapse_client_integrationruntimes_factory),
            client_factory=cf_synapse_client_integrationruntimes_factory) as g:
        g.command('list', 'list_by_workspace')
        g.show_command('show', 'get')
        g.custom_command('create', 'create', supports_no_wait=True)
        g.command('delete', 'delete', confirmation=True, supports_no_wait=True)
        g.command('update', 'update')
        g.command('upgrade', 'upgrade')
        g.command(
            'list-auth-key',
            'list',
            command_type=synapse_integrationruntimeauthkeys_sdk,
            client_factory=cf_synapse_client_integrationruntimeauthkeys_factory
        )
        g.command(
            'regenerate-auth-key',
            'regenerate',
            command_type=synapse_integrationruntimeauthkeys_sdk,
            client_factory=cf_synapse_client_integrationruntimeauthkeys_factory
        )
        g.command('get-monitoring-data',
                  'list',
                  command_type=synapse_integrationruntimemonitoringdata_sdk,
                  client_factory=
                  cf_synapse_client_integrationruntimemonitoringdata_factory)
        g.command('sync-credentials',
                  'sync',
                  command_type=synapse_integrationruntimecredentials_sdk,
                  client_factory=
                  cf_synapse_client_integrationruntimecredentials_factory)
        g.command('get-connection-info',
                  'get',
                  command_type=synapse_integrationruntimeconnectioninfos_sdk,
                  client_factory=
                  cf_synapse_client_integrationruntimeconnectioninfos_factory)
        g.command(
            'get-status',
            'get',
            command_type=synapse_integrationruntimestatus_sdk,
            client_factory=cf_synapse_client_integrationruntimestatus_factory)
        g.wait_command('wait')

    with self.command_group(
            'synapse integration-runtime-node',
            command_type=synapse_integrationruntimenodes_sdk,
            client_factory=cf_synapse_client_integrationruntimenodes_factory
    ) as g:
        g.show_command('show', 'get')
        g.command('update', 'update')
        g.command('delete', 'delete', confirmation=True)
        g.command('get-ip-address',
                  'get',
                  command_type=synapse_integrationruntimenodeipaddress_sdk,
                  client_factory=
                  cf_synapse_client_integrationruntimenodeipaddress_factory)

    # Data Plane Commands --Spark batch opertions
    with self.command_group('synapse spark job',
                            command_type=synapse_spark_batch_sdk,
                            custom_command_type=get_custom_sdk('spark',
                                                               None)) as g:
        g.custom_command('submit', 'create_spark_batch_job')
        g.custom_command('list', 'list_spark_batch_jobs')
        g.custom_show_command('show', 'get_spark_batch_job')
        g.custom_command('cancel', 'cancel_spark_batch_job', confirmation=True)

    # Data Plane Commands --Spark session operations
    with self.command_group('synapse spark session',
                            synapse_spark_session_sdk,
                            custom_command_type=get_custom_sdk('spark',
                                                               None)) as g:
        g.custom_command('create', 'create_spark_session_job')
        g.custom_command('list', 'list_spark_session_jobs')
        g.custom_show_command('show', 'get_spark_session_job')
        g.custom_command('cancel',
                         'cancel_spark_session_job',
                         confirmation=True)
        g.custom_command('reset-timeout', 'reset_timeout')

    # Data Plane Commands --Spark session statements operations
    with self.command_group('synapse spark statement',
                            synapse_spark_session_sdk,
                            custom_command_type=get_custom_sdk('spark',
                                                               None)) as g:
        g.custom_command('invoke', 'create_spark_session_statement')
        g.custom_command('list', 'list_spark_session_statements')
        g.custom_show_command('show', 'get_spark_session_statement')
        g.custom_command('cancel',
                         'cancel_spark_session_statement',
                         confirmation=True)

    # Data Plane Commands --Access control operations
    with self.command_group('synapse role assignment',
                            synapse_accesscontrol_sdk,
                            custom_command_type=get_custom_sdk(
                                'accesscontrol', None)) as g:
        g.custom_command('create', 'create_role_assignment')
        g.custom_command('list', 'list_role_assignments')
        g.custom_show_command('show', 'get_role_assignment_by_id')
        g.custom_command('delete', 'delete_role_assignment', confirmation=True)

    with self.command_group('synapse role definition',
                            synapse_accesscontrol_sdk,
                            custom_command_type=get_custom_sdk(
                                'accesscontrol', None)) as g:
        g.custom_command('list', 'list_role_definitions')
        g.custom_show_command('show', 'get_role_definition')

    # Data Plane Commands --Artifacts Linked service operations
    with self.command_group('synapse linked-service',
                            synapse_linked_service_sdk,
                            custom_command_type=get_custom_sdk(
                                'artifacts', None)) as g:
        g.custom_command('create',
                         'create_or_update_linked_service',
                         supports_no_wait=True)
        g.custom_command('set',
                         'create_or_update_linked_service',
                         supports_no_wait=True)
        g.custom_command('list', 'list_linked_service')
        g.custom_show_command('show', 'get_linked_service')
        g.custom_command('delete',
                         'delete_linked_service',
                         confirmation=True,
                         supports_no_wait=True)

    # Data Plane Commands --Artifacts dataset operations
    with self.command_group('synapse dataset',
                            synapse_dataset_sdk,
                            custom_command_type=get_custom_sdk(
                                'artifacts', None)) as g:
        g.custom_command('create',
                         'create_or_update_dataset',
                         supports_no_wait=True)
        g.custom_command('set',
                         'create_or_update_dataset',
                         supports_no_wait=True)
        g.custom_command('list', 'list_datasets')
        g.custom_show_command('show', 'get_dataset')
        g.custom_command('delete',
                         'delete_dataset',
                         confirmation=True,
                         supports_no_wait=True)

    # Data Plane Commands --Artifacts pipeline operations
    with self.command_group('synapse pipeline',
                            synapse_pipeline_sdk,
                            custom_command_type=get_custom_sdk(
                                'artifacts', None)) as g:
        g.custom_command('create',
                         'create_or_update_pipeline',
                         supports_no_wait=True)
        g.custom_command('set',
                         'create_or_update_pipeline',
                         supports_no_wait=True)
        g.custom_command('list', 'list_pipelines')
        g.custom_show_command('show', 'get_pipeline')
        g.custom_command('delete',
                         'delete_pipeline',
                         confirmation=True,
                         supports_no_wait=True)
        g.custom_command('create-run', 'create_pipeline_run')

    # Data Plane Commands --Artifacts pipeline run operations
    with self.command_group('synapse pipeline-run',
                            synapse_pipeline_run_sdk,
                            custom_command_type=get_custom_sdk(
                                'artifacts', None)) as g:
        g.custom_command('query-by-workspace',
                         'query_pipeline_runs_by_workspace')
        g.custom_show_command('show', 'get_pipeline_run')
        g.custom_command('cancel', 'cancel_pipeline_run', confirmation=True)

    with self.command_group('synapse activity-run',
                            synapse_pipeline_run_sdk,
                            custom_command_type=get_custom_sdk(
                                'artifacts', None)) as g:
        g.custom_command('query-by-pipeline-run', 'query_activity_runs')

    # Data Plane Commands --Artifacts trigger operations
    with self.command_group('synapse trigger',
                            synapse_trigger_sdk,
                            custom_command_type=get_custom_sdk(
                                'artifacts', None)) as g:
        g.custom_command('create',
                         'create_or_update_trigger',
                         supports_no_wait=True)
        g.custom_command('set',
                         'create_or_update_trigger',
                         supports_no_wait=True)
        g.custom_command('list', 'list_triggers')
        g.custom_show_command('show', 'get_trigger')
        g.custom_command('delete',
                         'delete_trigger',
                         confirmation=True,
                         supports_no_wait=True)
        g.custom_command('subscribe-to-event',
                         'subscribe_trigger_to_events',
                         supports_no_wait=True)
        g.custom_command('get-event-subscription-status',
                         'get_event_subscription_status')
        g.custom_command('unsubscribe-from-event',
                         'unsubscribe_trigger_from_events',
                         supports_no_wait=True)
        g.custom_command('start', 'start_trigger', supports_no_wait=True)
        g.custom_command('stop', 'stop_trigger', supports_no_wait=True)

    # Data Plane Commands --Artifacts trigger run operations
    with self.command_group('synapse trigger-run',
                            synapse_trigger_run_sdk,
                            custom_command_type=get_custom_sdk(
                                'artifacts', None)) as g:
        g.custom_command('rerun', 'rerun_trigger')
        g.custom_command('query-by-workspace',
                         'query_trigger_runs_by_workspace')

    # Data Plane Commands --Artifacts data flow operations
    with self.command_group('synapse data-flow',
                            synapse_data_flow_sdk,
                            custom_command_type=get_custom_sdk(
                                'artifacts', None)) as g:
        g.custom_command('create',
                         'create_or_update_data_flow',
                         supports_no_wait=True)
        g.custom_command('set',
                         'create_or_update_data_flow',
                         supports_no_wait=True)
        g.custom_command('list', 'list_data_flows')
        g.custom_show_command('show', 'get_data_flow')
        g.custom_command('delete',
                         'delete_data_flow',
                         confirmation=True,
                         supports_no_wait=True)

    # Data Plane Commands --Artifacts notebook operations
    with self.command_group('synapse notebook',
                            synapse_notebook_sdk,
                            custom_command_type=get_custom_sdk(
                                'artifacts', None)) as g:
        g.custom_command('create',
                         'create_or_update_notebook',
                         supports_no_wait=True)
        g.custom_command('set',
                         'create_or_update_notebook',
                         supports_no_wait=True)
        g.custom_command('import',
                         'create_or_update_notebook',
                         supports_no_wait=True)
        g.custom_command('list', 'list_notebooks')
        g.custom_show_command('show', 'get_notebook')
        g.custom_command('export', 'export_notebook')
        g.custom_command('delete',
                         'delete_notebook',
                         confirmation=True,
                         supports_no_wait=True)

    with self.command_group('synapse', is_preview=True):
        pass
Exemple #26
0
def load_command_table(self, _):
    botOperations_commandType = CliCommandType(
        operations_tmpl='azure.mgmt.botservice.operations#BotsOperations.{}',
        client_factory=get_botservice_management_client,
        exception_handler=bot_exception_handler)

    botServices_commandType = CliCommandType(
        operations_tmpl='azure.mgmt.botservice.operations#BotsOperations.{}',
        client_factory=get_botOperations_client,
        exception_handler=bot_exception_handler)

    botConnections_commandType = CliCommandType(
        operations_tmpl=
        'azure.mgmt.botservice.operations#BotConnectionOperations.{}',
        client_factory=get_botConnections_client,
        exception_handler=bot_exception_handler)

    channelOperations_commandType = CliCommandType(
        operations_tmpl=
        'azure.cli.command_modules.botservice.channel_operations#channelOperationsInstance.{}',
        client_factory=get_botChannels_client,
        exception_handler=bot_exception_handler)

    channelOperationsCreate_commandType = CliCommandType(
        operations_tmpl=
        'azure.cli.command_modules.botservice.channel_operations#{}',
        client_factory=get_botChannels_client,
        exception_handler=bot_exception_handler)

    updateBotService_commandType = CliCommandType(
        operations_tmpl='azure.mgmt.botservice.operations#BotsOperations.{}',
        client_factory=get_botOperations_client,
        exception_handler=bot_exception_handler)

    with self.command_group('bot', botOperations_commandType) as g:
        g.custom_command('create', 'create')
        g.custom_command('publish', 'publish_app')
        g.custom_command('download', 'download_app')
        g.custom_command('prepare-publish', 'prepare_publish')

    with self.command_group('bot', botServices_commandType) as g:
        g.custom_command('show', 'get_bot')
        g.command('delete', 'delete')

    # Begin "bot authsetting" command registration
    with self.command_group('bot authsetting',
                            botConnections_commandType) as g:
        g.command('list', 'list_by_bot_service')
        g.command('show', 'get')
        g.command('delete', 'delete')

    with self.command_group('bot authsetting', botOperations_commandType) as g:
        g.custom_command('create', 'create_connection')
        g.custom_command('list-providers', 'get_service_providers')

    with self.command_group('bot', botServices_commandType) as g:
        g.generic_update_command('update',
                                 setter_name='update',
                                 setter_type=updateBotService_commandType)

    for channel in [
            'facebook', 'email', 'msteams', 'skype', 'kik', 'directline',
            'telegram', 'sms', 'slack'
    ]:
        with self.command_group('bot {}'.format(channel),
                                channelOperationsCreate_commandType) as g:
            g.command('create', '{}_create'.format(channel))

        with self.command_group('bot {}'.format(channel),
                                channelOperations_commandType) as g:
            g.command('show', '{}_get'.format(channel))
            g.command('delete', '{}_delete'.format(channel))

    with self.command_group('bot webchat', channelOperations_commandType) as g:
        g.command('show', 'webchat_get')
Exemple #27
0
from ._format import (transform_work_item_table_output,
                      transform_work_item_query_result_table_output,
                      transform_work_item_relation_type_table_output,
                      transform_work_item_relations,
                      transform_work_item_team_iterations_table_output,
                      transform_work_item_team_iteration_table_output,
                      transform_work_item_team_iteration_work_items,
                      transform_work_item_team_default_iteration_table_output,
                      transform_work_item_team_backlog_iteration_table_output,
                      transform_work_item_project_classification_nodes_table_output,
                      transform_work_item_project_classification_node_table_output,
                      transform_work_item_team_areas_table_output)


workItemOps = CliCommandType(
    operations_tmpl='azext_devops.dev.boards.work_item#{}',
    exception_handler=azure_devops_exception_handler
)

relationsOps = CliCommandType(
    operations_tmpl='azext_devops.dev.boards.relations#{}',
    exception_handler=azure_devops_exception_handler
)

workProjectAndTeamIterationOps = CliCommandType(
    operations_tmpl='azext_devops.dev.boards.iteration#{}',
    exception_handler=azure_devops_exception_handler
)

workProjectAndTeamAreaOps = CliCommandType(
    operations_tmpl='azext_devops.dev.boards.area#{}',
    exception_handler=azure_devops_exception_handler
Exemple #28
0
def load_command_table(self, _):
    from azure.cli.core.commands.arm import deployment_validate_table_format

    resource_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.resource.custom#{}')

    resource_group_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.resources.operations#ResourceGroupsOperations.{}',
        client_factory=cf_resource_groups,
        resource_type=ResourceType.MGMT_RESOURCE_RESOURCES)

    resource_provider_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.resources.operations#ProvidersOperations.{}',
        client_factory=cf_providers,
        resource_type=ResourceType.MGMT_RESOURCE_RESOURCES)

    resource_feature_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.features.operations#FeaturesOperations.{}',
        client_factory=cf_features,
        resource_type=ResourceType.MGMT_RESOURCE_FEATURES)

    resource_tag_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.resources.operations#TagsOperations.{}',
        client_factory=cf_tags,
        resource_type=ResourceType.MGMT_RESOURCE_RESOURCES)

    resource_deployment_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.resources.operations#DeploymentsOperations.{}',
        client_factory=cf_deployments,
        resource_type=ResourceType.MGMT_RESOURCE_RESOURCES)

    resource_deployment_operation_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.resources.operations#DeploymentOperationsOperations.{}',
        client_factory=cf_deployment_operations,
        resource_type=ResourceType.MGMT_RESOURCE_RESOURCES)

    resource_policy_definitions_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.policy.operations#PolicyDefinitionsOperations.{}',
        client_factory=cf_policy_definitions,
        resource_type=ResourceType.MGMT_RESOURCE_POLICY)

    resource_policy_set_definitions_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.policy.operations#PolicySetDefinitionsOperations.{}',
        client_factory=cf_policy_set_definitions,
        resource_type=ResourceType.MGMT_RESOURCE_POLICY)

    resource_policy_exemptions_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.policy.operations#PolicyExemptionsOperations.{}',
        client_factory=cf_policy_exemptions,
        resource_type=ResourceType.MGMT_RESOURCE_POLICY)

    resource_lock_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.locks.operations#ManagementLocksOperations.{}',
        resource_type=ResourceType.MGMT_RESOURCE_LOCKS)

    resource_link_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.links.operations#ResourceLinksOperations.{}',
        client_factory=cf_resource_links,
        resource_type=ResourceType.MGMT_RESOURCE_LINKS)

    resource_deploymentscripts_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.deploymentscripts.operations#ResourceLinksOperations.{}',
        client_factory=cf_resource_deploymentscripts,
        resource_type=ResourceType.MGMT_RESOURCE_DEPLOYMENTSCRIPTS)

    resource_managedapp_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.managedapplications.operations#ApplicationsOperations.{}',
        client_factory=cf_resource_managedapplications,
        resource_type=ResourceType.MGMT_RESOURCE_RESOURCES)

    resource_managedapp_def_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.managedapplications.operations#ApplicationDefinitionsOperations.{}',
        client_factory=cf_resource_managedappdefinitions,
        resource_type=ResourceType.MGMT_RESOURCE_RESOURCES)

    resource_managementgroups_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.managementgroups.operations#ManagementGroupsOperations.{}',
        client_factory=cf_management_groups,
        exception_handler=managementgroups_exception_handler)

    resource_managementgroups_subscriptions_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.managementgroups.operations#ManagementGroupSubscriptionsOperations.{}',
        client_factory=cf_management_group_subscriptions,
        exception_handler=managementgroups_exception_handler)

    resource_managementgroups_update_type = CliCommandType(
        operations_tmpl='azure.cli.command_modules.resource.custom#{}',
        client_factory=cf_management_groups,
        exception_handler=managementgroups_exception_handler)

    resource_templatespecs_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.resource.templatespecs.operations#ResourceLinksOperations.{}',
        client_factory=cf_resource_templatespecs,
        resource_type=ResourceType.MGMT_RESOURCE_TEMPLATESPECS)

    with self.command_group(
            'account lock',
            resource_lock_sdk,
            resource_type=ResourceType.MGMT_RESOURCE_LOCKS) as g:
        g.custom_command('create', 'create_lock')
        g.custom_command('delete', 'delete_lock')
        g.custom_command('list', 'list_locks')
        g.custom_show_command('show', 'get_lock')
        g.custom_command('update', 'update_lock')

    with self.command_group(
            'group',
            resource_group_sdk,
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.command('delete',
                  'begin_delete',
                  supports_no_wait=True,
                  confirmation=True)
        g.show_command('show', 'get')
        g.command('exists', 'check_existence')
        g.custom_command('list',
                         'list_resource_groups',
                         table_transformer=transform_resource_group_list)
        g.custom_command('create', 'create_resource_group')
        g.custom_command('export', 'export_group_as_template')
        g.generic_update_command('update',
                                 custom_func_name='update_resource_group',
                                 custom_func_type=resource_custom)
        g.wait_command('wait')

    with self.command_group(
            'group lock', resource_type=ResourceType.MGMT_RESOURCE_LOCKS) as g:
        g.custom_command('create', 'create_lock')
        g.custom_command('delete', 'delete_lock')
        g.custom_command('list', 'list_locks')
        g.custom_show_command('show', 'get_lock')
        g.custom_command('update', 'update_lock')

    with self.command_group(
            'resource',
            resource_custom,
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('create', 'create_resource')
        g.custom_command('delete', 'delete_resource')
        g.custom_show_command('show', 'show_resource')
        g.custom_command('list',
                         'list_resources',
                         table_transformer=transform_resource_list)
        g.custom_command('tag', 'tag_resource')
        g.custom_command('move', 'move_resource')
        g.custom_command('invoke-action',
                         'invoke_resource_action',
                         transform=DeploymentOutputLongRunningOperation(
                             self.cli_ctx))
        g.generic_update_command('update',
                                 getter_name='show_resource',
                                 setter_name='update_resource',
                                 client_factory=None)
        g.wait_command('wait', getter_name='show_resource')

    with self.command_group(
            'resource lock',
            resource_type=ResourceType.MGMT_RESOURCE_LOCKS) as g:
        g.custom_command('create', 'create_lock')
        g.custom_command('delete', 'delete_lock')
        g.custom_command('list', 'list_locks')
        g.custom_show_command('show', 'get_lock')
        g.custom_command('update', 'update_lock')

    # Resource provider commands
    with self.command_group(
            'provider',
            resource_provider_sdk,
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.command('list', 'list')
        g.show_command('show', 'get')
        g.custom_command('register', 'register_provider')
        g.custom_command('unregister', 'unregister_provider')
        g.custom_command('operation list', 'list_provider_operations')
        g.custom_show_command('operation show', 'show_provider_operations')

    # Resource feature commands
    with self.command_group('feature',
                            resource_feature_sdk,
                            client_factory=cf_features,
                            resource_type=PROFILE_TYPE,
                            min_api='2019-03-02-hybrid') as g:
        feature_table_transform = '{Name:name, RegistrationState:properties.state}'
        g.custom_command('list',
                         'list_features',
                         table_transformer='[].' + feature_table_transform)
        g.show_command('show',
                       'get',
                       table_transformer=feature_table_transform)
        g.custom_command('register', 'register_feature')
        g.custom_command('unregister', 'unregister_feature')

    # Tag commands
    with self.command_group(
            'tag',
            resource_tag_sdk,
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('list', 'get_tag_at_scope')
        g.custom_command('create', 'create_or_update_tag_at_scope')
        g.custom_command('delete', 'delete_tag_at_scope', confirmation=True)
        g.custom_command('update', 'update_tag_at_scope', min_api='2019-10-01')
        g.command('add-value', 'create_or_update_value')
        g.command('remove-value', 'delete_value')

    # az group deployment
    with self.command_group('group deployment',
                            resource_deployment_sdk,
                            deprecate_info=self.deprecate(
                                redirect='deployment group', hide=True)) as g:
        g.custom_command('create',
                         'deploy_arm_template',
                         supports_no_wait=True,
                         validator=process_deployment_create_namespace,
                         table_transformer=transform_deployment,
                         exception_handler=handle_template_based_exception)
        g.command('list',
                  'list_by_resource_group',
                  table_transformer=transform_deployments_list,
                  min_api='2017-05-10')
        g.command('list',
                  'list',
                  table_transformer=transform_deployments_list,
                  max_api='2016-09-01')
        g.show_command('show', 'get', table_transformer=transform_deployment)
        g.command('delete', 'begin_delete', supports_no_wait=True)
        g.custom_command('validate',
                         'validate_arm_template',
                         table_transformer=deployment_validate_table_format,
                         exception_handler=handle_template_based_exception)
        g.custom_command('export', 'export_deployment_as_template')
        g.wait_command('wait')
        g.command('cancel', 'cancel')

    with self.command_group('group deployment operation',
                            resource_deployment_operation_sdk,
                            deprecate_info=self.deprecate(
                                redirect='deployment operation group',
                                hide=True)) as g:
        g.command('list', 'list')
        g.custom_show_command('show',
                              'get_deployment_operations',
                              client_factory=cf_deployment_operations)

    # az deployment
    with self.command_group(
            'deployment',
            resource_deployment_sdk,
            min_api='2018-05-01',
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('list',
                         'list_deployments_at_subscription_scope',
                         table_transformer=transform_deployments_list,
                         deprecate_info=g.deprecate(
                             redirect='deployment sub list', hide=True))
        g.custom_show_command('show',
                              'get_deployment_at_subscription_scope',
                              deprecate_info=g.deprecate(
                                  redirect='deployment sub show', hide=True))
        g.custom_command('delete',
                         'delete_deployment_at_subscription_scope',
                         supports_no_wait=True,
                         deprecate_info=g.deprecate(
                             redirect='deployment sub delete', hide=True))
        g.custom_command('validate',
                         'validate_arm_template_at_subscription_scope',
                         validator=process_deployment_create_namespace,
                         table_transformer=deployment_validate_table_format,
                         exception_handler=handle_template_based_exception,
                         deprecate_info=g.deprecate(
                             redirect='deployment sub validate', hide=True))
        g.custom_command('create',
                         'deploy_arm_template_at_subscription_scope',
                         supports_no_wait=True,
                         validator=process_deployment_create_namespace,
                         exception_handler=handle_template_based_exception,
                         deprecate_info=g.deprecate(
                             redirect='deployment sub create', hide=True))
        g.custom_command('export',
                         'export_template_at_subscription_scope',
                         deprecate_info=g.deprecate(
                             redirect='deployment sub export', hide=True))
        g.custom_wait_command('wait',
                              'get_deployment_at_subscription_scope',
                              deprecate_info=g.deprecate(
                                  redirect='deployment sub wait', hide=True))
        g.custom_command('cancel',
                         'cancel_deployment_at_subscription_scope',
                         deprecate_info=g.deprecate(
                             redirect='deployment sub cancel', hide=True))

    with self.command_group(
            'deployment operation',
            resource_deployment_operation_sdk,
            min_api='2018-05-01',
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('list',
                         'list_deployment_operations_at_subscription_scope',
                         deprecate_info=self.deprecate(
                             redirect='deployment operation sub list',
                             hide=True))
        g.custom_show_command(
            'show',
            'get_deployment_operations_at_subscription_scope',
            client_factory=cf_deployment_operations,
            deprecate_info=self.deprecate(
                redirect='deployment operation sub show', hide=True))

    # az deployment sub
    with self.command_group(
            'deployment sub',
            resource_deployment_sdk,
            min_api='2018-05-01',
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('list',
                         'list_deployments_at_subscription_scope',
                         table_transformer=transform_deployments_list)
        g.custom_show_command('show',
                              'get_deployment_at_subscription_scope',
                              table_transformer=transform_deployment)
        g.custom_command('delete',
                         'delete_deployment_at_subscription_scope',
                         supports_no_wait=True)
        g.custom_command('validate',
                         'validate_arm_template_at_subscription_scope',
                         validator=process_deployment_create_namespace,
                         table_transformer=deployment_validate_table_format,
                         exception_handler=handle_template_based_exception)
        g.custom_command('create',
                         'deploy_arm_template_at_subscription_scope',
                         supports_no_wait=True,
                         validator=process_deployment_create_namespace,
                         table_transformer=transform_deployment,
                         exception_handler=handle_template_based_exception)
        g.custom_command('what-if',
                         'what_if_deploy_arm_template_at_subscription_scope',
                         validator=process_deployment_create_namespace,
                         exception_handler=handle_template_based_exception,
                         min_api='2019-07-01')
        g.custom_command('export', 'export_template_at_subscription_scope')
        g.custom_wait_command('wait', 'get_deployment_at_subscription_scope')
        g.custom_command('cancel', 'cancel_deployment_at_subscription_scope')

    with self.command_group(
            'deployment operation sub',
            resource_deployment_operation_sdk,
            min_api='2018-05-01',
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('list',
                         'list_deployment_operations_at_subscription_scope')
        g.custom_show_command(
            'show',
            'get_deployment_operations_at_subscription_scope',
            client_factory=cf_deployment_operations)

    with self.command_group(
            'deployment-scripts',
            resource_deploymentscripts_sdk,
            resource_type=ResourceType.MGMT_RESOURCE_DEPLOYMENTSCRIPTS) as g:
        g.custom_command('list', 'list_deployment_scripts')
        g.custom_show_command('show', 'get_deployment_script')
        g.custom_command('show-log', 'get_deployment_script_logs')
        g.custom_command('delete',
                         'delete_deployment_script',
                         confirmation=True)

    with self.command_group(
            'ts',
            resource_templatespecs_sdk,
            resource_type=ResourceType.MGMT_RESOURCE_TEMPLATESPECS,
            is_preview=True,
            min_api='2019-06-01-preview') as g:
        g.custom_command('create',
                         'create_template_spec',
                         validator=process_ts_create_or_update_namespace)
        g.custom_command('update',
                         'update_template_spec',
                         validator=process_ts_create_or_update_namespace,
                         confirmation=True)
        g.custom_command('export',
                         'export_template_spec',
                         validator=_validate_template_spec_out)
        g.custom_show_command('show',
                              'get_template_spec',
                              validator=_validate_template_spec)
        g.custom_command('list', 'list_template_specs')
        g.custom_command('delete',
                         'delete_template_spec',
                         validator=_validate_template_spec,
                         confirmation=True)

    # az deployment group
    with self.command_group(
            'deployment group',
            resource_deployment_sdk,
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('list',
                         'list_deployments_at_resource_group',
                         table_transformer=transform_deployments_list)
        g.custom_show_command('show',
                              'get_deployment_at_resource_group',
                              table_transformer=transform_deployment)
        g.custom_command('delete',
                         'delete_deployment_at_resource_group',
                         supports_no_wait=True)
        g.custom_command('validate',
                         'validate_arm_template_at_resource_group',
                         validator=process_deployment_create_namespace,
                         table_transformer=deployment_validate_table_format,
                         exception_handler=handle_template_based_exception)
        g.custom_command('create',
                         'deploy_arm_template_at_resource_group',
                         supports_no_wait=True,
                         validator=process_deployment_create_namespace,
                         table_transformer=transform_deployment,
                         exception_handler=handle_template_based_exception)
        g.custom_command('what-if',
                         'what_if_deploy_arm_template_at_resource_group',
                         validator=process_deployment_create_namespace,
                         exception_handler=handle_template_based_exception,
                         min_api='2019-07-01')
        g.custom_command('export', 'export_template_at_resource_group')
        g.custom_wait_command('wait', 'get_deployment_at_resource_group')
        g.custom_command('cancel', 'cancel_deployment_at_resource_group')

    with self.command_group(
            'deployment operation group',
            resource_deployment_operation_sdk,
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('list',
                         'list_deployment_operations_at_resource_group')
        g.custom_show_command('show',
                              'get_deployment_operations_at_resource_group',
                              client_factory=cf_deployment_operations)

    # az deployment mg
    with self.command_group(
            'deployment mg',
            resource_deployment_sdk,
            min_api='2019-07-01',
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('list',
                         'list_deployments_at_management_group',
                         table_transformer=transform_deployments_list)
        g.custom_show_command('show',
                              'get_deployment_at_management_group',
                              table_transformer=transform_deployment)
        g.custom_command('delete',
                         'delete_deployment_at_management_group',
                         supports_no_wait=True)
        g.custom_command('validate',
                         'validate_arm_template_at_management_group',
                         validator=process_deployment_create_namespace,
                         table_transformer=deployment_validate_table_format,
                         exception_handler=handle_template_based_exception)
        g.custom_command('create',
                         'deploy_arm_template_at_management_group',
                         supports_no_wait=True,
                         validator=process_deployment_create_namespace,
                         table_transformer=transform_deployment,
                         exception_handler=handle_template_based_exception)
        g.custom_command('what-if',
                         'what_if_deploy_arm_template_at_management_group',
                         validator=process_deployment_create_namespace,
                         exception_handler=handle_template_based_exception,
                         min_api='2019-10-01')
        g.custom_command('export', 'export_template_at_management_group')
        g.custom_wait_command('wait', 'get_deployment_at_management_group')
        g.custom_command('cancel', 'cancel_deployment_at_management_group')

    with self.command_group(
            'deployment operation mg',
            resource_deployment_operation_sdk,
            min_api='2019-07-01',
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('list',
                         'list_deployment_operations_at_management_group')
        g.custom_show_command('show',
                              'get_deployment_operations_at_management_group',
                              client_factory=cf_deployment_operations)

    # az deployment tenant
    with self.command_group(
            'deployment tenant',
            resource_deployment_sdk,
            min_api='2019-07-01',
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('list',
                         'list_deployments_at_tenant_scope',
                         table_transformer=transform_deployments_list)
        g.custom_show_command('show',
                              'get_deployment_at_tenant_scope',
                              table_transformer=transform_deployment)
        g.custom_command('delete',
                         'delete_deployment_at_tenant_scope',
                         supports_no_wait=True)
        g.custom_command('validate',
                         'validate_arm_template_at_tenant_scope',
                         validator=process_deployment_create_namespace,
                         table_transformer=deployment_validate_table_format,
                         exception_handler=handle_template_based_exception)
        g.custom_command('create',
                         'deploy_arm_template_at_tenant_scope',
                         supports_no_wait=True,
                         validator=process_deployment_create_namespace,
                         table_transformer=transform_deployment,
                         exception_handler=handle_template_based_exception)
        g.custom_command('what-if',
                         'what_if_deploy_arm_template_at_tenant_scope',
                         validator=process_deployment_create_namespace,
                         exception_handler=handle_template_based_exception,
                         min_api='2019-10-01')
        g.custom_command('export', 'export_template_at_tenant_scope')
        g.custom_wait_command('wait', 'get_deployment_at_tenant_scope')
        g.custom_command('cancel', 'cancel_deployment_at_tenant_scope')

    with self.command_group(
            'deployment operation tenant',
            resource_deployment_operation_sdk,
            min_api='2019-07-01',
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('list', 'list_deployment_operations_at_tenant_scope')
        g.custom_show_command('show',
                              'get_deployment_operations_at_tenant_scope',
                              client_factory=cf_deployment_operations)

    with self.command_group(
            'policy assignment',
            resource_type=ResourceType.MGMT_RESOURCE_POLICY) as g:
        g.custom_command('create', 'create_policy_assignment')
        g.custom_command('delete', 'delete_policy_assignment')
        g.custom_command('list', 'list_policy_assignment')
        g.custom_show_command('show', 'show_policy_assignment')

    with self.command_group('policy assignment identity',
                            resource_type=ResourceType.MGMT_RESOURCE_POLICY,
                            min_api='2018-05-01') as g:
        g.custom_command('assign', 'set_identity')
        g.custom_show_command('show', 'show_identity')
        g.custom_command('remove', 'remove_identity')

    with self.command_group(
            'policy definition',
            resource_policy_definitions_sdk,
            resource_type=ResourceType.MGMT_RESOURCE_POLICY) as g:
        g.custom_command('create', 'create_policy_definition')
        g.custom_command('delete', 'delete_policy_definition')
        g.custom_command('list', 'list_policy_definition')
        g.custom_show_command('show', 'get_policy_definition')
        g.custom_command('update', 'update_policy_definition')

    with self.command_group('policy set-definition',
                            resource_policy_set_definitions_sdk,
                            resource_type=ResourceType.MGMT_RESOURCE_POLICY,
                            min_api='2017-06-01-preview') as g:
        g.custom_command('create', 'create_policy_setdefinition')
        g.custom_command('delete', 'delete_policy_setdefinition')
        g.custom_command('list', 'list_policy_setdefinition')
        g.custom_show_command('show', 'get_policy_setdefinition')
        g.custom_command('update', 'update_policy_setdefinition')

    with self.command_group('policy exemption',
                            resource_policy_exemptions_sdk,
                            is_preview=True,
                            resource_type=ResourceType.MGMT_RESOURCE_POLICY,
                            min_api='2020-09-01') as g:
        g.custom_command('create', 'create_policy_exemption')
        g.custom_command('delete', 'delete_policy_exemption')
        g.custom_command('list', 'list_policy_exemption')
        g.custom_show_command('show', 'get_policy_exemption')
        g.custom_command('update', 'update_policy_exemption')

    with self.command_group(
            'lock', resource_type=ResourceType.MGMT_RESOURCE_LOCKS) as g:
        g.custom_command('create', 'create_lock')
        g.custom_command('delete', 'delete_lock')
        g.custom_command('list', 'list_locks')
        g.custom_show_command('show', 'get_lock')
        g.custom_command('update', 'update_lock')

    with self.command_group(
            'resource link',
            resource_link_sdk,
            resource_type=ResourceType.MGMT_RESOURCE_LINKS) as g:
        g.custom_command('create', 'create_resource_link')
        g.command('delete', 'delete')
        g.show_command('show', 'get')
        g.custom_command('list', 'list_resource_links')
        g.custom_command('update', 'update_resource_link')

    with self.command_group(
            'managedapp',
            resource_managedapp_sdk,
            min_api='2017-05-10',
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('create', 'create_application')
        g.command('delete', 'begin_delete')
        g.custom_show_command('show', 'show_application')
        g.custom_command('list', 'list_applications')

    with self.command_group(
            'managedapp definition',
            resource_managedapp_def_sdk,
            min_api='2017-05-10',
            resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
        g.custom_command('create', 'create_or_update_applicationdefinition')
        g.custom_command('update', 'create_or_update_applicationdefinition')
        g.command('delete', 'begin_delete')
        g.custom_show_command('show', 'show_applicationdefinition')
        g.command('list',
                  'list_by_resource_group',
                  exception_handler=empty_on_404)

    with self.command_group('account management-group',
                            resource_managementgroups_sdk,
                            client_factory=cf_management_groups) as g:
        g.custom_command('list', 'cli_managementgroups_group_list')
        g.custom_show_command('show', 'cli_managementgroups_group_show')
        g.custom_command('create', 'cli_managementgroups_group_create')
        g.custom_command('delete', 'cli_managementgroups_group_delete')
        g.generic_update_command(
            'update',
            getter_name='cli_managementgroups_group_update_get',
            getter_type=resource_managementgroups_update_type,
            setter_name='cli_managementgroups_group_update_set',
            setter_type=resource_managementgroups_update_type,
            custom_func_name='cli_managementgroups_group_update_custom_func',
            custom_func_type=resource_managementgroups_update_type,
            exception_handler=managementgroups_exception_handler)

    with self.command_group(
            'account management-group subscription',
            resource_managementgroups_subscriptions_sdk,
            client_factory=cf_management_group_subscriptions) as g:
        g.custom_command('add', 'cli_managementgroups_subscription_add')
        g.custom_command('remove', 'cli_managementgroups_subscription_remove')

    with self.command_group('bicep') as g:
        g.custom_command('install', 'install_bicep_cli')
        g.custom_command('upgrade', 'upgrade_bicep_cli')
        g.custom_command('build', 'build_bicep_file')
        g.custom_command('decompile', 'decompile_bicep_file')
        g.custom_command('version', 'show_bicep_cli_version')
        g.custom_command('list-versions', 'list_bicep_cli_versions')
Exemple #29
0
def load_command_table(self, _):  # pylint: disable=too-many-statements

    acr_custom_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.custom#{}',
        table_transformer=registry_output_format,
        client_factory=cf_acr_registries)

    acr_login_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.custom#{}')

    acr_import_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.import#{}',
        client_factory=cf_acr_registries)

    acr_policy_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.policy#{}',
        table_transformer=policy_output_format,
        client_factory=cf_acr_registries)

    acr_cred_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.credential#{}',
        table_transformer=credential_output_format,
        client_factory=cf_acr_registries)

    acr_repo_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.repository#{}')

    acr_webhook_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.webhook#{}',
        table_transformer=webhook_output_format,
        client_factory=cf_acr_webhooks)

    acr_replication_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.replication#{}',
        table_transformer=replication_output_format,
        client_factory=cf_acr_replications)

    acr_build_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.build#{}',
        table_transformer=build_output_format,
        client_factory=cf_acr_runs)

    acr_run_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.run#{}',
        table_transformer=run_output_format,
        client_factory=cf_acr_runs)

    acr_pack_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.pack#{}',
        table_transformer=run_output_format,
        client_factory=cf_acr_runs)

    acr_task_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.task#{}',
        table_transformer=task_output_format,
        client_factory=cf_acr_tasks)

    acr_taskrun_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.taskrun#{}',
        table_transformer=taskrun_output_format,
        client_factory=cf_acr_taskruns)

    acr_helm_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.helm#{}')

    acr_network_rule_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.network_rule#{}',
        client_factory=cf_acr_registries)

    acr_check_health_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.check_health#{}')

    acr_scope_map_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.scope_map#{}',
        table_transformer=scope_map_output_format,
        client_factory=cf_acr_scope_maps)

    acr_token_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.token#{}',
        table_transformer=token_output_format,
        client_factory=cf_acr_tokens)

    acr_token_credential_generate_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.token#{}',
        table_transformer=token_credential_output_format,
        client_factory=cf_acr_token_credentials)

    acr_agentpool_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.agentpool#{}',
        table_transformer=agentpool_output_format,
        client_factory=cf_acr_agentpool)

    acr_private_endpoint_connection_util = CliCommandType(
        operations_tmpl=
        'azure.cli.command_modules.acr.private_endpoint_connection#{}',
        client_factory=cf_acr_private_endpoint_connections)

    with self.command_group('acr', acr_custom_util) as g:
        g.command('check-name', 'acr_check_name', table_transformer=None)
        g.command('list', 'acr_list')
        g.command('create', 'acr_create')
        g.command('delete', 'acr_delete')
        g.show_command('show', 'acr_show')
        g.command('show-usage',
                  'acr_show_usage',
                  table_transformer=usage_output_format)
        g.command('show-endpoints',
                  'acr_show_endpoints',
                  table_transformer=endpoints_output_format)
        g.generic_update_command('update',
                                 getter_name='acr_update_get',
                                 setter_name='acr_update_set',
                                 custom_func_name='acr_update_custom',
                                 custom_func_type=acr_custom_util,
                                 client_factory=cf_acr_registries)

    with self.command_group('acr', acr_login_util) as g:
        g.command('login', 'acr_login')

    with self.command_group('acr', acr_import_util) as g:
        g.command('import', 'acr_import')

    with self.command_group('acr credential', acr_cred_util) as g:
        g.show_command('show', 'acr_credential_show')
        g.command('renew', 'acr_credential_renew')

    with self.command_group('acr repository', acr_repo_util) as g:
        g.command('list', 'acr_repository_list')
        g.command('show-tags', 'acr_repository_show_tags')
        g.command('show-manifests', 'acr_repository_show_manifests')
        g.command('show', 'acr_repository_show')
        g.command('update', 'acr_repository_update')
        g.command('delete', 'acr_repository_delete')
        g.command('untag', 'acr_repository_untag')

    with self.command_group('acr webhook', acr_webhook_util) as g:
        g.command('list', 'acr_webhook_list')
        g.command('create', 'acr_webhook_create')
        g.command('delete', 'acr_webhook_delete')
        g.show_command('show', 'acr_webhook_show')
        g.command('get-config',
                  'acr_webhook_get_config',
                  table_transformer=webhook_get_config_output_format)
        g.command('list-events',
                  'acr_webhook_list_events',
                  table_transformer=webhook_list_events_output_format)
        g.command('ping',
                  'acr_webhook_ping',
                  table_transformer=webhook_ping_output_format)
        g.generic_update_command('update',
                                 getter_name='acr_webhook_update_get',
                                 setter_name='acr_webhook_update_set',
                                 custom_func_name='acr_webhook_update_custom',
                                 custom_func_type=acr_webhook_util,
                                 client_factory=cf_acr_webhooks)

    with self.command_group('acr replication', acr_replication_util) as g:
        g.command('list', 'acr_replication_list')
        g.command('create', 'acr_replication_create')
        g.command('delete', 'acr_replication_delete')
        g.show_command('show', 'acr_replication_show')
        g.generic_update_command(
            'update',
            getter_name='acr_replication_update_get',
            setter_name='acr_replication_update_set',
            custom_func_name='acr_replication_update_custom',
            custom_func_type=acr_replication_util,
            client_factory=cf_acr_replications)

    with self.command_group('acr', acr_build_util) as g:
        g.command('build', 'acr_build', supports_no_wait=True)

    with self.command_group('acr', acr_run_util) as g:
        g.command('run', 'acr_run', supports_no_wait=True)

    with self.command_group('acr pack', acr_pack_util, is_preview=True) as g:
        g.command('build', 'acr_pack_build', supports_no_wait=True)

    with self.command_group('acr task', acr_task_util) as g:
        g.command('create', 'acr_task_create')
        g.show_command('show', 'acr_task_show')
        g.command('list', 'acr_task_list')
        g.command('delete', 'acr_task_delete')
        g.command('update', 'acr_task_update')
        g.command('identity assign', 'acr_task_identity_assign')
        g.command('identity remove', 'acr_task_identity_remove')
        g.command('identity show',
                  'acr_task_identity_show',
                  table_transformer=task_identity_format)
        g.command('credential add', 'acr_task_credential_add')
        g.command('credential update', 'acr_task_credential_update')
        g.command('credential remove', 'acr_task_credential_remove')
        g.command('credential list', 'acr_task_credential_list')
        g.command('timer add', 'acr_task_timer_add')
        g.command('timer update', 'acr_task_timer_update')
        g.command('timer remove', 'acr_task_timer_remove')
        g.command('timer list', 'acr_task_timer_list')
        g.command('run',
                  'acr_task_run',
                  client_factory=cf_acr_runs,
                  table_transformer=run_output_format,
                  supports_no_wait=True)
        g.command('list-runs',
                  'acr_task_list_runs',
                  client_factory=cf_acr_runs,
                  table_transformer=run_output_format)
        g.command('show-run',
                  'acr_task_show_run',
                  client_factory=cf_acr_runs,
                  table_transformer=run_output_format)
        g.command('cancel-run',
                  'acr_task_cancel_run',
                  client_factory=cf_acr_runs,
                  table_transformer=None)
        g.command('update-run',
                  'acr_task_update_run',
                  client_factory=cf_acr_runs,
                  table_transformer=run_output_format)
        g.command('logs',
                  'acr_task_logs',
                  client_factory=cf_acr_runs,
                  table_transformer=None)

    with self.command_group('acr taskrun', acr_taskrun_util,
                            is_preview=True) as g:
        g.command('list', 'acr_taskrun_list')
        g.command('delete', 'acr_taskrun_delete')
        g.command('show', 'acr_taskrun_show')
        g.command('logs',
                  'acr_taskrun_logs',
                  client_factory=cf_acr_runs,
                  table_transformer=None)

    with self.command_group('acr config content-trust', acr_policy_util) as g:
        g.command('show', 'acr_config_content_trust_show')
        g.command('update', 'acr_config_content_trust_update')

    with self.command_group('acr config retention',
                            acr_policy_util,
                            is_preview=True) as g:
        g.command('show', 'acr_config_retention_show')
        g.command('update', 'acr_config_retention_update')

    def _helm_deprecate_message(self):
        msg = "This {} has been deprecated and will be removed in future release.".format(
            self.object_type)
        msg += " Use '{}' instead.".format(self.redirect)
        msg += " For more information go to"
        msg += " https://docs.microsoft.com/en-us/azure/container-registry/container-registry-helm-repos"
        return msg

    with self.command_group('acr helm',
                            acr_helm_util,
                            deprecate_info=self.deprecate(
                                redirect="helm v3",
                                message_func=_helm_deprecate_message)) as g:
        g.command('list',
                  'acr_helm_list',
                  table_transformer=helm_list_output_format)
        g.command('show',
                  'acr_helm_show',
                  table_transformer=helm_show_output_format)
        g.command('delete', 'acr_helm_delete')
        g.command('push', 'acr_helm_push')
        g.command('repo add', 'acr_helm_repo_add')
        g.command('install-cli', 'acr_helm_install_cli', is_preview=True)

    with self.command_group('acr network-rule', acr_network_rule_util) as g:
        g.command('list', 'acr_network_rule_list')
        g.command('add', 'acr_network_rule_add')
        g.command('remove', 'acr_network_rule_remove')

    with self.command_group('acr', acr_check_health_util) as g:
        g.command('check-health', 'acr_check_health')

    with self.command_group('acr scope-map',
                            acr_scope_map_util,
                            is_preview=True) as g:
        g.command('create', 'acr_scope_map_create')
        g.command('delete', 'acr_scope_map_delete')
        g.command('update', 'acr_scope_map_update')
        g.command('show', 'acr_scope_map_show')
        g.command('list', 'acr_scope_map_list')

    with self.command_group('acr token', acr_token_util, is_preview=True) as g:
        g.command('create', 'acr_token_create')
        g.command('delete', 'acr_token_delete')
        g.command('update', 'acr_token_update')
        g.command('show', 'acr_token_show')
        g.command('list', 'acr_token_list')
        g.command('credential delete', 'acr_token_credential_delete')

    with self.command_group('acr token credential',
                            acr_token_credential_generate_util) as g:
        g.command('generate', 'acr_token_credential_generate')

    with self.command_group('acr agentpool',
                            acr_agentpool_util,
                            is_preview=True) as g:
        g.command('create', 'acr_agentpool_create', supports_no_wait=True)
        g.command('update', 'acr_agentpool_update', supports_no_wait=True)
        g.command('delete', 'acr_agentpool_delete', supports_no_wait=True)
        g.command('list', 'acr_agentpool_list')
        g.show_command('show', 'acr_agentpool_show')

    with self.command_group('acr private-endpoint-connection',
                            acr_private_endpoint_connection_util) as g:
        g.command('delete', 'delete')
        g.show_command('show', 'show')
        g.command('list', 'list_connections')
        g.command('approve', 'approve')
        g.command('reject', 'reject')

    with self.command_group('acr private-link-resource', acr_custom_util) as g:
        g.command('list', 'list_private_link_resources')

    with self.command_group('acr identity', acr_custom_util) as g:
        g.command('show', 'show_identity')
        g.command('assign', 'assign_identity')
        g.command('remove', 'remove_identity')

    with self.command_group('acr encryption', acr_custom_util) as g:
        g.command('show', 'show_encryption')
        g.command('rotate-key', "rotate_key")
Exemple #30
0
def load_command_table(self, _):
    topics_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.vendored_sdks.eventgrid.operations._topics_operations#TopicsOperations.{}',
        client_factory=topics_factory,
        client_arg_name='self')

    extension_topics_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.vendored_sdks.eventgrid.operations._extension_topics_operations#ExtensionTopicsOperations.{}',
        client_factory=extension_topics_factory,
        client_arg_name='self')

    domains_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.vendored_sdks.eventgrid.operations._domains_operations#DomainsOperations.{}',
        client_factory=domains_factory,
        client_arg_name='self')

    domain_topics_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.vendored_sdks.eventgrid.operations._domain_topics_operations#DomainTopicsOperations.{}',
        client_factory=domain_topics_factory,
        client_arg_name='self')

    system_topics_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.vendored_sdks.eventgrid.operations._system_topics_operations#SystemTopicsOperations.{}',
        client_factory=system_topics_factory,
        client_arg_name='self')

    system_topic_event_subscriptions_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.vendored_sdks.eventgrid.operations._system_topic_event_subscriptions_operations#SystemTopicEventSubscriptionsOperations.{}',
        client_factory=system_topic_event_subscriptions_factory,
        client_arg_name='self')

    partner_registrations_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.vendored_sdks.eventgrid.operations._partner_registrations_operations#PartnerRegistrationsOperations.{}',
        client_factory=partner_registrations_factory,
        client_arg_name='self')

    partner_namespaces_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.vendored_sdks.eventgrid.operations._partner_namespaces_operations#PartnerNamespacesOperations.{}',
        client_factory=partner_namespaces_factory,
        client_arg_name='self')

    event_channels_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.vendored_sdks.eventgrid.operations._event_channels_operations#EventChannelsOperations.{}',
        client_factory=event_channels_factory,
        client_arg_name='self')

    partner_topics_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.vendored_sdks.eventgrid.operations._partner_topics_operations#PartnerTopicsOperations.{}',
        client_factory=partner_topics_factory,
        client_arg_name='self')

    partner_topic_event_subscriptions_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.vendored_sdks.eventgrid.operations._partner_topic_event_subscriptions_operations#PartnerTopicEventSubscriptionsOperations.{}',
        client_factory=partner_topic_event_subscriptions_factory,
        client_arg_name='self')

    topic_type_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.vendored_sdks.eventgrid.operations._topic_types_operations#TopicTypesOperations.{}',
        client_factory=topic_types_factory,
        client_arg_name='self')

    private_endpoint_connections_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.vendored_sdks.eventgrid.operations._private_endpoint_connections_operations#PrivateEndpointConnectionsOperations.{}',
        client_factory=private_endpoint_connections_factory,
        client_arg_name='self')

    private_link_resources_mgmt_util = CliCommandType(
        operations_tmpl=
        'azext_eventgrid.vendored_sdks.eventgrid.operations._private_link_resources_operations#PrivateLinkResourcesOperations.{}',
        client_factory=private_link_resources_factory,
        client_arg_name='self')

    with self.command_group('eventgrid topic',
                            topics_mgmt_util,
                            client_factory=topics_factory) as g:
        g.show_command('show', 'get')
        g.command('key list', 'list_shared_access_keys')
        g.command('key regenerate', 'regenerate_key')
        g.command('delete', 'delete')
        g.custom_command('list', 'cli_topic_list')
        g.custom_command('create', 'cli_topic_create_or_update')
        g.custom_command('update', 'cli_topic_update')

    with self.command_group('eventgrid extension-topic',
                            extension_topics_mgmt_util,
                            client_factory=extension_topics_factory) as g:
        g.show_command('show', 'get')

    with self.command_group('eventgrid domain topic',
                            domain_topics_mgmt_util,
                            client_factory=domain_topics_factory) as g:
        g.show_command('show', 'get')
        g.custom_command('list', 'cli_domain_topic_list')
        g.custom_command('delete', 'cli_domain_topic_delete')
        g.custom_command('create', 'cli_domain_topic_create_or_update')

    with self.command_group('eventgrid domain',
                            domains_mgmt_util,
                            client_factory=domains_factory) as g:
        g.show_command('show', 'get')
        g.command('key list', 'list_shared_access_keys')
        g.command('key regenerate', 'regenerate_key')
        g.custom_command('list', 'cli_domain_list')
        g.custom_command('create', 'cli_domain_create_or_update')
        g.command('delete', 'delete')
        g.custom_command('update', 'cli_domain_update')

    with self.command_group(
            'eventgrid topic private-endpoint-connection',
            private_endpoint_connections_mgmt_util,
            client_factory=private_endpoint_connections_factory) as g:
        g.custom_show_command('show',
                              'cli_topic_private_endpoint_connection_get')
        g.custom_command('list', 'cli_topic_private_endpoint_connection_list')
        g.custom_command('delete',
                         'cli_topic_private_endpoint_connection_delete')
        g.custom_command('approve',
                         'cli_topic_private_endpoint_connection_approve')
        g.custom_command('reject',
                         'cli_topic_private_endpoint_connection_reject')

    with self.command_group(
            'eventgrid domain private-endpoint-connection',
            private_endpoint_connections_mgmt_util,
            client_factory=private_endpoint_connections_factory) as g:
        g.custom_show_command('show',
                              'cli_domain_private_endpoint_connection_get')
        g.custom_command('list', 'cli_domain_private_endpoint_connection_list')
        g.custom_command('delete',
                         'cli_domain_private_endpoint_connection_delete')
        g.custom_command('approve',
                         'cli_domain_private_endpoint_connection_approve')
        g.custom_command('reject',
                         'cli_domain_private_endpoint_connection_reject')

    with self.command_group(
            'eventgrid topic private-link-resource',
            private_link_resources_mgmt_util,
            client_factory=private_link_resources_factory) as g:
        g.custom_show_command('show', 'cli_topic_private_link_resource_get')
        g.custom_command('list', 'cli_topic_private_link_resource_list')

    with self.command_group(
            'eventgrid domain private-link-resource',
            private_link_resources_mgmt_util,
            client_factory=private_link_resources_factory) as g:
        g.custom_show_command('show', 'cli_domain_private_link_resource_get')
        g.custom_command('list', 'cli_domain_private_link_resource_list')

    with self.command_group('eventgrid system-topic',
                            system_topics_mgmt_util,
                            client_factory=system_topics_factory) as g:
        g.show_command('show', 'get')
        g.command('delete', 'delete')
        g.custom_command('list', 'cli_system_topic_list')
        g.custom_command('create', 'cli_system_topic_create_or_update')
        g.custom_command('update', 'cli_system_topic_update')

    with self.command_group(
            'eventgrid system-topic event-subscription',
            system_topic_event_subscriptions_mgmt_util,
            client_factory=system_topic_event_subscriptions_factory) as g:
        g.custom_show_command('show',
                              'cli_system_topic_event_subscription_get')
        g.command('delete', 'delete')
        g.custom_command('list', 'cli_system_topic_event_subscription_list')
        g.custom_command(
            'create', 'cli_system_topic_event_subscription_create_or_update')
        g.custom_command('update',
                         'cli_system_topic_event_subscription_update')

    with self.command_group('eventgrid partner registration',
                            partner_registrations_mgmt_util,
                            client_factory=partner_registrations_factory) as g:
        g.show_command('show', 'get')
        g.command('delete', 'delete')
        g.custom_command('list', 'cli_partner_registration_list')
        g.custom_command('create', 'cli_partner_registration_create_or_update')
        # g.custom_command('update', 'cli_partner_registration_update')

    with self.command_group('eventgrid partner namespace',
                            partner_namespaces_mgmt_util,
                            client_factory=partner_namespaces_factory) as g:
        g.show_command('show', 'get')
        g.command('delete', 'delete')
        g.custom_command('list', 'cli_partner_namespace_list')
        g.custom_command('create', 'cli_partner_namespace_create_or_update')
        g.command('key list', 'list_shared_access_keys')
        g.command('key regenerate', 'regenerate_key')
        # g.custom_command('update', 'cli_partner_namespace_update')

    with self.command_group('eventgrid partner namespace event-channel',
                            event_channels_mgmt_util,
                            client_factory=event_channels_factory) as g:
        g.show_command('show', 'get')
        g.command('delete', 'delete')
        g.custom_command('list', 'cli_event_channel_list')
        # g.custom_command('update', 'cli_event_channel_update')
        g.custom_command('create', 'cli_event_channel_create_or_update')

    with self.command_group('eventgrid partner topic',
                            partner_topics_mgmt_util,
                            client_factory=partner_topics_factory) as g:
        g.show_command('show', 'get')
        g.command('delete', 'delete')
        g.command('activate', 'activate')
        g.command('deactivate', 'deactivate')
        g.custom_command('list', 'cli_partner_topic_list')
        # g.custom_command('create', 'cli_partner_topic_create_or_update')
        # g.custom_command('update', 'cli_partner_topic_update')

    with self.command_group(
            'eventgrid partner topic event-subscription',
            partner_topic_event_subscriptions_mgmt_util,
            client_factory=partner_topic_event_subscriptions_factory) as g:
        g.custom_show_command('show',
                              'cli_partner_topic_event_subscription_get')
        g.command('delete', 'delete')
        g.custom_command('list', 'cli_partner_topic_event_subscription_list')
        g.custom_command(
            'create', 'cli_partner_topic_event_subscription_create_or_update')
        g.custom_command('update',
                         'cli_partner_topic_event_subscription_update')

    custom_tmpl = 'azext_eventgrid.custom#{}'
    eventgrid_custom = CliCommandType(operations_tmpl=custom_tmpl)

    with self.command_group('eventgrid event-subscription',
                            client_factory=event_subscriptions_factory) as g:
        g.custom_command('create', 'cli_eventgrid_event_subscription_create')
        g.custom_show_command('show', 'cli_eventgrid_event_subscription_get')
        g.custom_command('delete', 'cli_eventgrid_event_subscription_delete')
        g.custom_command('list', 'cli_event_subscription_list')
        g.generic_update_command('update',
                                 getter_type=eventgrid_custom,
                                 setter_type=eventgrid_custom,
                                 getter_name='event_subscription_getter',
                                 setter_name='event_subscription_setter',
                                 custom_func_name='update_event_subscription')

    with self.command_group('eventgrid topic-type', topic_type_mgmt_util) as g:
        g.command('list', 'list')
        g.show_command('show', 'get')
        g.command('list-event-types', 'list_event_types')