def load_command_table(self, _):

    metrics_sdk = CliCommandType(
        operations_tmpl=
        'azext_applicationinsights.vendored_sdks.applicationinsights.operations.metrics_operations#MetricsOperations.{}',
        client_factory=cf_metrics)

    events_sdk = CliCommandType(
        operations_tmpl=
        'azext_applicationinsights.vendored_sdks.applicationinsights.operations.events_operations#EventsOperations.{}',
        client_factory=cf_events)

    query_sdk = CliCommandType(
        operations_tmpl=
        'azext_applicationinsights.vendored_sdks.applicationinsights.operations.query_operations#QueryOperations.{}',
        client_factory=cf_query)

    components_sdk = CliCommandType(
        operations_tmpl=
        'azext_applicationinsights.vendored_sdks.mgmt_applicationinsights.operations.components_operations#ComponentsOperations.{}',
        client_factory=cf_components)

    components_custom_sdk = CliCommandType(
        operations_tmpl='azext_applicationinsights.custom#{}',
        client_factory=cf_components)
    components_billing_sdk = CliCommandType(
        operations_tmpl=
        'azext_applicationinsights.vendored_sdks.mgmt_applicationinsights.operations.component_current_billing_features_operations#ComponentCurrentBillingFeaturesOperations.{}',
        client_factory=cf_component_billing)

    components_billing_custom_sdk = CliCommandType(
        operations_tmpl='azext_applicationinsights.custom#{}',
        client_factory=cf_component_billing)

    api_key_sdk = CliCommandType(
        operations_tmpl=
        'azext_applicationinsights.vendored_sdks.mgmt_applicationinsights.operations.api_keys_operations#APIKeysOperations.{}',
        client_factory=cf_api_key)

    api_key_custom_sdk = CliCommandType(
        operations_tmpl='azext_applicationinsights.custom#{}',
        client_factory=cf_api_key)

    component_linked_storage_accounts_custom_sdk = CliCommandType(
        operations_tmpl='azext_applicationinsights.custom#{}',
        client_factory=cf_component_linked_storage_accounts)

    export_configurations_sdk = CliCommandType(
        operations_tmpl=
        'azext_applicationinsights.vendored_sdks.mgmt_applicationinsights.operations.export_configurations_operations#ExportConfigurationsOperations.{}',
        client_factory=cf_export_configuration)

    export_configurations_custom_sdk = CliCommandType(
        operations_tmpl='azext_applicationinsights.custom#{}',
        client_factory=cf_export_configuration)

    web_test_sdk = CliCommandType(
        operations_tmpl=
        'azext_applicationinsights.vendored_sdks.mgmt_applicationinsights.v2018_05_01_preview.operations#WebTestsOperations.{}',
        client_factory=cf_web_test)

    web_test_custom_sdk = CliCommandType(
        operations_tmpl='azext_applicationinsights.custom#{}',
        client_factory=cf_web_test)

    with self.command_group('monitor app-insights component',
                            command_type=components_sdk,
                            custom_command_type=components_custom_sdk) as g:
        g.custom_command('create', 'create_or_update_component')
        g.custom_command('update', 'update_component')
        g.custom_show_command('show', 'show_components')
        g.custom_command('delete', 'delete_component')
        g.custom_command('update-tags', 'update_component_tags')
        g.custom_command('connect-webapp', 'connect_webapp')
        g.custom_command('connect-function', 'connect_function')

    with self.command_group(
            'monitor app-insights component billing',
            command_type=components_billing_sdk,
            custom_command_type=components_billing_custom_sdk) as g:
        g.custom_command('update', 'update_component_billing')
        g.custom_show_command('show', 'show_component_billing')

    with self.command_group('monitor app-insights api-key',
                            command_type=api_key_sdk,
                            custom_command_type=api_key_custom_sdk) as g:
        g.custom_command('create', 'create_api_key')
        g.custom_show_command('show', 'show_api_key')
        g.custom_command('delete', 'delete_api_key')

    with self.command_group('monitor app-insights metrics', metrics_sdk) as g:
        g.custom_show_command('show', 'get_metric')
        g.custom_command('get-metadata', 'get_metrics_metadata')

    with self.command_group('monitor app-insights events', events_sdk) as g:
        g.custom_show_command('show', 'get_events')

    with self.command_group('monitor app-insights', query_sdk) as g:
        g.custom_command('query', 'execute_query')

    with self.command_group(
            'monitor app-insights component linked-storage',
            custom_command_type=component_linked_storage_accounts_custom_sdk
    ) as g:
        g.custom_show_command('show', 'get_component_linked_storage_account')
        g.custom_command('link', 'create_component_linked_storage_account')
        g.custom_command('update', 'update_component_linked_storage_account')
        g.custom_command('unlink', 'delete_component_linked_storage_account')

    with self.command_group(
            'monitor app-insights component continues-export',
            command_type=export_configurations_sdk,
            custom_command_type=export_configurations_custom_sdk) as g:
        g.custom_command('list', 'list_export_configurations')
        g.custom_show_command('show', 'get_export_configuration')
        g.custom_command('create', 'create_export_configuration')
        g.custom_command('update', 'update_export_configuration')
        g.custom_command('delete',
                         'delete_export_configuration',
                         confirmation=True)

    with self.command_group('monitor app-insights web-test',
                            command_type=web_test_sdk,
                            custom_command_type=web_test_custom_sdk) as g:
        g.custom_command('list', 'list_web_tests')
        g.custom_show_command('show', 'get_web_test')
        g.custom_command('create', 'create_web_test')
        g.generic_update_command('update',
                                 custom_func_name='update_web_test',
                                 setter_arg_name='web_test_definition')
        g.custom_command('delete', 'delete_web_test', confirmation=True)
Exemple #2
0
def load_command_table(self, _):

    backup_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.backup.custom#{}')

    backup_custom_base = CliCommandType(
        operations_tmpl='azure.cli.command_modules.backup.custom_base#{}')

    backup_vaults_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.recoveryservices.operations#VaultsOperations.{}',
        client_factory=vaults_cf)

    with self.command_group('backup vault',
                            backup_vaults_sdk,
                            client_factory=vaults_cf) as g:
        g.custom_command('create', 'create_vault')
        g.show_command('show', 'get')
        g.custom_command('list', 'list_vaults')
        g.custom_command('backup-properties show',
                         'get_backup_properties',
                         client_factory=backup_storage_configs_cf)
        g.custom_command('backup-properties set',
                         'set_backup_properties',
                         client_factory=backup_storage_configs_cf)
        g.custom_command('delete', 'delete_vault', confirmation=True)

    with self.command_group('backup container',
                            backup_custom_base,
                            client_factory=protection_containers_cf) as g:
        g.show_command('show',
                       'show_container',
                       client_factory=backup_protection_containers_cf,
                       table_transformer=transform_container)
        g.command('list',
                  'list_containers',
                  table_transformer=transform_container_list,
                  client_factory=backup_protection_containers_cf)

    with self.command_group('backup container',
                            custom_command_type=backup_custom_base,
                            client_factory=protection_containers_cf) as g:
        g.custom_command('unregister',
                         'unregister_container',
                         confirmation=True)
        g.custom_command('re-register',
                         're_register_wl_container',
                         confirmation=True)
        g.custom_command('register', 'register_wl_container')

    with self.command_group('backup policy',
                            backup_custom_base,
                            client_factory=protection_policies_cf) as g:
        g.command('get-default-for-vm', 'get_default_policy_for_vm')
        g.show_command('show', 'show_policy')
        g.command('list',
                  'list_policies',
                  client_factory=backup_policies_cf,
                  table_transformer=transform_policy_list)
        g.command('list-associated-items',
                  'list_associated_items_for_policy',
                  client_factory=backup_protected_items_cf,
                  table_transformer=transform_item_list)

    with self.command_group('backup policy',
                            custom_command_type=backup_custom_base,
                            client_factory=protection_policies_cf) as g:
        g.custom_command('set', 'set_policy')
        g.custom_command('delete', 'delete_policy')
        g.custom_command('create', 'create_policy')

    with self.command_group('backup protection',
                            backup_custom_base,
                            client_factory=protected_items_cf) as g:
        g.command('check-vm', 'check_protection_enabled_for_vm')
        g.command('enable-for-vm', 'enable_protection_for_vm')
        g.command('update-for-vm', 'update_protection_for_vm')

    with self.command_group('backup protection',
                            custom_command_type=backup_custom_base,
                            client_factory=protected_items_cf) as g:
        g.custom_command('backup-now',
                         'backup_now',
                         client_factory=backups_cf,
                         table_transformer=transform_job)
        g.custom_command('disable', 'disable_protection', confirmation=True)
        g.custom_command('enable-for-azurefileshare',
                         'enable_for_azurefileshare')
        g.custom_command('enable-for-azurewl',
                         'enable_protection_for_azure_wl')
        g.custom_command('auto-enable-for-azurewl',
                         'auto_enable_for_azure_wl',
                         client_factory=protection_intent_cf)
        g.custom_command('auto-disable-for-azurewl',
                         'disable_auto_for_azure_wl',
                         client_factory=protection_intent_cf)
        g.custom_command('resume', 'resume_protection')
        g.custom_command('undelete', 'undelete_protection')

    with self.command_group('backup item',
                            backup_custom_base,
                            client_factory=protected_items_cf) as g:
        g.show_command('show',
                       'show_item',
                       client_factory=backup_protected_items_cf,
                       table_transformer=transform_item)
        g.command('list',
                  'list_items',
                  table_transformer=transform_item_list,
                  client_factory=backup_protected_items_cf)
        g.command('set-policy',
                  'update_policy_for_item',
                  table_transformer=transform_job)

    with self.command_group('backup protectable-item',
                            backup_custom_base,
                            client_factory=backup_protectable_items_cf) as g:
        g.show_command('show', 'show_protectable_item')
        g.command('list',
                  'list_protectable_items',
                  table_transformer=transform_protectable_item_list)
        g.command('initialize',
                  'initialize_protectable_items',
                  client_factory=protection_containers_cf)

    with self.command_group('backup job',
                            backup_custom,
                            client_factory=job_details_cf) as g:
        g.command('list',
                  'list_jobs',
                  client_factory=backup_jobs_cf,
                  table_transformer=transform_job_list)
        g.show_command('show', 'show_job')
        g.command('stop', 'stop_job', client_factory=job_cancellations_cf)
        g.command('wait', 'wait_for_job')

    with self.command_group('backup recoverypoint',
                            backup_custom_base,
                            client_factory=recovery_points_cf) as g:
        g.show_command('show', 'show_recovery_point')
        g.command('list',
                  'list_recovery_points',
                  table_transformer=transform_recovery_point_list)
        g.command('move', 'move_recovery_points')
        g.show_command('show-log-chain',
                       'show_log_chain_recovery_points',
                       table_transformer=transform_log_chain_list)

    with self.command_group('backup restore',
                            backup_custom_base,
                            client_factory=restores_cf) as g:
        g.command('restore-disks', 'restore_disks')

    with self.command_group('backup restore',
                            custom_command_type=backup_custom_base,
                            client_factory=restores_cf) as g:
        g.custom_command('restore-azurefileshare', 'restore_azurefileshare')
        g.custom_command('restore-azurefiles', 'restore_azurefiles')
        g.custom_command('restore-azurewl',
                         'restore_azure_wl',
                         table_transformer=transform_job)

    with self.command_group(
            'backup restore files',
            backup_custom,
            client_factory=item_level_recovery_connections_cf) as g:
        g.command('mount-rp', 'restore_files_mount_rp')
        g.command('unmount-rp', 'restore_files_unmount_rp')

    with self.command_group('backup recoveryconfig',
                            backup_custom_base,
                            client_factory=recovery_points_cf) as g:
        g.show_command('show', 'show_recovery_config')

    with self.command_group('backup', is_preview=True):
        pass
Exemple #3
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)
    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,
        exception_handler=monitor_exception_handler)

    action_group_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.monitor.operations.action_groups#{}',
        client_factory=cf_action_groups,
        exception_handler=monitor_exception_handler)

    activity_log_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.monitor.operations#EventCategoriesOperations.{}',
        client_factory=cf_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,
        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,
        exception_handler=monitor_exception_handler)

    alert_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.monitor.operations#AlertRulesOperations.{}',
        client_factory=cf_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,
        exception_handler=monitor_exception_handler)

    autoscale_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.monitor.operations#AutoscaleSettingsOperations.{}',
        client_factory=cf_autoscale,
        exception_handler=monitor_exception_handler)

    autoscale_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.monitor.operations.autoscale_settings#{}',
        client_factory=cf_autoscale,
        exception_handler=monitor_exception_handler)

    diagnostics_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.monitor.operations#DiagnosticSettingsOperations.{}',
        client_factory=cf_diagnostics,
        exception_handler=monitor_exception_handler)

    diagnostics_categories_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.monitor.operations#DiagnosticSettingsCategoryOperations.{}',
        client_factory=cf_diagnostics,
        exception_handler=monitor_exception_handler)

    diagnostics_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.monitor.operations.diagnostics_settings#{}',
        client_factory=cf_diagnostics,
        exception_handler=monitor_exception_handler)

    log_profiles_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.monitor.operations#LogProfilesOperations.{}',
        client_factory=cf_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,
        exception_handler=monitor_exception_handler)

    alert_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.monitor.operations.metric_alert#{}',
        client_factory=cf_alert_rules,
        exception_handler=monitor_exception_handler)

    metric_alert_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.monitor.operations#MetricAlertsOperations.{}',
        client_factory=cf_metric_alerts,
        exception_handler=monitor_exception_handler)

    metric_definitions_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.monitor.operations#MetricDefinitionsOperations.{}',
        client_factory=cf_metric_def,
        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
    )

    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.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')
Exemple #4
0
 def __init__(self, cli_ctx=None):
     from azure.cli.core.commands import CliCommandType
     enterprise_edge_custom = CliCommandType(
         operations_tmpl='azext_enterprise_edge.custom#{}')
     super().__init__(cli_ctx=cli_ctx,
                      custom_command_type=enterprise_edge_custom)
Exemple #5
0
def load_command_table(self, _):

    cosmosdb_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.cosmosdb.operations#DatabaseAccountsOperations.{}',
        client_factory=cf_db_accounts)

    cosmosdb_custom_sdk = CliCommandType(
        operations_tmpl='azure.cli.command_modules.cosmosdb.custom#{}',
        client_factory=cf_db_accounts)

    with self.command_group('cosmosdb',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.show_command('show', 'get')
        g.command('list-keys',
                  'list_keys',
                  deprecate_info=g.deprecate(redirect='cosmosdb keys list',
                                             hide=True))
        g.command('list-read-only-keys',
                  'list_read_only_keys',
                  deprecate_info=g.deprecate(redirect='cosmosdb keys list',
                                             hide=True))
        g.command('list-connection-strings',
                  'list_connection_strings',
                  table_transformer=list_connection_strings_output,
                  deprecate_info=g.deprecate(redirect='cosmosdb keys list',
                                             hide=True))
        g.command('regenerate-key',
                  'regenerate_key',
                  deprecate_info=g.deprecate(
                      redirect='cosmosdb keys regenerate', hide=True))
        g.command('check-name-exists', 'check_name_exists')
        g.command('delete', 'delete')
        g.command('failover-priority-change', 'failover_priority_change')
        g.custom_command('create', 'cli_cosmosdb_create')
        g.custom_command('update', 'cli_cosmosdb_update')
        g.custom_command('list', 'cli_cosmosdb_list')

    # SQL api
    with self.command_group('cosmosdb sql', is_preview=True):
        pass
    with self.command_group('cosmosdb sql database',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.custom_command('create', 'cli_cosmosdb_sql_database_create')
        g.command('list', 'list_sql_databases')
        g.command('show', 'get_sql_database')
        g.command('delete', 'delete_sql_database')

    with self.command_group('cosmosdb sql container',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.custom_command('create', 'cli_cosmosdb_sql_container_create')
        g.custom_command('update', 'cli_cosmosdb_sql_container_update')
        g.command('list', 'list_sql_containers')
        g.command('show', 'get_sql_container')
        g.command('delete', 'delete_sql_container')

    # MongoDB api
    with self.command_group('cosmosdb mongodb', is_preview=True):
        pass
    with self.command_group('cosmosdb mongodb database',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.custom_command('create', 'cli_cosmosdb_mongodb_database_create')
        g.command('list', 'list_mongo_db_databases')
        g.command('show', 'get_mongo_db_database')
        g.command('delete', 'delete_mongo_db_database')

    with self.command_group('cosmosdb mongodb collection',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.custom_command('create', 'cli_cosmosdb_mongodb_collection_create')
        g.custom_command('update', 'cli_cosmosdb_mongodb_collection_update')
        g.command('list', 'list_mongo_db_collections')
        g.command('show', 'get_mongo_db_collection')
        g.command('delete', 'delete_mongo_db_collection')

    # Cassandra api
    with self.command_group('cosmosdb cassandra', is_preview=True):
        pass
    with self.command_group('cosmosdb cassandra keyspace',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.custom_command('create', 'cli_cosmosdb_cassandra_keyspace_create')
        g.command('list', 'list_cassandra_keyspaces')
        g.command('show', 'get_cassandra_keyspace')
        g.command('delete', 'delete_cassandra_keyspace')

    with self.command_group('cosmosdb cassandra table',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.custom_command('create', 'cli_cosmosdb_cassandra_table_create')
        g.custom_command('update', 'cli_cosmosdb_cassandra_table_update')
        g.command('list', 'list_cassandra_tables')
        g.command('show', 'get_cassandra_table')
        g.command('delete', 'delete_cassandra_table')

    # Gremlin api
    with self.command_group('cosmosdb gremlin', is_preview=True):
        pass
    with self.command_group('cosmosdb gremlin database',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.custom_command('create', 'cli_cosmosdb_gremlin_database_create')
        g.command('list', 'list_gremlin_databases')
        g.command('show', 'get_gremlin_database')
        g.command('delete', 'delete_gremlin_database')

    with self.command_group('cosmosdb gremlin graph',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.custom_command('create', 'cli_cosmosdb_gremlin_graph_create')
        g.custom_command('update', 'cli_cosmosdb_gremlin_graph_update')
        g.command('list', 'list_gremlin_graphs')
        g.command('show', 'get_gremlin_graph')
        g.command('delete', 'delete_gremlin_graph')

    # Table api
    with self.command_group('cosmosdb table',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts,
                            is_preview=True) as g:
        g.custom_command('create', 'cli_cosmosdb_table_create')
        g.command('list', 'list_tables')
        g.command('show', 'get_table')
        g.command('delete', 'delete_table')

    # Offer throughput
    with self.command_group('cosmosdb sql database throughput',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.command('show', 'get_sql_database_throughput')
        g.custom_command('update',
                         'cli_cosmosdb_sql_database_throughput_update')

    with self.command_group('cosmosdb sql container throughput',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.command('show', 'get_sql_container_throughput')
        g.custom_command('update',
                         'cli_cosmosdb_sql_container_throughput_update')

    with self.command_group('cosmosdb mongodb database throughput',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.command('show', 'get_mongo_db_database_throughput')
        g.custom_command('update',
                         'cli_cosmosdb_mongodb_database_throughput_update')

    with self.command_group('cosmosdb mongodb collection throughput',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.command('show', 'get_mongo_db_collection_throughput')
        g.custom_command('update',
                         'cli_cosmosdb_mongodb_collection_throughput_update')

    with self.command_group('cosmosdb cassandra keyspace throughput',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.command('show', 'get_cassandra_keyspace_throughput')
        g.custom_command('update',
                         'cli_cosmosdb_cassandra_keyspace_throughput_update')

    with self.command_group('cosmosdb cassandra table throughput',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.command('show', 'get_cassandra_table_throughput')
        g.custom_command('update',
                         'cli_cosmosdb_cassandra_table_throughput_update')

    with self.command_group('cosmosdb gremlin database throughput',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.command('show', 'get_gremlin_database_throughput')
        g.custom_command('update',
                         'cli_cosmosdb_gremlin_database_throughput_update')

    with self.command_group('cosmosdb gremlin graph throughput',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.command('show', 'get_gremlin_graph_throughput')
        g.custom_command('update',
                         'cli_cosmosdb_gremlin_graph_throughput_update')

    with self.command_group('cosmosdb table throughput',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.command('show', 'get_table_throughput')
        g.custom_command('update', 'cli_cosmosdb_table_throughput_update')

    # virtual network rules
    with self.command_group('cosmosdb network-rule',
                            cosmosdb_custom_sdk,
                            client_factory=cf_db_accounts) as g:
        g.custom_command('list', 'cli_cosmosdb_network_rule_list')
        g.custom_command('add', 'cli_cosmosdb_network_rule_add')
        g.custom_command('remove', 'cli_cosmosdb_network_rule_remove')

    # key operations
    with self.command_group('cosmosdb keys',
                            cosmosdb_sdk,
                            client_factory=cf_db_accounts) as g:
        g.custom_command('list',
                         'cli_cosmosdb_keys',
                         table_transformer=list_connection_strings_output)
        g.command('regenerate', 'regenerate_key')

    # # database operations
    with self.command_group('cosmosdb database',
                            deprecate_info=self.deprecate(
                                redirect=DATABASE_DEPRECATION_INFO)) as g:
        g.cosmosdb_custom('show',
                          'cli_cosmosdb_database_show',
                          table_transformer=database_output)
        g.cosmosdb_custom('list',
                          'cli_cosmosdb_database_list',
                          table_transformer=list_database_output)
        g.cosmosdb_custom('exists', 'cli_cosmosdb_database_exists')
        g.cosmosdb_custom('create',
                          'cli_cosmosdb_database_create',
                          table_transformer=database_output)
        g.cosmosdb_custom('delete', 'cli_cosmosdb_database_delete')

    # collection operations
    with self.command_group('cosmosdb collection',
                            deprecate_info=self.deprecate(
                                redirect=COLLECTION_DEPRECATON_INFO)) as g:
        g.cosmosdb_custom('show',
                          'cli_cosmosdb_collection_show',
                          table_transformer=collection_output)
        g.cosmosdb_custom('list',
                          'cli_cosmosdb_collection_list',
                          table_transformer=list_collection_output)
        g.cosmosdb_custom('exists', 'cli_cosmosdb_collection_exists')
        g.cosmosdb_custom('create',
                          'cli_cosmosdb_collection_create',
                          table_transformer=collection_output)
        g.cosmosdb_custom('delete', 'cli_cosmosdb_collection_delete')
        g.cosmosdb_custom('update', 'cli_cosmosdb_collection_update')
Exemple #6
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#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#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
    )

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

    # 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,
                         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', '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 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('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')
 def __init__(self, cli_ctx=None):
     from azure.cli.core.commands import CliCommandType
     rdbms_connect_custom = CliCommandType(
         operations_tmpl='azext_rdbms_connect.custom#{}')
     super(RdbmsConnectCommandsLoader, self).__init__(cli_ctx=cli_ctx,
                                                      custom_command_type=rdbms_connect_custom)
 def __init__(self, cli_ctx=None):
     from azure.cli.core.commands import CliCommandType
     hack_custom = CliCommandType(operations_tmpl='azext_hack.custom#{}')
     super(HackExtCommandLoader,
           self).__init__(cli_ctx=cli_ctx, custom_command_type=hack_custom)
Exemple #9
0
def load_command_table(self, _):
    service_topologies = CliCommandType(
        operations_tmpl=
        'azure.mgmt.deploymentmanager.operations#ServiceTopologiesOperations.{}',
        client_factory=cf_service_topologies)

    services = CliCommandType(
        operations_tmpl=
        'azure.mgmt.deploymentmanager.operations#ServicesOperations.{}',
        client_factory=cf_services)

    service_units = CliCommandType(
        operations_tmpl=
        'azure.mgmt.deploymentmanager.operations#ServiceUnitsOperations.{}',
        client_factory=cf_service_units)

    artifact_sources = CliCommandType(
        operations_tmpl=
        'azure.mgmt.deploymentmanager.operations#ArtifactSourcesOperations.{}',
        client_factory=cf_artifact_sources)

    steps = CliCommandType(
        operations_tmpl=
        'azure.mgmt.deploymentmanager.operations#StepsOperations.{}',
        client_factory=cf_steps)

    rollouts = CliCommandType(
        operations_tmpl=
        'azure.mgmt.deploymentmanager.operations#RolloutsOperations.{}',
        client_factory=cf_rollouts)

    custom_tmpl = 'azure.cli.command_modules.deploymentmanager.custom#{}'
    deployment_manager_custom = CliCommandType(operations_tmpl=custom_tmpl)

    with self.command_group('deploymentmanager artifact-source',
                            artifact_sources) as g:
        g.custom_command('create', 'cli_artifact_source_create')
        g.command(
            'delete',
            'delete',
            confirmation=
            "There might be rollouts referencing the artifact source. Do you want to delete?"
        )
        g.show_command('show', 'get')
        g.command('list', 'list')
        g.generic_update_command('update',
                                 setter_arg_name='artifact_source_info',
                                 custom_func_name='cli_artifact_source_update',
                                 custom_func_type=deployment_manager_custom)

    with self.command_group('deploymentmanager service-topology',
                            service_topologies) as g:
        g.custom_command('create', 'cli_service_topology_create')
        g.command('delete', 'delete')
        g.show_command('show', 'get')
        g.command('list', 'list')
        g.generic_update_command(
            'update',
            setter_arg_name='service_topology_info',
            custom_func_name='cli_service_topology_update',
            custom_func_type=deployment_manager_custom)

    with self.command_group('deploymentmanager service', services) as g:
        g.custom_command('create', 'cli_service_create')
        g.command('delete', 'delete')
        g.show_command('show', 'get')
        g.command('list', 'list')
        g.generic_update_command('update',
                                 setter_arg_name='service_info',
                                 custom_func_name='cli_service_update',
                                 custom_func_type=deployment_manager_custom)

    with self.command_group('deploymentmanager service-unit',
                            service_units) as g:
        g.custom_command('create', 'cli_service_unit_create')
        g.command('delete', 'delete')
        g.show_command('show', 'get')
        g.command('list', 'list')
        g.generic_update_command('update',
                                 setter_arg_name='service_unit_info',
                                 custom_func_name='cli_service_unit_update',
                                 custom_func_type=deployment_manager_custom)

    with self.command_group('deploymentmanager step', steps) as g:
        g.custom_command('create', 'cli_step_create')
        g.command('delete', 'delete')
        g.show_command('show', 'get')
        g.command('list', 'list')
        g.generic_update_command('update',
                                 setter_arg_name='step_info',
                                 custom_func_name='cli_step_update',
                                 custom_func_type=deployment_manager_custom)

    with self.command_group('deploymentmanager rollout', rollouts) as g:
        g.show_command('show', 'get')
        g.command('list', 'list')
        g.command('stop',
                  'cancel',
                  confirmation="Do you want to cancel the rollout?")
        g.custom_command(
            'restart',
            'cli_rollout_restart',
            confirmation=
            "Are you sure you want to restart the rollout? If you want to skip all the steps that succeeded on the previous run, use '--skip-succeeded' option."
        )
        g.command('delete', 'delete')

    with self.command_group('deploymentmanager', is_preview=True):
        pass
def load_command_table(self, _):

    from azext_healthcareapis.generated._client_factory import cf_service
    healthcareapis_service = CliCommandType(
        operations_tmpl=
        'azext_healthcareapis.vendored_sdks.healthcareapis.operations._service_operations#ServiceOperat'
        'ions.{}',
        client_factory=cf_service)
    with self.command_group('healthcareapis service',
                            healthcareapis_service,
                            client_factory=cf_service,
                            is_experimental=True) as g:
        g.custom_command('list', 'healthcareapis_service_list')
        g.custom_show_command('show', 'healthcareapis_service_show')
        g.custom_command('create',
                         'healthcareapis_service_create',
                         supports_no_wait=True)
        g.custom_command('update',
                         'healthcareapis_service_update',
                         supports_no_wait=True)
        g.custom_command('delete',
                         'healthcareapis_service_delete',
                         supports_no_wait=True,
                         confirmation=True)
        g.custom_wait_command('wait', 'healthcareapis_service_show')

    with self.command_group('healthcareapis acr',
                            healthcareapis_service,
                            client_factory=cf_service,
                            is_experimental=True) as g:
        g.custom_command('list', 'healthcareapis_acr_list')
        g.custom_command('add',
                         'healthcareapis_acr_add',
                         supports_no_wait=False)
        g.custom_command('reset',
                         'healthcareapis_acr_reset',
                         supports_no_wait=False)
        g.custom_command('remove',
                         'healthcareapis_acr_remove',
                         supports_no_wait=False)

    from azext_healthcareapis.generated._client_factory import cf_operation_result
    healthcareapis_operation_result = CliCommandType(
        operations_tmpl=
        'azext_healthcareapis.vendored_sdks.healthcareapis.operations._operation_result_operations#Oper'
        'ationResultOperations.{}',
        client_factory=cf_operation_result)
    with self.command_group('healthcareapis operation-result',
                            healthcareapis_operation_result,
                            client_factory=cf_operation_result,
                            is_experimental=True) as g:
        g.custom_show_command('show', 'healthcareapis_operation_result_show')

    from azext_healthcareapis.generated._client_factory import cf_private_endpoint_connection
    healthcareapis_private_endpoint_connection = CliCommandType(
        operations_tmpl=
        'azext_healthcareapis.vendored_sdks.healthcareapis.operations._private_endpoint_connection_oper'
        'ations#PrivateEndpointConnectionOperations.{}',
        client_factory=cf_private_endpoint_connection)
    with self.command_group('healthcareapis private-endpoint-connection',
                            healthcareapis_private_endpoint_connection,
                            client_factory=cf_private_endpoint_connection,
                            is_experimental=True) as g:
        g.custom_command('list',
                         'healthcareapis_private_endpoint_connection_list')
        g.custom_show_command(
            'show', 'healthcareapis_private_endpoint_connection_show')
        g.custom_command('create',
                         'healthcareapis_private_endpoint_connection_create',
                         supports_no_wait=True)
        g.custom_command('update',
                         'healthcareapis_private_endpoint_connection_update',
                         supports_no_wait=True)
        g.custom_command('delete',
                         'healthcareapis_private_endpoint_connection_delete',
                         supports_no_wait=True,
                         confirmation=True)
        g.custom_wait_command(
            'wait', 'healthcareapis_private_endpoint_connection_show')

    from azext_healthcareapis.generated._client_factory import cf_private_link_resource
    healthcareapis_private_link_resource = CliCommandType(
        operations_tmpl=
        'azext_healthcareapis.vendored_sdks.healthcareapis.operations._private_link_resource_operations'
        '#PrivateLinkResourceOperations.{}',
        client_factory=cf_private_link_resource)
    with self.command_group('healthcareapis private-link-resource',
                            healthcareapis_private_link_resource,
                            client_factory=cf_private_link_resource,
                            is_experimental=True) as g:
        g.custom_command('list', 'healthcareapis_private_link_resource_list')
        g.custom_show_command('show',
                              'healthcareapis_private_link_resource_show')
Exemple #11
0
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.{}',
        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.{}',
        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', 'stop', supports_no_wait=True)
        g.command('start', '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)

    with self.command_group('aks command',
                            managed_clusters_sdk,
                            client_factory=cf_managed_clusters) as g:
        g.custom_command('invoke',
                         'aks_runcommand',
                         supports_no_wait=True,
                         table_transformer=aks_run_command_result_format)
        g.custom_command('result',
                         'aks_command_result',
                         supports_no_wait=False,
                         table_transformer=aks_run_command_result_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 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)
Exemple #12
0
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=too-many-statements
# pylint: disable=too-many-locals
# pylint: disable=bad-continuation
# pylint: disable=line-too-long

from azure.cli.core.commands import CliCommandType
from ..generated._client_factory import cf_virtual_machine, cf_virtual_machine_scale_set_vm_extension

vm_virtual_machine = CliCommandType(
    operations_tmpl=
    'azure.mgmt.compute.operations._virtual_machines_operations#VirtualMachinesOperations.{}',
    client_factory=cf_virtual_machine,
)

vm_virtual_machine_scale_set_vm_extension = CliCommandType(
    operations_tmpl=
    'azure.mgmt.compute.operations._virtual_machine_scale_set_vm_extensions_operations#VirtualMachineScaleSetVmExtensionsOperations.{}',
    client_factory=cf_virtual_machine_scale_set_vm_extension,
)


def load_command_table(self, _):

    with self.command_group('vm virtual-machine',
                            vm_virtual_machine,
                            client_factory=cf_virtual_machine,
Exemple #13
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',
            deprecate_info=g.deprecate(
                redirect='az vmware private-cloud list-admin-credentials',
                hide=True))
        g.custom_command('list-admin-credentials',
                         'privatecloud_listadmincredentials')
        g.custom_command(
            'addidentitysource',
            'privatecloud_addidentitysource',
            deprecate_info=g.deprecate(
                redirect='az vmware private-cloud add-identity-source',
                hide=True))
        g.custom_command('add-identity-source',
                         'privatecloud_addidentitysource')
        g.custom_command(
            'deleteidentitysource',
            'privatecloud_deleteidentitysource',
            deprecate_info=g.deprecate(
                redirect='az vmware private-cloud delete-identity-source',
                hide=True))
        g.custom_command('delete-identity-source',
                         'privatecloud_deleteidentitysource')
        g.custom_command('add-availability-zone',
                         'privatecloud_addavailabilityzone')
        g.custom_command('delete-availability-zone',
                         'privatecloud_deleteavailabilityzone')
        g.custom_command(
            'add-cmk-encryption',
            'privatecloud_addcmkencryption',
            deprecate_info=g.deprecate(
                redirect='az vmware private-cloud enable-cmk-encryption',
                hide=True))
        g.custom_command(
            'delete-cmk-encryption',
            'privatecloud_deletecmkenryption',
            deprecate_info=g.deprecate(
                redirect='az vmware private-cloud disable-cmk-encryption',
                hide=True))
        g.custom_command('enable-cmk-encryption',
                         'privatecloud_addcmkencryption')
        g.custom_command('disable-cmk-encryption',
                         'privatecloud_deletecmkenryption')
        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 private-cloud identity',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('assign', 'privatecloud_identity_assign')
        g.custom_command('remove', 'privatecloud_identity_remove')
        g.custom_show_command('show', 'privatecloud_identity_get')

    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',
            deprecate_info=g.deprecate(
                redirect=
                '"az vmware datastore netapp-volume create" or "az vmware datastore disk-pool-volume create"',
                hide=True))
        g.custom_command('list', 'datastore_list')
        g.custom_show_command('show', 'datastore_show')
        g.custom_command('delete', 'datastore_delete')

    with self.command_group('vmware datastore netapp-volume',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('create', 'datastore_netappvolume_create')

    with self.command_group('vmware datastore disk-pool-volume',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('create', 'datastore_diskpoolvolume_create')

    with self.command_group('vmware addon',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('list', 'addon_list')

    with self.command_group('vmware addon vr',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('create', 'addon_vr_create')
        g.custom_show_command('show', 'addon_vr_show')
        g.custom_command('update', 'addon_vr_update')
        g.custom_command('delete', 'addon_vr_delete')

    with self.command_group('vmware addon hcx',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('create', 'addon_hcx_create')
        g.custom_show_command('show', 'addon_hcx_show')
        g.custom_command('update', 'addon_hcx_update')
        g.custom_command('delete', 'addon_hcx_delete')

    with self.command_group('vmware addon srm',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('create', 'addon_srm_create')
        g.custom_show_command('show', 'addon_srm_show')
        g.custom_command('update', 'addon_srm_update')
        g.custom_command('delete', 'addon_srm_delete')

    with self.command_group('vmware global-reach-connection',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('create', 'globalreachconnection_create')
        g.custom_command('list', 'globalreachconnection_list')
        g.custom_command('delete', 'globalreachconnection_delete')
        g.custom_show_command('show', 'globalreachconnection_show')

    with self.command_group('vmware cloud-link',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('create', 'cloud_link_create')
        g.custom_command('list', 'cloud_link_list')
        g.custom_command('delete', 'cloud_link_delete')
        g.custom_show_command('show', 'cloud_link_show')

    with self.command_group('vmware script-cmdlet',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('list', 'script_cmdlet_list')
        g.custom_show_command('show', 'script_cmdlet_show')

    with self.command_group('vmware script-package',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('list', 'script_package_list')
        g.custom_show_command('show', 'script_package_show')

    with self.command_group('vmware script-execution',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('create', 'script_execution_create')
        g.custom_command('list', 'script_execution_list')
        g.custom_command('delete', 'script_execution_delete')
        g.custom_show_command('show', 'script_execution_show')

    with self.command_group('vmware workload-network dhcp',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('list', 'workload_network_dhcp_list')
        g.custom_show_command('show', 'workload_network_dhcp_show')

    with self.command_group('vmware workload-network dhcp server',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('create', 'workload_network_dhcp_server_create')
        g.custom_command('delete', 'workload_network_dhcp_delete')
        g.custom_command('update', 'workload_network_dhcp_server_update')

    with self.command_group('vmware workload-network dhcp relay',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('create', 'workload_network_dhcp_relay_create')
        g.custom_command('delete', 'workload_network_dhcp_delete')
        g.custom_command('update', 'workload_network_dhcp_relay_update')

    with self.command_group('vmware workload-network dns-service',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('list', 'workload_network_dns_services_list')
        g.custom_show_command('show', 'workload_network_dns_services_get')
        g.custom_command('create', 'workload_network_dns_services_create')
        g.custom_command('update', 'workload_network_dns_services_update')
        g.custom_command('delete', 'workload_network_dns_services_delete')

    with self.command_group('vmware workload-network dns-zone',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('list', 'workload_network_dns_zone_list')
        g.custom_show_command('show', 'workload_network_dns_zone_get')
        g.custom_command('create', 'workload_network_dns_zone_create')
        g.custom_command('update', 'workload_network_dns_zone_update')
        g.custom_command('delete', 'workload_network_dns_zone_delete')

    with self.command_group('vmware workload-network port-mirroring',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('list', 'workload_network_port_mirroring_list')
        g.custom_show_command('show', 'workload_network_port_mirroring_get')
        g.custom_command('create', 'workload_network_port_mirroring_create')
        g.custom_command('update', 'workload_network_port_mirroring_update')
        g.custom_command('delete', 'workload_network_port_mirroring_delete')

    with self.command_group('vmware workload-network segment',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('list', 'workload_network_segment_list')
        g.custom_show_command('show', 'workload_network_segment_get')
        g.custom_command('create', 'workload_network_segment_create')
        g.custom_command('update', 'workload_network_segment_update')
        g.custom_command('delete', 'workload_network_segment_delete')

    with self.command_group('vmware workload-network public-ip',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('list', 'workload_network_public_ip_list')
        g.custom_show_command('show', 'workload_network_public_ip_get')
        g.custom_command('create', 'workload_network_public_ip_create')
        g.custom_command('delete', 'workload_network_public_ip_delete')

    with self.command_group('vmware workload-network vm-group',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('list', 'workload_network_vm_group_list')
        g.custom_show_command('show', 'workload_network_vm_group_get')
        g.custom_command('create', 'workload_network_vm_group_create')
        g.custom_command('update', 'workload_network_vm_group_update')
        g.custom_command('delete', 'workload_network_vm_group_delete')

    with self.command_group('vmware workload-network vm',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('list', 'workload_network_vm_list')
        g.custom_show_command('show', 'workload_network_vm_get')

    with self.command_group('vmware workload-network gateway',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('list', 'workload_network_gateway_list')
        g.custom_show_command('show', 'workload_network_gateway_get')

    with self.command_group('vmware placement-policy',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('list', 'placement_policy_list')
        g.custom_show_command('show', 'placement_policy_get')

    with self.command_group('vmware placement-policy vm',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('create', 'placement_policy_vm_create')
        g.custom_command('update', 'placement_policy_update')
        g.custom_command('delete', 'placement_policy_delete')

    with self.command_group('vmware placement-policy vm-host',
                            vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('create', 'placement_policy_vm_host_create')
        g.custom_command('update', 'placement_policy_update')
        g.custom_command('delete', 'placement_policy_delete')

    with self.command_group('vmware vm', vmware_sdk,
                            client_factory=cf_vmware) as g:
        g.custom_command('list', 'virtual_machine_list')
        g.custom_show_command('show', 'virtual_machine_get')
        g.custom_command('restrict-movement', 'virtual_machine_restrict')
Exemple #14
0
def load_command_table(self, _):  # pylint: disable=too-many-statements

    update_custom_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.iot.custom#{}')

    iot_central_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.iotcentral.operations#IoTCentaralOperations.{}')

    # iot dps commands
    with self.command_group(
            'iot dps', client_factory=iot_service_provisioning_factory) as g:
        g.custom_command('list', 'iot_dps_list')
        g.custom_show_command('show', 'iot_dps_get')
        g.custom_command('create', 'iot_dps_create')
        g.custom_command('delete', 'iot_dps_delete')
        g.generic_update_command('update',
                                 getter_name='iot_dps_get',
                                 setter_name='iot_dps_update',
                                 command_type=update_custom_util)

    # iot dps access-policy commands
    with self.command_group(
            'iot dps access-policy',
            client_factory=iot_service_provisioning_factory) as g:
        g.custom_command('list', 'iot_dps_access_policy_list')
        g.custom_show_command('show', 'iot_dps_access_policy_get')
        g.custom_command('create',
                         'iot_dps_access_policy_create',
                         supports_no_wait=True)
        g.custom_command('update',
                         'iot_dps_access_policy_update',
                         supports_no_wait=True)
        g.custom_command('delete',
                         'iot_dps_access_policy_delete',
                         supports_no_wait=True)

    # iot dps linked-hub commands
    with self.command_group(
            'iot dps linked-hub',
            client_factory=iot_service_provisioning_factory) as g:
        g.custom_command('list', 'iot_dps_linked_hub_list')
        g.custom_show_command('show', 'iot_dps_linked_hub_get')
        g.custom_command('create',
                         'iot_dps_linked_hub_create',
                         supports_no_wait=True)
        g.custom_command('update',
                         'iot_dps_linked_hub_update',
                         supports_no_wait=True)
        g.custom_command('delete',
                         'iot_dps_linked_hub_delete',
                         supports_no_wait=True)

    # iot dps certificate commands
    with self.command_group(
            'iot dps certificate',
            client_factory=iot_service_provisioning_factory) as g:
        g.custom_command('list', 'iot_dps_certificate_list')
        g.custom_show_command('show', 'iot_dps_certificate_get')
        g.custom_command('create', 'iot_dps_certificate_create')
        g.custom_command('delete', 'iot_dps_certificate_delete')
        g.custom_command('generate-verification-code',
                         'iot_dps_certificate_gen_code')
        g.custom_command('verify', 'iot_dps_certificate_verify')
        g.custom_command('update', 'iot_dps_certificate_update')

    # iot hub certificate commands
    with self.command_group('iot hub certificate',
                            client_factory=iot_hub_service_factory) as g:
        g.custom_command('list', 'iot_hub_certificate_list')
        g.custom_show_command('show', 'iot_hub_certificate_get')
        g.custom_command('create', 'iot_hub_certificate_create')
        g.custom_command('delete', 'iot_hub_certificate_delete')
        g.custom_command('generate-verification-code',
                         'iot_hub_certificate_gen_code')
        g.custom_command('verify', 'iot_hub_certificate_verify')
        g.custom_command('update', 'iot_hub_certificate_update')

    # iot hub commands
    with self.command_group('iot hub',
                            client_factory=iot_hub_service_factory) as g:
        g.custom_command('create', 'iot_hub_create')
        g.custom_command('list', 'iot_hub_list')
        g.custom_command(
            'show-connection-string',
            'iot_hub_show_connection_string',
            deprecate_info=self.deprecate(redirect=CS_DEPRECATION_INFO))
        g.custom_show_command('show', 'iot_hub_get')
        g.generic_update_command('update',
                                 getter_name='iot_hub_get',
                                 setter_name='iot_hub_update',
                                 command_type=update_custom_util,
                                 custom_func_name='update_iot_hub_custom')
        g.custom_command('delete',
                         'iot_hub_delete',
                         transform=HubDeleteResultTransform(self.cli_ctx))
        g.custom_command('list-skus', 'iot_hub_sku_list')
        g.custom_command('show-quota-metrics', 'iot_hub_get_quota_metrics')
        g.custom_command('show-stats', 'iot_hub_get_stats')
        g.custom_command('manual-failover',
                         'iot_hub_manual_failover',
                         supports_no_wait=True)

    # iot hub consumer group commands
    with self.command_group('iot hub consumer-group',
                            client_factory=iot_hub_service_factory) as g:
        g.custom_command('create', 'iot_hub_consumer_group_create')
        g.custom_command('list', 'iot_hub_consumer_group_list')
        g.custom_show_command('show', 'iot_hub_consumer_group_get')
        g.custom_command('delete', 'iot_hub_consumer_group_delete')

    # iot hub policy commands
    with self.command_group('iot hub policy',
                            client_factory=iot_hub_service_factory) as g:
        g.custom_command('list', 'iot_hub_policy_list')
        g.custom_show_command('show', 'iot_hub_policy_get')
        g.custom_command('create',
                         'iot_hub_policy_create',
                         transform=PolicyUpdateResultTransform(self.cli_ctx))
        g.custom_command('delete',
                         'iot_hub_policy_delete',
                         transform=PolicyUpdateResultTransform(self.cli_ctx))
        g.custom_command('renew-key',
                         'iot_hub_policy_key_renew',
                         supports_no_wait=True)

    # iot hub routing endpoint commands
    with self.command_group('iot hub routing-endpoint',
                            client_factory=iot_hub_service_factory) as g:
        g.custom_command('create',
                         'iot_hub_routing_endpoint_create',
                         transform=EndpointUpdateResultTransform(self.cli_ctx))
        g.custom_show_command('show', 'iot_hub_routing_endpoint_show')
        g.custom_command('list', 'iot_hub_routing_endpoint_list')
        g.custom_command('delete',
                         'iot_hub_routing_endpoint_delete',
                         transform=EndpointUpdateResultTransform(self.cli_ctx))

    # iot hub message enrichment commands
    with self.command_group('iot hub message-enrichment',
                            client_factory=iot_hub_service_factory,
                            min_api="2019-07-01-preview") as g:
        g.custom_command('create', 'iot_message_enrichment_create')
        g.custom_command('list', 'iot_message_enrichment_list')
        g.custom_command('delete', 'iot_message_enrichment_delete')
        g.custom_command('update', 'iot_message_enrichment_update')

    # iot hub route commands
    with self.command_group('iot hub route',
                            client_factory=iot_hub_service_factory) as g:
        g.custom_command('create',
                         'iot_hub_route_create',
                         transform=RouteUpdateResultTransform(self.cli_ctx))
        g.custom_show_command('show', 'iot_hub_route_show')
        g.custom_command('list', 'iot_hub_route_list')
        g.custom_command('delete',
                         'iot_hub_route_delete',
                         transform=RouteUpdateResultTransform(self.cli_ctx))
        g.custom_command('update',
                         'iot_hub_route_update',
                         transform=RouteUpdateResultTransform(self.cli_ctx))
        g.custom_command('test', 'iot_hub_route_test')

    # iot hub device stream commands
    with self.command_group('iot hub devicestream',
                            client_factory=iot_hub_service_factory,
                            min_api="2019-07-01-preview") as g:
        g.custom_show_command('show', 'iot_hub_devicestream_show')

    with self.command_group('iot central app',
                            iot_central_sdk,
                            client_factory=iot_central_service_factory,
                            is_preview=True) as g:
        g.custom_command('create',
                         'iot_central_app_create',
                         supports_no_wait=True)
        g.custom_command('list', 'iot_central_app_list')
        g.custom_show_command('show', 'iot_central_app_get')
        g.generic_update_command('update',
                                 getter_name='iot_central_app_get',
                                 setter_name='iot_central_app_update',
                                 command_type=update_custom_util)
        g.custom_command('delete',
                         'iot_central_app_delete',
                         confirmation=True,
                         supports_no_wait=True)
Exemple #15
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 #16
0
def load_command_table(self, _):

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

    acr_cred_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.credential#{}',
        table_transformer=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=output_format,
        client_factory=cf_acr_webhooks)

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

    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.command('show', 'acr_show', exception_handler=empty_on_404)
        g.command('login', 'acr_login')
        g.command('show-usage', 'acr_show_usage')
        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 credential', acr_cred_util) as g:
        g.command('show',
                  'acr_credential_show',
                  exception_handler=empty_on_404)
        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('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.command('show', 'acr_webhook_show')
        g.command('get-config', 'acr_webhook_get_config')
        g.command('list-events', 'acr_webhook_list_events')
        g.command('ping', 'acr_webhook_ping')
        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.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)
Exemple #17
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

    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_sqlpool_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.synapse.operations#SqlPoolsOperations.{}',
        client_factory=cf_synapse_client_sqlpool_factory)

    synapse_firewallrules_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.synapse.operations#IpFirewallRulesOperations.{}',
        client_factory=cf_synapse_client_ipfirewallrules_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.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.command('delete', 'delete', confirmation=True, supports_no_wait=True)
        g.wait_command('wait')

    # 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
# --------------------------------------------------------------------------
# pylint: disable=too-many-statements
# pylint: disable=too-many-locals
# pylint: disable=bad-continuation
# pylint: disable=line-too-long

from azure.cli.core.commands import CliCommandType
from azext_resource_mover.generated._client_factory import (
    cf_move_collection,
    cf_move_resource,
    cf_unresolved_dependency,
)

resource_mover_move_collection = CliCommandType(
    operations_tmpl=
    'azext_resource_mover.vendored_sdks.resourcemover.operations._move_collections_operations#MoveCollectionsOperations.{}',
    client_factory=cf_move_collection,
)

resource_mover_unresolved_dependency = CliCommandType(
    operations_tmpl=
    'azext_resource_mover.vendored_sdks.resourcemover.operations._unresolved_dependencies_operations#UnresolvedDependenciesOperations.{}',
    client_factory=cf_unresolved_dependency,
)

resource_mover_move_resource = CliCommandType(
    operations_tmpl=
    'azext_resource_mover.vendored_sdks.resourcemover.operations._move_resources_operations#MoveResourcesOperations.{}',
    client_factory=cf_move_resource,
)
Exemple #19
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 ._format import (
    transform_build_table_output, transform_builds_table_output,
    transform_definition_table_output, transform_definitions_table_output,
    transform_tasks_table_output, transform_task_table_output,
    transform_releases_table_output, transform_release_table_output,
    transform_release_definitions_table_output,
    transform_release_definition_table_output)

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

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

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

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

releaseDefinitionOps = CliCommandType(
    operations_tmpl='azext_devops.dev.pipelines.release_definition#{}')


def load_build_commands(self, _):
def load_command_table(self, _):

    workspace_ops = CliCommandType(
        operations_tmpl='azext_quantum.operations.workspace#{}')
    job_ops = CliCommandType(operations_tmpl='azext_quantum.operations.job#{}')
    target_ops = CliCommandType(
        operations_tmpl='azext_quantum.operations.target#{}')
    offerings_ops = CliCommandType(
        operations_tmpl='azext_quantum.operations.offerings#{}')

    with self.command_group('quantum workspace', workspace_ops) as w:
        w.command('create', 'create')
        w.command('delete',
                  'delete',
                  validator=validate_workspace_info_no_location)
        w.command('list', 'list')
        w.show_command('show', validator=validate_workspace_info_no_location)
        w.command('set', 'set', validator=validate_workspace_info)
        w.command('clear', 'clear')
        w.command('quotas', 'quotas', validator=validate_workspace_info)

    with self.command_group('quantum target', target_ops) as t:
        t.command('list',
                  'list',
                  validator=validate_workspace_info,
                  table_transformer=transform_targets)
        t.show_command('show', validator=validate_target_info)
        t.command('set', 'set', validator=validate_target_info)
        t.command('clear', 'clear')

    with self.command_group('quantum job', job_ops) as j:
        j.command('list',
                  'list',
                  validator=validate_workspace_info,
                  table_transformer=transform_jobs)
        j.show_command('show',
                       validator=validate_workspace_info,
                       table_transformer=transform_job)
        j.command('submit',
                  'submit',
                  validator=validate_workspace_and_target_info,
                  table_transformer=transform_job)
        j.command('wait',
                  'wait',
                  validator=validate_workspace_info,
                  table_transformer=transform_job)
        j.command('output',
                  'output',
                  validator=validate_workspace_info,
                  table_transformer=transform_output)
        j.command('cancel',
                  'cancel',
                  validator=validate_workspace_info,
                  table_transformer=transform_job)

    with self.command_group('quantum', job_ops, is_preview=True) as q:
        q.command('run',
                  'run',
                  validator=validate_workspace_and_target_info,
                  table_transformer=transform_output)
        q.command('execute',
                  'run',
                  validator=validate_workspace_and_target_info,
                  table_transformer=transform_output)

    with self.command_group('quantum offerings', offerings_ops) as o:
        o.command('list',
                  'list_offerings',
                  table_transformer=transform_offerings)
        o.command('accept-terms',
                  'accept_terms',
                  validator=validate_provider_and_sku_info)
        o.command('show-terms',
                  'show_terms',
                  validator=validate_provider_and_sku_info)
Exemple #21
0
def load_command_table(self, _):

    container_services_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.containerservice.v2017_07_01.operations.'
        'container_services_operations#ContainerServicesOperations.{}',
        client_factory=cf_container_services)

    managed_clusters_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.containerservice.v2018_03_31.operations.'
        'managed_clusters_operations#ManagedClustersOperations.{}',
        client_factory=cf_managed_clusters)

    openshift_managed_clusters_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.containerservice.v2018_09_30_preview.operations.'
        'open_shift_managed_clusters_operations#OpenShiftManagedClustersOperations.{}',
        client_factory=cf_openshift_managed_clusters)

    # ACS base commands
    # TODO: When the first azure-cli release after January 31, 2020 is planned, add
    # `expiration=<CLI core version>` to the `self.deprecate()` args below.
    deprecate_info = self.deprecate(redirect='aks')
    with self.command_group('acs',
                            container_services_sdk,
                            deprecate_info=deprecate_info,
                            client_factory=cf_container_services) as g:
        g.custom_command('browse', 'acs_browse')
        g.custom_command('create',
                         'acs_create',
                         supports_no_wait=True,
                         table_transformer=deployment_validate_table_format)
        g.command('delete', 'delete', confirmation=True)
        g.custom_command('list', 'list_container_services')
        g.custom_command('list-locations', 'list_acs_locations')
        g.custom_command('scale', 'update_acs')
        g.show_command('show', 'get')
        g.wait_command('wait')

    # ACS Mesos DC/OS commands
    with self.command_group('acs dcos',
                            container_services_sdk,
                            client_factory=cf_container_services) as g:
        g.custom_command('browse', 'dcos_browse')
        g.custom_command('install-cli',
                         'dcos_install_cli',
                         client_factory=None)

    # ACS Kubernetes commands
    with self.command_group('acs kubernetes',
                            container_services_sdk,
                            client_factory=cf_container_services) as g:
        g.custom_command('browse', 'k8s_browse')
        g.custom_command('get-credentials', 'k8s_get_credentials')
        g.custom_command('install-cli', 'k8s_install_cli', client_factory=None)

    # AKS commands
    with self.command_group('aks',
                            managed_clusters_sdk,
                            client_factory=cf_managed_clusters) as g:
        g.custom_command('browse', 'aks_browse')
        g.custom_command('create', 'aks_create', supports_no_wait=True)
        g.command('delete', 'delete', supports_no_wait=True, confirmation=True)
        g.custom_command('update-credentials',
                         'aks_update_credentials',
                         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.command('get-upgrades',
                  'get_upgrade_profile',
                  table_transformer=aks_upgrades_table_format)
        g.custom_command('install-cli', 'k8s_install_cli', client_factory=None)
        g.custom_command('install-connector', 'k8s_install_connector')
        g.custom_command('list',
                         'aks_list',
                         table_transformer=aks_list_table_format)
        g.custom_command('remove-connector', 'k8s_uninstall_connector')
        g.custom_command('remove-dev-spaces', 'aks_remove_dev_spaces')
        g.custom_command('scale', 'aks_scale', supports_no_wait=True)
        g.custom_show_command('show',
                              'aks_show',
                              table_transformer=aks_show_table_format)
        g.custom_command(
            'upgrade',
            'aks_upgrade',
            supports_no_wait=True,
            confirmation=
            'Kubernetes may be unavailable during cluster upgrades.\n' +
            'Are you sure you want to perform this operation?')
        g.custom_command('upgrade-connector', 'k8s_upgrade_connector')
        g.custom_command('use-dev-spaces', 'aks_use_dev_spaces')
        g.wait_command('wait')

    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)

    # OSA commands
    with self.command_group('openshift',
                            openshift_managed_clusters_sdk,
                            client_factory=cf_openshift_managed_clusters) as g:
        g.custom_command('create', 'openshift_create', supports_no_wait=True)
        g.command('delete', 'delete', supports_no_wait=True, confirmation=True)
        g.custom_command('scale', 'openshift_scale', supports_no_wait=True)
        g.custom_show_command('show', 'openshift_show')
        g.custom_command('list',
                         'osa_list',
                         table_transformer=osa_list_table_format)
        g.wait_command('wait')
def load_command_table(self, _):
    with self.command_group('dataprotection backup-instance') as g:
        g.custom_command('initialize',
                         "dataprotection_backup_instance_initialize")
        g.custom_command('update-policy',
                         "dataprotection_backup_instance_update_policy",
                         client_factory=cf_backup_instance,
                         supports_no_wait=True)
        g.custom_command(
            'list-from-resourcegraph',
            'dataprotection_backup_instance_list_from_resourcegraph',
            client_factory=cf_resource_graph_client)

    with self.command_group('dataprotection backup-policy') as g:
        g.custom_command(
            'get-default-policy-template',
            "dataprotection_backup_policy_get_default_policy_template")

    with self.command_group('dataprotection backup-policy trigger') as g:
        g.custom_command(
            'create-schedule',
            "dataprotection_backup_policy_trigger_create_schedule")
        g.custom_command('set',
                         "dataprotection_backup_policy_trigger_set_in_policy")

    with self.command_group(
            'dataprotection backup-policy retention-rule') as g:
        g.custom_command('create-lifecycle',
                         "dataprotection_backup_policy_create_lifecycle")
        g.custom_command(
            'set', "dataprotection_backup_policy_retention_set_in_policy")
        g.custom_command(
            'remove',
            "dataprotection_backup_policy_retention_remove_in_policy")

    with self.command_group('dataprotection backup-policy tag') as g:
        g.custom_command(
            'create-absolute-criteria',
            "dataprotection_backup_policy_create_absolute_criteria")
        g.custom_command(
            'create-generic-criteria',
            "dataprotection_backup_policy_create_generic_criteria")
        g.custom_command('set',
                         "dataprotection_backup_policy_tag_set_in_policy")
        g.custom_command('remove',
                         "dataprotection_backup_policy_tag_remove_in_policy")

    with self.command_group('dataprotection job') as g:
        g.custom_command('list-from-resourcegraph',
                         "dataprotection_job_list_from_resourcegraph",
                         client_factory=cf_resource_graph_client)

    dataprotection_backup_instance = CliCommandType(
        operations_tmpl=
        'azext_dataprotection.vendored_sdks.dataprotection.operations._backup_instances_operations#BackupInstancesOperations.{}',
        client_factory=cf_backup_instance)

    with self.command_group('dataprotection backup-instance restore',
                            dataprotection_backup_instance,
                            client_factory=cf_backup_instance) as g:
        g.custom_command('initialize-for-data-recovery',
                         'restore_initialize_for_data_recovery')
        g.custom_command('initialize-for-item-recovery',
                         'restore_initialize_for_item_recovery')

    with self.command_group('dataprotection backup-vault') as g:
        g.custom_command('list',
                         'dataprotection_backup_vault_list',
                         client_factory=cf_backup_vault)
Exemple #23
0
def load_command_table(self, _):
    webclient_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.web.web_site_management_client#WebSiteManagementClient.{}',
        client_factory=cf_web_client)
    appservice_plan_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.web.operations.app_service_plans_operations#AppServicePlansOperations.{}',
        client_factory=cf_plans)
    webapp_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.web.operations.web_apps_operations#WebAppsOperations.{}',
        client_factory=cf_webapps)
    appservice_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.appservice.custom#{}')

    with self.command_group('webapp', webapp_sdk) as g:
        g.custom_command('create',
                         'create_webapp',
                         exception_handler=ex_handler_factory())
        g.custom_command('list',
                         'list_webapp',
                         table_transformer=transform_web_list_output)
        g.custom_show_command('show',
                              'show_webapp',
                              table_transformer=transform_web_output)
        g.custom_command('delete', 'delete_webapp')
        g.custom_command('stop', 'stop_webapp')
        g.custom_command('start', 'start_webapp')
        g.custom_command('restart', 'restart_webapp')
        g.custom_command('browse', 'view_in_browser')
        g.custom_command('list-runtimes', 'list_runtimes')
        g.custom_command('identity assign', 'assign_identity')
        g.custom_command('identity show', 'show_identity')
        g.custom_command('identity remove', 'remove_identity')
        g.generic_update_command('update',
                                 getter_name='get_webapp',
                                 setter_name='set_webapp',
                                 custom_func_name='update_webapp',
                                 command_type=appservice_custom)

    with self.command_group('webapp traffic-routing') as g:
        g.custom_command('set', 'set_traffic_routing')
        g.custom_show_command('show', 'show_traffic_routing')
        g.custom_command('clear', 'clear_traffic_routing')

    with self.command_group('webapp config') as g:
        g.custom_command('set', 'update_site_configs')
        g.custom_show_command('show', 'get_site_configs')

    with self.command_group('webapp config appsettings') as g:
        g.custom_command('list',
                         'get_app_settings',
                         exception_handler=empty_on_404)
        g.custom_command('set', 'update_app_settings')
        g.custom_command('delete', 'delete_app_settings')

    with self.command_group('webapp config connection-string') as g:
        g.custom_command('list',
                         'get_connection_strings',
                         exception_handler=empty_on_404)
        g.custom_command('set', 'update_connection_strings')
        g.custom_command('delete', 'delete_connection_strings')

    with self.command_group('webapp config hostname') as g:
        g.custom_command('add',
                         'add_hostname',
                         exception_handler=ex_handler_factory())
        g.custom_command('list', 'list_hostnames')
        g.custom_command('delete', 'delete_hostname')
        g.custom_command('get-external-ip', 'get_external_ip')

    with self.command_group('webapp config container') as g:
        g.custom_command('set', 'update_container_settings')
        g.custom_command('delete', 'delete_container_settings')
        g.custom_show_command('show', 'show_container_settings')

    with self.command_group('webapp config ssl') as g:
        g.custom_command('upload',
                         'upload_ssl_cert',
                         exception_handler=ex_handler_factory())
        g.custom_command('list', 'list_ssl_certs')
        g.custom_command('bind',
                         'bind_ssl_cert',
                         exception_handler=ex_handler_factory())
        g.custom_command('unbind', 'unbind_ssl_cert')
        g.custom_command('delete', 'delete_ssl_cert')

    with self.command_group('webapp config backup') as g:
        g.custom_command('list', 'list_backups')
        g.custom_show_command('show', 'show_backup_configuration')
        g.custom_command('create',
                         'create_backup',
                         exception_handler=ex_handler_factory())
        g.custom_command('update',
                         'update_backup_schedule',
                         exception_handler=ex_handler_factory())
        g.custom_command('restore',
                         'restore_backup',
                         exception_handler=ex_handler_factory())

    with self.command_group('webapp deployment source') as g:
        g.custom_command('config-local-git', 'enable_local_git')
        g.custom_command('config-zip', 'enable_zip_deploy')
        g.custom_command('config',
                         'config_source_control',
                         exception_handler=ex_handler_factory())
        g.custom_command('sync',
                         'sync_site_repo',
                         exception_handler=ex_handler_factory())
        g.custom_show_command('show', 'show_source_control')
        g.custom_command('delete', 'delete_source_control')
        g.custom_command('update-token',
                         'update_git_token',
                         exception_handler=ex_handler_factory())

    with self.command_group('webapp log') as g:
        g.custom_command('tail', 'get_streaming_log')
        g.custom_command('download', 'download_historical_logs')
        g.custom_command('config', 'config_diagnostics')
        g.custom_show_command('show', 'show_diagnostic_settings')

    with self.command_group('webapp deployment slot') as g:
        g.custom_command('list',
                         'list_slots',
                         table_transformer=output_slots_in_table)
        g.custom_command('delete', 'delete_slot')
        g.custom_command('auto-swap', 'config_slot_auto_swap')
        g.custom_command('swap',
                         'swap_slot',
                         exception_handler=ex_handler_factory())
        g.custom_command('create',
                         'create_webapp_slot',
                         exception_handler=ex_handler_factory())

    with self.command_group('webapp deployment') as g:
        g.custom_command('list-publishing-profiles', 'list_publish_profiles')

    with self.command_group('webapp deployment user', webclient_sdk) as g:
        g.show_command('show', 'get_publishing_user')
        g.custom_command('set',
                         'set_deployment_user',
                         exception_handler=ex_handler_factory())

    with self.command_group('webapp deployment container') as g:
        g.custom_command('config', 'enable_cd')
        g.custom_command('show-cd-url', 'show_container_cd_url')

    with self.command_group('webapp auth') as g:
        g.custom_show_command('show', 'get_auth_settings')
        g.custom_command('update', 'update_auth_settings')

    with self.command_group('appservice plan', appservice_plan_sdk) as g:
        g.custom_command(
            'create',
            'create_app_service_plan',
            exception_handler=ex_handler_factory(creating_plan=True))
        g.command('delete', 'delete', confirmation=True)
        g.custom_command('list', 'list_app_service_plans')
        g.show_command('show', 'get')
        g.generic_update_command('update',
                                 custom_func_name='update_app_service_plan',
                                 setter_arg_name='app_service_plan')
    with self.command_group('appservice') as g:
        g.custom_command('list-locations',
                         'list_locations',
                         transform=transform_list_location_output)

    with self.command_group('functionapp') as g:
        g.custom_command('create', 'create_function')
        g.custom_command('list',
                         'list_function_app',
                         table_transformer=transform_web_list_output)
        g.custom_show_command('show',
                              'show_webapp',
                              table_transformer=transform_web_output)
        g.custom_command('delete', 'delete_function_app')
        g.custom_command('stop', 'stop_webapp')
        g.custom_command('start', 'start_webapp')
        g.custom_command('restart', 'restart_webapp')
        g.custom_command('list-consumption-locations',
                         'list_consumption_locations')
        g.custom_command('identity assign', 'assign_identity')
        g.custom_command('identity show', 'show_identity')
        g.custom_command('identity remove', 'remove_identity')
        g.generic_update_command('update',
                                 setter_name='set_functionapp',
                                 setter_type=appservice_custom,
                                 command_type=webapp_sdk)

    with self.command_group('functionapp config appsettings') as g:
        g.custom_command('list',
                         'get_app_settings',
                         exception_handler=empty_on_404)
        g.custom_command('set', 'update_app_settings')
        g.custom_command('delete', 'delete_app_settings')

    with self.command_group('functionapp config hostname') as g:
        g.custom_command('add',
                         'add_hostname',
                         exception_handler=ex_handler_factory())
        g.custom_command('list', 'list_hostnames')
        g.custom_command('delete', 'delete_hostname')
        g.custom_command('get-external-ip', 'get_external_ip')

    with self.command_group('functionapp config ssl') as g:
        g.custom_command('upload',
                         'upload_ssl_cert',
                         exception_handler=ex_handler_factory())
        g.custom_command('list', 'list_ssl_certs')
        g.custom_command('bind',
                         'bind_ssl_cert',
                         exception_handler=ex_handler_factory())
        g.custom_command('unbind', 'unbind_ssl_cert')
        g.custom_command('delete', 'delete_ssl_cert')

    with self.command_group('functionapp deployment source') as g:
        g.custom_command('config-local-git', 'enable_local_git')
        g.custom_command('config-zip', 'enable_zip_deploy')
        g.custom_command('config',
                         'config_source_control',
                         exception_handler=ex_handler_factory())
        g.custom_command('sync', 'sync_site_repo')
        g.custom_show_command('show', 'show_source_control')
        g.custom_command('delete', 'delete_source_control')
        g.custom_command('update-token',
                         'update_git_token',
                         exception_handler=ex_handler_factory())

    with self.command_group('functionapp deployment user', webclient_sdk) as g:
        g.custom_command('set',
                         'set_deployment_user',
                         exception_handler=ex_handler_factory())
        g.show_command('show', 'get_publishing_user')

    with self.command_group('functionapp deployment') as g:
        g.custom_command('list-publishing-profiles', 'list_publish_profiles')
Exemple #24
0
def load_command_table(self, _):
    rdbms_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.rdbms.custom#{}')

    mariadb_servers_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mariadb.operations#ServersOperations.{}',
        client_factory=cf_mariadb_servers)

    mysql_servers_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mysql.operations#ServersOperations.{}',
        client_factory=cf_mysql_servers)

    postgres_servers_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.postgresql.operations#ServersOperations.{}',
        client_factory=cf_postgres_servers)

    mariadb_replica_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mariadb.operations#ReplicasOperations.{}',
        client_factory=cf_mariadb_replica)

    mysql_replica_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mysql.operations#ReplicasOperations.{}',
        client_factory=cf_mysql_replica)

    postgres_replica_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.postgresql.operations#ReplicasOperations.{}',
        client_factory=cf_postgres_replica)

    mariadb_firewall_rule_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mariadb.operations#FirewallRulesOperations.{}',
        client_factory=cf_mariadb_firewall_rules)

    mysql_firewall_rule_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mysql.operations#FirewallRulesOperations.{}',
        client_factory=cf_mysql_firewall_rules)

    postgres_firewall_rule_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.postgresql.operations#FirewallRulesOperations.{}',
        client_factory=cf_postgres_firewall_rules)

    mariadb_vnet_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mariadb.operations#VirtualNetworkRulesOperations.{}',
        client_factory=cf_mariadb_virtual_network_rules_operations)

    mysql_vnet_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mysql.operations#VirtualNetworkRulesOperations.{}',
        client_factory=cf_mysql_virtual_network_rules_operations)

    postgres_vnet_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.postgresql.operations#VirtualNetworkRulesOperations.{}',
        client_factory=cf_postgres_virtual_network_rules_operations)

    mariadb_config_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mariadb.operations#ConfigurationsOperations.{}',
        client_factory=cf_mariadb_config)

    mysql_config_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mysql.operations#ConfigurationsOperations.{}',
        client_factory=cf_mysql_config)

    postgres_config_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.postgresql.operations#ConfigurationsOperations.{}',
        client_factory=cf_postgres_config)

    mariadb_log_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mariadb.operations#LogFilesOperations.{}',
        client_factory=cf_mariadb_log)

    mysql_log_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mysql.operations#LogFilesOperations.{}',
        client_factory=cf_mysql_log)

    postgres_log_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.postgresql.operations#LogFilesOperations.{}',
        client_factory=cf_postgres_log)

    mariadb_db_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mariadb.operations#DatabasesOperations.{}',
        client_factory=cf_mariadb_db)

    mysql_db_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mysql.operations#DatabasesOperations.{}',
        client_factory=cf_mysql_db)

    postgres_db_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.postgresql.operations#DatabasesOperations.{}',
        client_factory=cf_postgres_db)

    mariadb_private_endpoint_connections_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mariadb.operations#PrivateEndpointConnectionsOperations.{}',
        client_factory=cf_mariadb_private_endpoint_connections_operations,
        resource_type=ResourceType.MGMT_RDBMS)

    mariadb_private_link_resources_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mariadb.operations#PrivateLinkResourcesOperations.{}',
        client_factory=cf_mariadb_private_link_resources_operations,
        resource_type=ResourceType.MGMT_RDBMS)

    mysql_private_endpoint_connections_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mysql.operations#PrivateEndpointConnectionsOperations.{}',
        client_factory=cf_mysql_private_endpoint_connections_operations,
        resource_type=ResourceType.MGMT_RDBMS)

    mysql_private_link_resources_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mysql.operations#PrivateLinkResourcesOperations.{}',
        client_factory=cf_mysql_private_link_resources_operations,
        resource_type=ResourceType.MGMT_RDBMS)

    postgres_private_endpoint_connections_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.postgresql.operations#PrivateEndpointConnectionsOperations.{}',
        client_factory=cf_postgres_private_endpoint_connections_operations,
        resource_type=ResourceType.MGMT_RDBMS)

    postgres_private_link_resources_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.postgresql.operations#PrivateLinkResourcesOperations.{}',
        client_factory=cf_postgres_private_link_resources_operations,
        resource_type=ResourceType.MGMT_RDBMS)

    mysql_key_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mysql.operations#ServerKeysOperations.{}',
        client_factory=cf_mysql_server_keys_operations,
        resource_type=ResourceType.MGMT_RDBMS)

    postgres_key_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.postgresql.operations#ServerKeysOperations.{}',
        client_factory=cf_postgres_server_keys_operations,
        resource_type=ResourceType.MGMT_RDBMS)

    mysql_adadmin_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mysql.operations#ServerAdministratorsOperations.{}',
        client_factory=cf_mysql_server_ad_administrators_operations,
        resource_type=ResourceType.MGMT_RDBMS)

    postgres_adadmin_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.postgresql.operations#ServerAdministratorsOperations.{}',
        client_factory=cf_postgres_server_ad_administrators_operations,
        resource_type=ResourceType.MGMT_RDBMS)

    mysql_location_based_performance_tier_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mysql.operations#LocationBasedPerformanceTierOperations.{}',
        client_factory=cf_mysql_location_based_performance_tier_operations,
        resource_type=ResourceType.MGMT_RDBMS)

    postgres_location_based_performance_tier_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.postgresql.operations#LocationBasedPerformanceTierOperations.{}',
        client_factory=cf_postgres_location_based_performance_tier_operations,
        resource_type=ResourceType.MGMT_RDBMS)

    mariadb_location_based_performance_tier_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.rdbms.mariadb.operations#LocationBasedPerformanceTierOperations.{}',
        client_factory=cf_mariadb_location_based_performance_tier_operations,
        resource_type=ResourceType.MGMT_RDBMS)

    with self.command_group('mariadb server',
                            mariadb_servers_sdk,
                            client_factory=cf_mariadb_servers) as g:
        g.custom_command('create', '_server_create')
        g.custom_command('restore', '_server_restore', supports_no_wait=True)
        g.custom_command('georestore',
                         '_server_georestore',
                         supports_no_wait=True)
        g.command('delete', 'delete', confirmation=True)
        g.show_command('show', 'get')
        g.custom_command('list',
                         '_server_list_custom_func',
                         table_transformer=table_transform_output_list_servers)
        g.generic_update_command('update',
                                 getter_name='_server_update_get',
                                 getter_type=rdbms_custom,
                                 setter_name='_server_update_set',
                                 setter_type=rdbms_custom,
                                 setter_arg_name='parameters',
                                 custom_func_name='_server_update_custom_func')
        g.custom_wait_command('wait', '_server_mariadb_get')
        g.command('restart', 'restart')
        g.command('start', 'start')
        g.command('stop', 'stop')

    with self.command_group('mysql server',
                            mysql_servers_sdk,
                            client_factory=cf_mysql_servers) as g:
        g.custom_command('create', '_server_create')
        g.custom_command('restore', '_server_restore', supports_no_wait=True)
        g.custom_command('georestore',
                         '_server_georestore',
                         supports_no_wait=True)
        g.custom_command('delete', '_server_delete', confirmation=True)
        g.show_command('show', 'get')
        g.custom_command('list',
                         '_server_list_custom_func',
                         table_transformer=table_transform_output_list_servers)
        g.generic_update_command('update',
                                 getter_name='_server_update_get',
                                 getter_type=rdbms_custom,
                                 setter_name='_server_update_set',
                                 setter_type=rdbms_custom,
                                 setter_arg_name='parameters',
                                 custom_func_name='_server_update_custom_func')
        g.custom_wait_command('wait', '_server_mysql_get')
        g.command('restart', 'restart')
        g.command('start', 'start')
        g.command('stop', 'stop')

    with self.command_group('postgres server',
                            postgres_servers_sdk,
                            client_factory=cf_postgres_servers) as g:
        g.custom_command('create', '_server_create')
        g.custom_command('restore', '_server_restore', supports_no_wait=True)
        g.custom_command('georestore',
                         '_server_georestore',
                         supports_no_wait=True)
        g.custom_command('delete', '_server_delete', confirmation=True)
        g.show_command('show', 'get')
        g.custom_command('list',
                         '_server_list_custom_func',
                         table_transformer=table_transform_output_list_servers)
        g.generic_update_command('update',
                                 getter_name='_server_update_get',
                                 getter_type=rdbms_custom,
                                 setter_name='_server_update_set',
                                 setter_type=rdbms_custom,
                                 setter_arg_name='parameters',
                                 custom_func_name='_server_update_custom_func')
        g.custom_wait_command('wait', '_server_postgresql_get')
        g.command('restart', 'restart')

    with self.command_group('mariadb server replica',
                            mariadb_replica_sdk) as g:
        g.command('list', 'list_by_server')

    with self.command_group('mariadb server replica',
                            mariadb_servers_sdk,
                            client_factory=cf_mariadb_servers) as g:
        g.custom_command('create', '_replica_create', supports_no_wait=True)
        g.custom_command('stop', '_replica_stop', confirmation=True)

    with self.command_group('mysql server replica', mysql_replica_sdk) as g:
        g.command('list', 'list_by_server')

    with self.command_group('mysql server replica',
                            mysql_servers_sdk,
                            client_factory=cf_mysql_servers) as g:
        g.custom_command('create', '_replica_create', supports_no_wait=True)
        g.custom_command('stop', '_replica_stop', confirmation=True)

    with self.command_group('postgres server replica',
                            postgres_replica_sdk) as g:
        g.command('list', 'list_by_server')

    with self.command_group('postgres server replica',
                            postgres_servers_sdk,
                            client_factory=cf_postgres_servers) as g:
        g.custom_command('create', '_replica_create', supports_no_wait=True)
        g.custom_command('stop', '_replica_stop', confirmation=True)

    with self.command_group('mariadb server firewall-rule',
                            mariadb_firewall_rule_sdk) as g:
        g.command('create', 'create_or_update')
        g.command('delete', 'delete', confirmation=True)
        g.show_command('show', 'get')
        g.command('list', 'list_by_server')
        g.generic_update_command(
            'update',
            getter_name='_firewall_rule_custom_getter',
            getter_type=rdbms_custom,
            setter_name='_firewall_rule_custom_setter',
            setter_type=rdbms_custom,
            setter_arg_name='parameters',
            custom_func_name='_firewall_rule_update_custom_func')

    with self.command_group('mysql server firewall-rule',
                            mysql_firewall_rule_sdk) as g:
        g.command('create', 'create_or_update')
        g.command('delete', 'delete', confirmation=True)
        g.show_command('show', 'get')
        g.command('list', 'list_by_server')
        g.generic_update_command(
            'update',
            getter_name='_firewall_rule_custom_getter',
            getter_type=rdbms_custom,
            setter_name='_firewall_rule_custom_setter',
            setter_type=rdbms_custom,
            setter_arg_name='parameters',
            custom_func_name='_firewall_rule_update_custom_func')

    with self.command_group('postgres server firewall-rule',
                            postgres_firewall_rule_sdk) as g:
        g.command('create', 'create_or_update')
        g.command('delete', 'delete', confirmation=True)
        g.show_command('show', 'get')
        g.command('list', 'list_by_server')
        g.generic_update_command(
            'update',
            getter_name='_firewall_rule_custom_getter',
            getter_type=rdbms_custom,
            setter_name='_firewall_rule_custom_setter',
            setter_type=rdbms_custom,
            setter_arg_name='parameters',
            custom_func_name='_firewall_rule_update_custom_func')

    with self.command_group('mariadb server vnet-rule', mariadb_vnet_sdk) as g:
        g.command('create', 'create_or_update')
        g.command('delete', 'delete')
        g.show_command('show', 'get')
        g.command('list', 'list_by_server')
        g.generic_update_command('update')

    with self.command_group('mysql server vnet-rule', mysql_vnet_sdk) as g:
        g.command('create', 'create_or_update')
        g.command('delete', 'delete')
        g.show_command('show', 'get')
        g.command('list', 'list_by_server')
        g.generic_update_command('update')

    with self.command_group('postgres server vnet-rule',
                            postgres_vnet_sdk) as g:
        g.command('create', 'create_or_update')
        g.command('delete', 'delete')
        g.show_command('show', 'get')
        g.command('list', 'list_by_server')
        g.generic_update_command('update')

    with self.command_group('mariadb server configuration',
                            mariadb_config_sdk) as g:
        g.command('set', 'create_or_update')
        g.show_command('show', 'get')
        g.command('list', 'list_by_server')

    with self.command_group('mysql server configuration',
                            mysql_config_sdk) as g:
        g.command('set', 'create_or_update')
        g.show_command('show', 'get')
        g.command('list', 'list_by_server')

    with self.command_group('postgres server configuration',
                            postgres_config_sdk) as g:
        g.command('set', 'create_or_update')
        g.show_command('show', 'get')
        g.command('list', 'list_by_server')

    with self.command_group('mariadb server-logs',
                            mariadb_log_sdk,
                            client_factory=cf_mariadb_log) as g:
        g.custom_command('list', '_list_log_files_with_filter')
        g.custom_command('download', '_download_log_files')

    with self.command_group('mysql server-logs',
                            mysql_log_sdk,
                            client_factory=cf_mysql_log) as g:
        g.custom_command('list', '_list_log_files_with_filter')
        g.custom_command('download', '_download_log_files')

    with self.command_group('postgres server-logs',
                            postgres_log_sdk,
                            client_factory=cf_postgres_log) as g:
        g.custom_command('list', '_list_log_files_with_filter')
        g.custom_command('download', '_download_log_files')

    with self.command_group('mariadb db', mariadb_db_sdk) as g:
        g.command('create', 'create_or_update')
        g.command('delete', 'delete', confirmation=True)
        g.show_command('show', 'get')
        g.command('list', 'list_by_server')

    with self.command_group('mysql db', mysql_db_sdk) as g:
        g.command('create', 'create_or_update')
        g.command('delete', 'delete', confirmation=True)
        g.show_command('show', 'get')
        g.command('list', 'list_by_server')

    with self.command_group('postgres db', postgres_db_sdk) as g:
        g.command('create', 'create_or_update')
        g.command('delete', 'delete', confirmation=True)
        g.show_command('show', 'get')
        g.command('list', 'list_by_server')

    with self.command_group(
            'mariadb server private-endpoint-connection',
            mariadb_private_endpoint_connections_sdk,
            client_factory=cf_mariadb_private_endpoint_connections_operations
    ) as g:
        g.custom_command('approve',
                         'approve_private_endpoint_connection',
                         validator=validate_private_endpoint_connection_id)
        g.custom_command('reject',
                         'reject_private_endpoint_connection',
                         validator=validate_private_endpoint_connection_id)
        g.command('delete',
                  'delete',
                  validator=validate_private_endpoint_connection_id)
        g.show_command('show',
                       'get',
                       validator=validate_private_endpoint_connection_id)

    with self.command_group(
            'mariadb server private-link-resource',
            mariadb_private_link_resources_sdk,
            client_factory=cf_mariadb_private_link_resources_operations) as g:
        g.show_command('list', 'list_by_server')

    with self.command_group(
            'mysql server private-endpoint-connection',
            mysql_private_endpoint_connections_sdk,
            client_factory=cf_mysql_private_endpoint_connections_operations
    ) as g:
        g.custom_command('approve',
                         'approve_private_endpoint_connection',
                         validator=validate_private_endpoint_connection_id)
        g.custom_command('reject',
                         'reject_private_endpoint_connection',
                         validator=validate_private_endpoint_connection_id)
        g.command('delete',
                  'delete',
                  validator=validate_private_endpoint_connection_id)
        g.show_command('show',
                       'get',
                       validator=validate_private_endpoint_connection_id)

    with self.command_group(
            'mysql server private-link-resource',
            mysql_private_link_resources_sdk,
            client_factory=cf_mysql_private_link_resources_operations) as g:
        g.show_command('list', 'list_by_server')

    with self.command_group(
            'postgres server private-endpoint-connection',
            postgres_private_endpoint_connections_sdk,
            client_factory=cf_postgres_private_endpoint_connections_operations
    ) as g:
        g.custom_command('approve',
                         'approve_private_endpoint_connection',
                         validator=validate_private_endpoint_connection_id)
        g.custom_command('reject',
                         'reject_private_endpoint_connection',
                         validator=validate_private_endpoint_connection_id)
        g.command('delete',
                  'delete',
                  validator=validate_private_endpoint_connection_id)
        g.show_command('show',
                       'get',
                       validator=validate_private_endpoint_connection_id)

    with self.command_group(
            'postgres server private-link-resource',
            postgres_private_link_resources_sdk,
            client_factory=cf_postgres_private_link_resources_operations) as g:
        g.show_command('list', 'list_by_server')

    with self.command_group('mysql server key',
                            mysql_key_sdk,
                            client_factory=cf_mysql_server_keys_operations,
                            is_preview=True) as g:
        g.custom_command('create', 'server_key_create')
        g.custom_command('delete', 'server_key_delete', confirmation=True)
        g.custom_show_command('show', 'server_key_get')
        g.command('list', 'list')

    with self.command_group('postgres server key',
                            postgres_key_sdk,
                            client_factory=cf_postgres_server_keys_operations,
                            is_preview=True) as g:
        g.custom_command('create', 'server_key_create')
        g.custom_command('delete', 'server_key_delete', confirmation=True)
        g.custom_show_command('show', 'server_key_get')
        g.command('list', 'list')

    with self.command_group(
            'mysql server ad-admin',
            mysql_adadmin_sdk,
            client_factory=cf_mysql_server_ad_administrators_operations,
            is_preview=True) as g:
        g.custom_command('create',
                         'server_ad_admin_set',
                         supports_no_wait=True)
        g.command('list', 'list')
        g.command('delete', 'delete', confirmation=True)
        g.show_command('show', 'get')
        g.custom_wait_command('wait', 'server_ad_admin_get')
        g.wait_command('wait')

    with self.command_group(
            'postgres server ad-admin',
            postgres_adadmin_sdk,
            client_factory=cf_postgres_server_ad_administrators_operations,
            is_preview=True) as g:
        g.custom_command('create',
                         'server_ad_admin_set',
                         supports_no_wait=True)
        g.command('list', 'list')
        g.command('delete', 'delete', confirmation=True)
        g.show_command('show', 'get')
        g.wait_command('wait')

    with self.command_group(
            'mysql server',
            mysql_location_based_performance_tier_sdk,
            client_factory=cf_mysql_location_based_performance_tier_operations,
            is_preview=True) as g:
        g.command(
            'list-skus',
            'list',
            table_transformer=table_transform_output_list_skus_single_server)

    with self.command_group(
            'postgres server',
            postgres_location_based_performance_tier_sdk,
            client_factory=
            cf_postgres_location_based_performance_tier_operations,
            is_preview=True) as g:
        g.command(
            'list-skus',
            'list',
            table_transformer=table_transform_output_list_skus_single_server)

    with self.command_group(
            'mariadb server',
            mariadb_location_based_performance_tier_sdk,
            client_factory=
            cf_mariadb_location_based_performance_tier_operations,
            is_preview=True) as g:
        g.command(
            'list-skus',
            'list',
            table_transformer=table_transform_output_list_skus_single_server)
 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 #26
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_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_task_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.task#{}',
        table_transformer=task_output_format,
        client_factory=cf_acr_tasks)

    acr_build_task_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.build_task#{}',
        table_transformer=build_task_detail_output_format,
        client_factory=cf_acr_build_tasks)

    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)

    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('login', 'acr_login', table_transformer=None)
        g.command('show-usage',
                  'acr_show_usage',
                  table_transformer=usage_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_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')

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

    # Deprecated (for backward compatibility).
    with self.command_group('acr build-task',
                            acr_build_task_util,
                            deprecate_info=self.deprecate(redirect='acr task',
                                                          hide=True)) as g:
        g.command('create', 'acr_build_task_create')
        g.show_command('show', 'acr_build_task_show')
        g.command('list',
                  'acr_build_task_list',
                  table_transformer=build_task_output_format)
        g.command('delete', 'acr_build_task_delete')
        g.command('update', 'acr_build_task_update')
        g.command('run',
                  'acr_build_task_run',
                  client_factory=cf_acr_builds,
                  table_transformer=build_output_format)
        g.command('list-builds',
                  'acr_build_task_list_builds',
                  client_factory=cf_acr_builds,
                  table_transformer=build_output_format)
        g.command('show-build',
                  'acr_build_task_show_build',
                  client_factory=cf_acr_builds,
                  table_transformer=build_output_format)
        g.command('update-build',
                  'acr_build_task_update_build',
                  client_factory=cf_acr_builds,
                  table_transformer=build_output_format)
        g.command('logs',
                  'acr_build_task_logs',
                  client_factory=cf_acr_builds,
                  table_transformer=None)

    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('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 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 helm', acr_helm_util) 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')

    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')
Exemple #27
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_deleted_workspaces, cf_log_analytics_workspace,
        cf_log_analytics_workspace_tables, cf_log_analytics_workspace_management_groups,
        cf_log_analytics_workspace_usage, cf_log_analytics_workspace_schema, cf_log_analytics_workspace_shared_keys,
        cf_log_analytics_workspace_intelligence_packs, cf_log_analytics_cluster,
        cf_log_analytics_workspace_linked_service, cf_diagnostics_category,
        cf_private_link_resources, cf_private_link_scoped_resources,
        cf_private_link_scopes, cf_private_endpoint_connections, cf_log_analytics_linked_storage,
        cf_log_analytics_workspace_saved_searches, cf_subscription_diagnostics,
        cf_log_analytics_workspace_data_exports)
    from ._exception_handler import monitor_exception_handler, missing_resource_handler, data_export_handler
    from .transformers import (action_group_list_table)
    from .validators import process_autoscale_create_namespace, validate_private_endpoint_connection_id

    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)

    subscription_dianostic_settings_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.monitor.operations#SubscriptionDiagnosticSettingsOperations.{}',
        client_factory=cf_subscription_diagnostics,
        operation_group='subscription_diagnostic_settings',
        exception_handler=monitor_exception_handler)

    subscription_dianostic_settings_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.monitor.operations.subscription_diagnostic_settings#{}',
        client_factory=cf_subscription_diagnostics,
        operation_group='subscription_diagnostic_settings',
        exception_handler=monitor_exception_handler)

    alert_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.monitor.operations.metric_alert#{}',
        client_factory=cf_alert_rules,
        operation_group='alert_rules',
        exception_handler=monitor_exception_handler)

    metric_alert_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.monitor.operations#MetricAlertsOperations.{}',
        client_factory=cf_metric_alerts,
        operation_group='metric_alerts',
        exception_handler=monitor_exception_handler)

    metric_definitions_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.monitor.operations#MetricDefinitionsOperations.{}',
        client_factory=cf_metric_def,
        operation_group='metric_definitions',
        exception_handler=monitor_exception_handler)

    log_analytics_workspace_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.loganalytics.operations#WorkspacesOperations.{}',
        client_factory=cf_log_analytics_workspace,
        exception_handler=monitor_exception_handler
    )

    private_link_resources_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.monitor.operations#PrivateLinkResourcesOperations.{}',
        client_factory=cf_private_link_resources,
        operation_group='private_link_resources',
        exception_handler=monitor_exception_handler
    )

    private_link_scoped_resources_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.monitor.operations#PrivateLinkScopedResourcesOperations.{}',
        client_factory=cf_private_link_scoped_resources,
        operation_group='private_link_scoped_resources',
        exception_handler=monitor_exception_handler
    )

    private_link_scopes_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.monitor.operations#PrivateLinkScopesOperations.{}',
        client_factory=cf_private_link_scopes,
        operation_group='private_link_scopes',
        exception_handler=monitor_exception_handler
    )

    private_endpoint_connections_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.monitor.operations#PrivateEndpointConnectionsOperations.{}',
        client_factory=cf_private_endpoint_connections,
        operation_group='private_endpoint_connections',
        exception_handler=monitor_exception_handler
    )

    private_link_scope_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.monitor.operations.private_link_scope#{}',
        client_factory=cf_private_link_scopes,
        exception_handler=monitor_exception_handler
    )

    log_analytics_deleted_workspace_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.monitor.operations.log_analytics_workspace#{}',
        client_factory=cf_log_analytics_deleted_workspaces,
        exception_handler=monitor_exception_handler
    )

    log_analytics_workspace_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.monitor.operations.log_analytics_workspace#{}',
        client_factory=cf_log_analytics_workspace,
        exception_handler=monitor_exception_handler
    )

    log_analytics_workspace_management_groups_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.loganalytics.operations#ManagementGroupsOperations.{}',
        client_factory=cf_log_analytics_workspace_management_groups,
        exception_handler=monitor_exception_handler
    )

    log_analytics_workspace_usage_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.loganalytics.operations#UsagesOperations.{}',
        client_factory=cf_log_analytics_workspace_usage,
        exception_handler=monitor_exception_handler
    )

    log_analytics_workspace_schema_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.loganalytics.operations#SchemaOperations.{}',
        client_factory=cf_log_analytics_workspace_schema,
        exception_handler=monitor_exception_handler
    )

    log_analytics_workspace_shared_keys_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.loganalytics.operations#SharedKeysOperations.{}',
        client_factory=cf_log_analytics_workspace_shared_keys,
        exception_handler=monitor_exception_handler
    )

    log_analytics_workspace_intelligence_packs_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.loganalytics.operations#IntelligencePacksOperations.{}',
        client_factory=cf_log_analytics_workspace_intelligence_packs,
        exception_handler=monitor_exception_handler
    )

    log_analytics_workspace_saved_search_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.loganalytics.operations#SavedSearchesOperations.{}',
        client_factory=cf_log_analytics_workspace_saved_searches,
        exception_handler=monitor_exception_handler
    )

    log_analytics_workspace_linked_service_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.loganalytics.operations#LinkedServicesOperations.{}',
        client_factory=cf_log_analytics_workspace_linked_service,
        exception_handler=monitor_exception_handler
    )

    log_analytics_workspace_linked_service_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.monitor.operations.log_analytics_workspace_linked_service#{}',
        client_factory=cf_log_analytics_workspace_linked_service,
        exception_handler=monitor_exception_handler
    )

    log_analytics_workspace_table_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.loganalytics.operations#TablesOperations.{}',
        client_factory=cf_log_analytics_workspace_tables,
        exception_handler=monitor_exception_handler
    )

    log_analytics_workspace_data_exports_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.loganalytics.operations#DataExportsOperations.{}',
        client_factory=cf_log_analytics_workspace_data_exports,
        exception_handler=monitor_exception_handler
    )

    log_analytics_cluster_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.loganalytics.operations#ClustersOperations.{}',
        client_factory=cf_log_analytics_cluster,
        exception_handler=monitor_exception_handler
    )

    log_analytics_cluster_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.monitor.operations.log_analytics_cluster#{}',
        client_factory=cf_log_analytics_cluster,
        exception_handler=monitor_exception_handler
    )

    log_analytics_linked_storage_sdk = CliCommandType(
        operations_tmpl='azure.mgmt.loganalytics.operations#LinkedStorageAccountsOperations.{}',
        client_factory=cf_log_analytics_linked_storage,
        exception_handler=monitor_exception_handler
    )

    log_analytics_linked_storage_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.monitor.operations.log_analytics_linked_storage_account#{}',
        client_factory=cf_log_analytics_linked_storage,
        exception_handler=monitor_exception_handler
    )

    monitor_general_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.monitor.operations.general_operations#{}',
        client_factory=cf_metric_alerts,
        exception_handler=monitor_exception_handler
    )

    with self.command_group('monitor action-group', action_group_sdk, custom_command_type=action_group_custom) as g:
        g.show_command('show', 'get', table_transformer=action_group_list_table)
        g.command('create', 'create_or_update', table_transformer=action_group_list_table)
        g.command('delete', 'delete')
        g.command('enable-receiver', 'enable_receiver', table_transformer=action_group_list_table)
        g.custom_command('list', 'list_action_groups', table_transformer=action_group_list_table)
        g.generic_update_command('update', custom_func_name='update_action_groups', setter_arg_name='action_group',
                                 table_transformer=action_group_list_table)

    with self.command_group('monitor activity-log', activity_log_sdk) as g:
        g.custom_command('list', 'list_activity_log', client_factory=cf_activity_log)
        g.command('list-categories', 'list')

    with self.command_group('monitor activity-log alert', activity_log_alerts_sdk, custom_command_type=activity_log_alerts_custom) as g:
        g.custom_command('list', 'list_activity_logs_alert')
        g.custom_command('create', 'create')
        g.show_command('show', 'get', exception_handler=missing_resource_handler)
        g.command('delete', 'delete', exception_handler=missing_resource_handler)
        g.generic_update_command('update', custom_func_name='update', setter_arg_name='activity_log_alert')
        g.custom_command('action-group add', 'add_action_group')
        g.custom_command('action-group remove', 'remove_action_group')
        g.custom_command('scope add', 'add_scope')
        g.custom_command('scope remove', 'remove_scope')

    with self.command_group('monitor alert', alert_sdk, custom_command_type=alert_custom, deprecate_info=self.deprecate(redirect='monitor metrics alert', hide='2.0.44')) as g:
        g.custom_command('create', 'create_metric_rule')
        g.command('delete', 'delete')
        g.show_command('show', 'get')
        g.command('list', 'list_by_resource_group')
        g.command('show-incident', 'get', command_type=alert_rule_incidents_sdk)
        g.command('list-incidents', 'list_by_alert_rule', command_type=alert_rule_incidents_sdk)
        g.generic_update_command('update', custom_func_name='update_metric_rule')

    with self.command_group('monitor autoscale', autoscale_sdk, custom_command_type=autoscale_custom) as g:
        g.custom_command('create', 'autoscale_create', validator=process_autoscale_create_namespace)
        g.generic_update_command('update', custom_func_name='autoscale_update', custom_func_type=autoscale_custom,
                                 exception_handler=monitor_exception_handler)
        g.command('delete', 'delete')
        g.show_command('show', 'get')
        g.command('list', 'list_by_resource_group')

    with self.command_group('monitor autoscale profile', autoscale_sdk, custom_command_type=autoscale_custom) as g:
        g.custom_command('create', 'autoscale_profile_create')
        g.custom_command('list', 'autoscale_profile_list')
        g.custom_show_command('show', 'autoscale_profile_show')
        g.custom_command('delete', 'autoscale_profile_delete')
        g.custom_command('list-timezones', 'autoscale_profile_list_timezones')

    with self.command_group('monitor autoscale rule', autoscale_sdk, custom_command_type=autoscale_custom) as g:
        g.custom_command('create', 'autoscale_rule_create')
        g.custom_command('list', 'autoscale_rule_list')
        g.custom_command('delete', 'autoscale_rule_delete')
        g.custom_command('copy', 'autoscale_rule_copy')

    with self.command_group('monitor autoscale-settings', autoscale_sdk, custom_command_type=autoscale_custom,
                            deprecate_info=self.deprecate(redirect='monitor autoscale', hide='2.0.34')) as g:
        g.command('create', 'create_or_update', deprecate_info='az monitor autoscale create')
        g.command('delete', 'delete', deprecate_info='az monitor autoscale delete')
        g.show_command('show', 'get', deprecate_info='az monitor autoscale show')
        g.command('list', 'list_by_resource_group', deprecate_info='az monitor autoscale list')
        g.custom_command('get-parameters-template', 'scaffold_autoscale_settings_parameters', deprecate_info='az monitor autoscale show')
        g.generic_update_command('update', deprecate_info='az monitor autoscale update')

    with self.command_group('monitor diagnostic-settings', diagnostics_sdk, custom_command_type=diagnostics_custom) as g:
        from .validators import validate_diagnostic_settings
        g.custom_command('create', 'create_diagnostics_settings', validator=validate_diagnostic_settings)
        g.show_command('show', 'get')
        g.command('list', 'list')
        g.command('delete', 'delete')
        g.generic_update_command('update')

    with self.command_group('monitor diagnostic-settings categories', diagnostics_categories_sdk) as g:
        g.show_command('show', 'get')
        g.command('list', 'list')

    with self.command_group('monitor log-profiles', log_profiles_sdk, custom_command_type=log_profiles_custom) as g:
        g.custom_command('create', 'create_log_profile_operations')
        g.command('delete', 'delete')
        g.show_command('show', 'get')
        g.command('list', 'list')
        g.generic_update_command('update')

    with self.command_group('monitor metrics') as g:
        from .transformers import metrics_table, metrics_definitions_table
        g.command('list', 'list_metrics', command_type=monitor_custom, table_transformer=metrics_table)
        g.command('list-definitions', 'list', command_type=metric_definitions_sdk, table_transformer=metrics_definitions_table)

    with self.command_group('monitor metrics alert', metric_alert_sdk, custom_command_type=alert_custom, client_factory=cf_metric_alerts) as g:
        g.custom_command('create', 'create_metric_alert', custom_command_type=alert_custom)
        g.command('delete', 'delete')
        g.custom_command('list', 'list_metric_alerts', custom_command_type=alert_custom)
        g.show_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) as g:
        g.custom_command('create', 'create_log_analytics_workspace', supports_no_wait=True)
        g.generic_update_command('update', custom_func_name='update_log_analytics_workspace')
        g.show_command('show', 'get')
        g.command('delete', 'delete', confirmation=True)
        g.custom_command('list', 'list_log_analytics_workspace')
        g.custom_command('list-deleted-workspaces', 'list_deleted_log_analytics_workspaces', custom_command_type=log_analytics_deleted_workspace_custom)
        g.custom_command('recover', 'recover_log_analytics_workspace', supports_no_wait=True)
        g.command('get-schema', 'get', command_type=log_analytics_workspace_schema_sdk)
        g.command('list-usages', 'list', command_type=log_analytics_workspace_usage_sdk)
        g.command('list-management-groups', 'list', command_type=log_analytics_workspace_management_groups_sdk)
        g.command('get-shared-keys', 'get_shared_keys', command_type=log_analytics_workspace_shared_keys_sdk)

    with self.command_group('monitor log-analytics workspace table', log_analytics_workspace_table_sdk) as g:
        g.command('list', 'list_by_workspace')
        g.show_command('show', 'get')
        g.command('update', 'update')

    with self.command_group('monitor log-analytics workspace data-export', log_analytics_workspace_data_exports_sdk,
                            custom_command_type=log_analytics_workspace_custom, exception_handler=data_export_handler) as g:
        g.command('list', 'list_by_workspace')
        g.show_command('show', 'get')
        g.custom_command('create', 'create_log_analytics_workspace_data_exports',
                         client_factory=cf_log_analytics_workspace_data_exports)
        g.generic_update_command('update', custom_func_name='update_log_analytics_workspace_data_exports')
        g.command('delete', 'delete', confirmation=True)

    with self.command_group('monitor log-analytics workspace pack', log_analytics_workspace_intelligence_packs_sdk) as g:
        g.command('list', 'list')
        g.command('enable', 'enable')
        g.command('disable', 'disable')

    with self.command_group('monitor log-analytics workspace saved-search', log_analytics_workspace_saved_search_sdk, custom_command_type=log_analytics_workspace_custom) as g:
        g.custom_command('create', 'create_log_analytics_workspace_saved_search', client_factory=cf_log_analytics_workspace_saved_searches)
        g.generic_update_command('update', custom_func_name='update_log_analytics_workspace_saved_search', client_factory=cf_log_analytics_workspace_saved_searches)
        g.command('delete', 'delete', confirmation=True)
        g.show_command('show', 'get')
        g.command('list', 'list_by_workspace')

    with self.command_group('monitor log-analytics workspace linked-service', log_analytics_workspace_linked_service_sdk, custom_command_type=log_analytics_workspace_linked_service_custom) as g:
        g.custom_command('create', 'create_log_analytics_workspace_linked_service', supports_no_wait=True)
        g.generic_update_command('update', custom_func_name='update_log_analytics_workspace_linked_service', supports_no_wait=True)
        g.show_command('show', 'get')
        g.command('list', 'list_by_workspace')
        g.command('delete', 'delete', confirmation=True, supports_no_wait=True)
        g.wait_command('wait')

    with self.command_group('monitor log-analytics cluster', log_analytics_cluster_sdk, custom_command_type=log_analytics_cluster_custom) as g:
        g.custom_command('create', 'create_log_analytics_cluster', supports_no_wait=True)
        g.custom_command('update', 'update_log_analytics_cluster')
        g.show_command('show', 'get')
        g.command('delete', 'delete', confirmation=True, supports_no_wait=True)
        g.custom_command('list', 'list_log_analytics_clusters')
        g.wait_command('wait')

    with self.command_group('monitor log-analytics workspace linked-storage', log_analytics_linked_storage_sdk, custom_command_type=log_analytics_linked_storage_custom) as g:
        g.command('create', 'create_or_update')
        g.custom_command('add', 'add_log_analytics_workspace_linked_storage_accounts')
        g.custom_command('remove', 'remove_log_analytics_workspace_linked_storage_accounts')
        g.command('delete', 'delete', confirmation=True)
        g.show_command('show', 'get')
        g.command('list', 'list_by_workspace')

    with self.command_group('monitor', metric_alert_sdk, custom_command_type=monitor_general_custom) as g:
        g.custom_command('clone', 'clone_existed_settings', is_preview=True)

    with self.command_group('monitor private-link-scope', private_link_scopes_sdk, custom_command_type=private_link_scope_custom, is_preview=True) as g:
        g.custom_show_command('show', 'show_private_link_scope')
        g.custom_command('list', 'list_private_link_scope')
        g.custom_command('create', 'create_private_link_scope')
        g.custom_command('update', 'update_private_link_scope')
        g.custom_command('delete', 'delete_private_link_scope', confirmation=True)

    with self.command_group('monitor private-link-scope scoped-resource', private_link_scoped_resources_sdk, custom_command_type=private_link_scope_custom, is_preview=True) as g:
        g.custom_show_command('show', 'show_private_link_scope_resource', client_factory=cf_private_link_scoped_resources)
        g.custom_command('list', 'list_private_link_scope_resource', client_factory=cf_private_link_scoped_resources)
        g.custom_command('create', 'create_private_link_scope_resource', client_factory=cf_private_link_scoped_resources)
        g.custom_command('delete', 'delete_private_link_scope_resource', client_factory=cf_private_link_scoped_resources, confirmation=True)

    with self.command_group('monitor private-link-scope private-link-resource', private_link_resources_sdk, custom_command_type=private_link_scope_custom, is_preview=True) as g:
        g.custom_show_command('show', 'show_private_link_resource', client_factory=cf_private_link_resources)
        from azure.cli.core.commands.transform import gen_dict_to_list_transform
        g.custom_command('list', 'list_private_link_resource', client_factory=cf_private_link_resources, transform=gen_dict_to_list_transform(key="value"))

    with self.command_group('monitor private-link-scope private-endpoint-connection', private_endpoint_connections_sdk, custom_command_type=private_link_scope_custom, is_preview=True) as g:
        g.custom_show_command('show', 'show_private_endpoint_connection', client_factory=cf_private_endpoint_connections,
                              validator=validate_private_endpoint_connection_id)
        g.custom_command('list', 'list_private_endpoint_connection', client_factory=cf_private_endpoint_connections)
        g.custom_command('approve', 'approve_private_endpoint_connection', client_factory=cf_private_endpoint_connections,
                         validator=validate_private_endpoint_connection_id)
        g.custom_command('reject', 'reject_private_endpoint_connection', client_factory=cf_private_endpoint_connections,
                         validator=validate_private_endpoint_connection_id)
        g.custom_command('delete', 'delete_private_endpoint_connection', client_factory=cf_private_endpoint_connections,
                         validator=validate_private_endpoint_connection_id, confirmation=True)

    with self.command_group('monitor diagnostic-settings subscription', subscription_dianostic_settings_sdk, custom_command_type=subscription_dianostic_settings_custom) as g:
        g.custom_command('create', 'create_subscription_diagnostic_settings')
        g.command('delete', 'delete', confirmation=True)
        g.show_command('show', 'get')
        g.command('list', 'list')
        g.generic_update_command('update', custom_func_name='update_subscription_diagnostic_settings')
Exemple #28
0
def load_command_table(self, _):

    role_users_sdk = CliCommandType(
        operations_tmpl=
        'azure.graphrbac.operations.users_operations#UsersOperations.{}',
        client_factory=get_graph_client_users)

    role_group_sdk = CliCommandType(
        operations_tmpl=
        'azure.graphrbac.operations.groups_operations#GroupsOperations.{}',
        client_factory=get_graph_client_groups)

    role_custom = CliCommandType(
        operations_tmpl='azure.cli.command_modules.role.custom#{}')

    with self.command_group('role definition') as g:
        g.custom_command('list',
                         'list_role_definitions',
                         table_transformer=transform_definition_list)
        g.custom_command('delete', 'delete_role_definition')
        g.custom_command('create', 'create_role_definition')
        g.custom_command('update', 'update_role_definition')

    with self.command_group('role assignment') as g:
        g.custom_command('delete', 'delete_role_assignments')
        g.custom_command('list',
                         'list_role_assignments',
                         table_transformer=transform_assignment_list)
        g.custom_command('create', 'create_role_assignment')
        g.custom_command('list-changelogs', 'list_role_assignment_change_logs')

    with self.command_group('ad app',
                            client_factory=get_graph_client_applications,
                            resource_type=PROFILE_TYPE,
                            exception_handler=graph_err_handler) as g:
        g.custom_command('create', 'create_application')
        g.custom_command('delete', 'delete_application')
        g.custom_command('list', 'list_apps')
        g.custom_show_command('show', 'show_application')
        g.generic_update_command('update',
                                 setter_name='patch_application',
                                 setter_type=role_custom,
                                 getter_name='show_application',
                                 getter_type=role_custom,
                                 custom_func_name='update_application',
                                 custom_func_type=role_custom)

    with self.command_group('ad app owner',
                            exception_handler=graph_err_handler) as g:
        g.custom_command('list',
                         'list_application_owners',
                         client_factory=get_graph_client_applications)
        # TODO: Add support for 'add' and 'remove'

    with self.command_group('ad sp',
                            resource_type=PROFILE_TYPE,
                            exception_handler=graph_err_handler) as g:
        g.custom_command('create', 'create_service_principal')
        g.custom_command('delete', 'delete_service_principal')
        g.custom_command('list',
                         'list_sps',
                         client_factory=get_graph_client_service_principals)
        g.custom_show_command(
            'show',
            'show_service_principal',
            client_factory=get_graph_client_service_principals)

    with self.command_group('ad sp owner',
                            exception_handler=graph_err_handler) as g:
        g.custom_command('list', 'list_service_principal_owners')
        # TODO: Add support for 'add' and 'remove'

    # RBAC related
    with self.command_group('ad sp', exception_handler=graph_err_handler) as g:
        g.custom_command('create-for-rbac',
                         'create_service_principal_for_rbac')
        g.custom_command('credential reset',
                         'reset_service_principal_credential')
        g.custom_command('credential list',
                         'list_service_principal_credentials')
        g.custom_command('credential delete',
                         'delete_service_principal_credential')

    with self.command_group('ad user',
                            role_users_sdk,
                            exception_handler=graph_err_handler) as g:
        g.command('delete', 'delete')
        g.show_command('show', 'get')
        g.custom_command('list',
                         'list_users',
                         client_factory=get_graph_client_users)
        g.custom_command('get-member-groups', 'get_user_member_groups')
        g.custom_command(
            'create',
            'create_user',
            client_factory=get_graph_client_users,
            doc_string_source='azure.graphrbac.models#UserCreateParameters')

    with self.command_group('ad group',
                            role_group_sdk,
                            exception_handler=graph_err_handler) as g:
        g.custom_command('create',
                         'create_group',
                         client_factory=get_graph_client_groups)
        g.command('delete', 'delete')
        g.show_command('show', 'get')
        g.command('get-member-groups', 'get_member_groups')
        g.custom_command('list',
                         'list_groups',
                         client_factory=get_graph_client_groups)

    with self.command_group('ad group member',
                            role_group_sdk,
                            exception_handler=graph_err_handler) as g:
        g.command('list', 'get_group_members')
        g.command('add', 'add_member')
        g.command('remove', 'remove_member')
        g.custom_command('check',
                         'check_group_membership',
                         client_factory=get_graph_client_groups)
Exemple #29
0
def load_command_table(self, _):

    dms_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.datamigration.operations#ServicesOperations.{}',
        client_factory=dms_client_factory)

    dms_skus_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.datamigration.operations#ResourceSkusOperations.{}',
        client_factory=dms_client_factory)

    dms_projects_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.datamigration.operations#ProjectsOperations.{}',
        client_factory=dms_client_factory)

    dms_tasks_sdk = CliCommandType(
        operations_tmpl=
        'azure.mgmt.datamigration.operations#TasksOperations.{}',
        client_factory=dms_client_factory)

    with self.command_group('dms', dms_sdk,
                            client_factory=dms_cf_services) as g:
        g.custom_command('check-name', 'check_service_name_availability')
        g.command('check-status', 'check_status')
        g.custom_command('create', 'create_service', supports_no_wait=True)
        g.custom_command('delete',
                         'delete_service',
                         supports_no_wait=True,
                         confirmation=True)
        g.custom_command('list', 'list_services')
        g.show_command('show', 'get')
        g.custom_command('start', 'start_service', supports_no_wait=True)
        g.custom_command('stop', 'stop_service', supports_no_wait=True)
        g.wait_command('wait')

    with self.command_group('dms', dms_skus_sdk,
                            client_factory=dms_cf_skus) as g:
        g.command('list-skus', 'list_skus')

    with self.command_group('dms project',
                            dms_projects_sdk,
                            client_factory=dms_cf_projects) as g:
        g.custom_command('create', 'create_or_update_project')
        g.command('delete', 'delete', confirmation=True)
        g.command('list', 'list')
        g.show_command('show', 'get')

    with self.command_group('dms project',
                            dms_sdk,
                            client_factory=dms_cf_services) as g:
        g.custom_command('check-name', 'check_project_name_availability')

    with self.command_group('dms project task',
                            dms_tasks_sdk,
                            client_factory=dms_cf_tasks) as g:
        g.custom_command('create', 'create_task')
        g.custom_command('cutover', 'cutover_sync_task')
        g.command('delete', 'delete', confirmation=True)
        g.command('list', 'list')
        g.show_command('show', 'get')
        g.command('cancel', 'cancel')

    with self.command_group('dms project task',
                            dms_sdk,
                            client_factory=dms_cf_services) as g:
        g.custom_command('check-name', 'check_task_name_availability')
Exemple #30
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')
        g.custom_command('prepare-deploy', 'prepare_webapp_deploy')

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