Exemple #1
0
if supported_api_version(ResourceType.MGMT_NETWORK, min_api='2016-09-01'):
    cli_command(
        __name__, 'network application-gateway show-backend-health',
        'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.backend_health',
        cf_application_gateways)

cli_generic_update_command(
    __name__,
    'network application-gateway update',
    'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.get',
    'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.create_or_update',
    cf_application_gateways,
    no_wait_param='raw',
    custom_function_op=custom_path.format('update_application_gateway'))
cli_generic_wait_command(
    __name__, 'network application-gateway wait',
    'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.get',
    cf_application_gateways)

property_map = {
    'authentication_certificates': 'auth-cert',
    'ssl_certificates': 'ssl-cert',
    'frontend_ip_configurations': 'frontend-ip',
    'frontend_ports': 'frontend-port',
    'backend_address_pools': 'address-pool',
    'backend_http_settings_collection': 'http-settings',
    'http_listeners': 'http-listener',
    'request_routing_rules': 'rule',
    'probes': 'probe',
    'url_path_maps': 'url-path-map',
}
Exemple #2
0
            'vm resize',
            custom_path.format('resize_vm'),
            no_wait_param='no_wait')
cli_command(__name__, 'vm capture', custom_path.format('capture_vm'))
cli_command(__name__, 'vm open-port', custom_path.format('vm_open_port'))
cli_command(__name__, 'vm format-secret',
            custom_path.format('get_vm_format_secret'))
cli_generic_update_command(__name__,
                           'vm update',
                           mgmt_path.format(op_var, op_class, 'get'),
                           mgmt_path.format(op_var, op_class,
                                            'create_or_update'),
                           cf_vm,
                           no_wait_param='raw')
cli_generic_wait_command(
    __name__, 'vm wait',
    'azure.cli.command_modules.vm.custom#get_instance_view')

if supported_api_version(ResourceType.MGMT_COMPUTE,
                         min_api='2016-04-30-preview'):
    cli_command(__name__, 'vm convert',
                mgmt_path.format(op_var, op_class, 'convert_to_managed_disks'),
                cf_vm)

    # VM encryption
    cli_command(__name__, 'vm encryption enable',
                'azure.cli.command_modules.vm.disk_encryption#enable')
    cli_command(__name__, 'vm encryption disable',
                'azure.cli.command_modules.vm.disk_encryption#disable')
    cli_command(__name__,
                'vm encryption show',
Exemple #3
0
# Application gateways
ag_path = 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.'
cli_command(__name__, 'network application-gateway create', custom_path + 'create_application_gateway', transform=DeploymentOutputLongRunningOperation('Starting network application-gateway create'), no_wait_param='no_wait')
cli_command(__name__, 'network application-gateway delete', ag_path + 'delete', cf_application_gateways, no_wait_param='raw')
cli_command(__name__, 'network application-gateway show', ag_path + 'get', cf_application_gateways, exception_handler=empty_on_404)
cli_command(__name__, 'network application-gateway list', custom_path + 'list_application_gateways')
cli_command(__name__, 'network application-gateway start', ag_path + 'start', cf_application_gateways)
cli_command(__name__, 'network application-gateway stop', ag_path + 'stop', cf_application_gateways)

if supported_api_version(ResourceType.MGMT_NETWORK, min_api='2016-09-01'):
    cli_command(__name__, 'network application-gateway show-backend-health', ag_path + 'backend_health', cf_application_gateways)

cli_generic_update_command(__name__, 'network application-gateway update',
                           ag_path + 'get', ag_path + 'create_or_update', cf_application_gateways,
                           no_wait_param='raw', custom_function_op=custom_path + 'update_application_gateway')
cli_generic_wait_command(__name__, 'network application-gateway wait', ag_path + 'get', cf_application_gateways)


property_map = {
    'authentication_certificates': 'auth-cert',
    'ssl_certificates': 'ssl-cert',
    'frontend_ip_configurations': 'frontend-ip',
    'frontend_ports': 'frontend-port',
    'backend_address_pools': 'address-pool',
    'backend_http_settings_collection': 'http-settings',
    'http_listeners': 'http-listener',
    'request_routing_rules': 'rule',
    'probes': 'probe',
    'url_path_maps': 'url-path-map',
}
def _make_singular(value):
Exemple #4
0
            'vm resize',
            custom_path.format('resize_vm'),
            no_wait_param='no_wait')
cli_command(__name__, 'vm capture', custom_path.format('capture_vm'))
cli_command(__name__, 'vm open-port', custom_path.format('vm_open_port'))
cli_command(__name__, 'vm format-secret',
            custom_path.format('get_vm_format_secret'))
cli_generic_update_command(__name__,
                           'vm update',
                           mgmt_path.format(op_var, op_class, 'get'),
                           mgmt_path.format(op_var, op_class,
                                            'create_or_update'),
                           cf_vm,
                           no_wait_param='raw')
cli_generic_wait_command(
    __name__, 'vm wait',
    'azure.cli.command_modules.vm.custom#get_instance_view')

if supported_api_version(ResourceType.MGMT_COMPUTE,
                         min_api='2016-04-30-preview'):
    cli_command(__name__, 'vm convert',
                mgmt_path.format(op_var, op_class, 'convert_to_managed_disks'),
                cf_vm)
    cli_command(__name__, 'vm encryption enable',
                'azure.cli.command_modules.vm.disk_encryption#enable')
    cli_command(__name__, 'vm encryption disable',
                'azure.cli.command_modules.vm.disk_encryption#disable')
    cli_command(__name__,
                'vm encryption show',
                'azure.cli.command_modules.vm.disk_encryption#show',
                exception_handler=empty_on_404)
Exemple #5
0
                'azure.cli.command_modules.acs.custom#update_acs',
                _acs_client_factory)
    cli_command(
        __name__, 'acs list',
        'azure.cli.command_modules.acs.custom#list_container_services',
        _acs_client_factory)
    cli_command(__name__, 'acs browse',
                'azure.cli.command_modules.acs.custom#acs_browse')
    cli_command(__name__, 'acs install-cli',
                'azure.cli.command_modules.acs.custom#acs_install_cli')
    cli_command(__name__, 'acs dcos browse',
                'azure.cli.command_modules.acs.custom#dcos_browse')
    cli_command(__name__, 'acs dcos install-cli',
                'azure.cli.command_modules.acs.custom#dcos_install_cli')
    cli_command(__name__,
                'acs create',
                'azure.cli.command_modules.acs.custom#acs_create',
                no_wait_param='no_wait',
                exception_handler=handle_long_running_operation_exception,
                table_transformer=deployment_validate_table_format)
    cli_generic_wait_command(
        __name__, 'acs wait',
        'azure.mgmt.containerservice.operations.container_services_operations#ContainerServicesOperations.get',
        _acs_client_factory)
    cli_command(__name__, 'acs kubernetes browse',
                'azure.cli.command_modules.acs.custom#k8s_browse')
    cli_command(__name__, 'acs kubernetes install-cli',
                'azure.cli.command_modules.acs.custom#k8s_install_cli')
    cli_command(__name__, 'acs kubernetes get-credentials',
                'azure.cli.command_modules.acs.custom#k8s_get_credentials')
Exemple #6
0
cli_command(__name__, 'vm start', mgmt_path.format(op_var, op_class, 'start'), cf_vm, no_wait_param='raw')
cli_command(__name__, 'vm redeploy', mgmt_path.format(op_var, op_class, 'redeploy'), cf_vm, no_wait_param='raw')
cli_command(__name__, 'vm list-ip-addresses', custom_path.format('list_ip_addresses'), table_transformer=transform_ip_addresses)
cli_command(__name__, 'vm get-instance-view', custom_path.format('get_instance_view'),
            table_transformer='{Name:name, ResourceGroup:resourceGroup, Location:location, ProvisioningState:provisioningState, PowerState:instanceView.statuses[1].displayStatus}')
cli_command(__name__, 'vm list', custom_path.format('list_vm'), table_transformer=transform_vm_list)
cli_command(__name__, 'vm resize', custom_path.format('resize_vm'), no_wait_param='no_wait')
cli_command(__name__, 'vm capture', custom_path.format('capture_vm'))
cli_command(__name__, 'vm open-port', custom_path.format('vm_open_port'))
cli_command(__name__, 'vm format-secret', custom_path.format('get_vm_format_secret'))
cli_generic_update_command(__name__, 'vm update',
                           mgmt_path.format(op_var, op_class, 'get'),
                           mgmt_path.format(op_var, op_class, 'create_or_update'),
                           cf_vm,
                           no_wait_param='raw')
cli_generic_wait_command(__name__, 'vm wait', 'azure.cli.command_modules.vm.custom#get_instance_view')
if supported_api_version(ResourceType.MGMT_COMPUTE, min_api='2017-03-30'):
    cli_command(__name__, 'vm perform-maintenance', mgmt_path.format(op_var, op_class, 'perform_maintenance'), cf_vm)


if supported_api_version(ResourceType.MGMT_COMPUTE, min_api='2016-04-30-preview'):
    cli_command(__name__, 'vm convert', mgmt_path.format(op_var, op_class, 'convert_to_managed_disks'), cf_vm)

# VM encryption
cli_command(__name__, 'vm encryption enable', 'azure.cli.command_modules.vm.disk_encryption#encrypt_vm')
cli_command(__name__, 'vm encryption disable', 'azure.cli.command_modules.vm.disk_encryption#decrypt_vm')
cli_command(__name__, 'vm encryption show', 'azure.cli.command_modules.vm.disk_encryption#show_vm_encryption_status', exception_handler=empty_on_404)

# VMSS encryption
if supported_api_version(ResourceType.MGMT_COMPUTE, min_api='2017-03-30'):
    cli_command(__name__, 'vmss encryption enable', 'azure.cli.command_modules.vm.disk_encryption#encrypt_vmss')
Exemple #7
0
# Resource group commands
def transform_resource_group_list(result):
    return [OrderedDict([('Name', r['name']), \
            ('Location', r['location']), ('Status', r['properties']['provisioningState'])]) for r in result]


cli_command(
    __name__,
    'group delete',
    'azure.mgmt.resource.resources.operations.resource_groups_operations#ResourceGroupsOperations.delete',
    cf_resource_groups,
    no_wait_param='raw',
    confirmation=True)
cli_generic_wait_command(
    __name__, 'group wait',
    'azure.mgmt.resource.resources.operations.resource_groups_operations#ResourceGroupsOperations.get',
    cf_resource_groups)
cli_command(
    __name__,
    'group show',
    'azure.mgmt.resource.resources.operations.resource_groups_operations#ResourceGroupsOperations.get',
    cf_resource_groups,
    exception_handler=empty_on_404)
cli_command(
    __name__, 'group exists',
    'azure.mgmt.resource.resources.operations.resource_groups_operations#ResourceGroupsOperations.check_existence',
    cf_resource_groups)
cli_command(__name__,
            'group list',
            'azure.cli.command_modules.resource.custom#list_resource_groups',
            table_transformer=transform_resource_group_list)
Exemple #8
0
custom_path = 'azure.cli.command_modules.network.custom#{}'

# Application gateways
cli_command(__name__, 'network application-gateway delete', 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.delete', cf_application_gateways, no_wait_param='raw')
cli_command(__name__, 'network application-gateway show', 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.get', cf_application_gateways)
cli_command(__name__, 'network application-gateway list', custom_path.format('list_application_gateways'))
cli_command(__name__, 'network application-gateway start', 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.start', cf_application_gateways)
cli_command(__name__, 'network application-gateway stop', 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.stop', cf_application_gateways)
cli_command(__name__, 'network application-gateway show-backend-health', 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.backend_health', cf_application_gateways)
cli_generic_update_command(__name__, 'network application-gateway update',
                           'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.get',
                           'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.create_or_update',
                           cf_application_gateways, no_wait_param='raw',
                           custom_function_op=custom_path.format('update_application_gateway'))
cli_generic_wait_command(__name__, 'network application-gateway wait',
                         'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.get', cf_application_gateways)

cli_command(__name__, 'network application-gateway create',
            'azure.cli.command_modules.network.mgmt_app_gateway.lib.operations.app_gateway_operations#AppGatewayOperations.create_or_update',
            cf_application_gateway_create,
            transform=DeploymentOutputLongRunningOperation('Starting network application-gateway create'),
            no_wait_param='raw')

property_map = {
    'authentication_certificates': 'auth-cert',
    'ssl_certificates': 'ssl-cert',
    'frontend_ip_configurations': 'frontend-ip',
    'frontend_ports': 'frontend-port',
    'backend_address_pools': 'address-pool',
    'backend_http_settings_collection': 'http-settings',
    'http_listeners': 'http-listener',
Exemple #9
0
# Application gateways
ag_path = 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.'
cli_command(__name__, 'network application-gateway create', custom_path + 'create_application_gateway', transform=DeploymentOutputLongRunningOperation('Starting network application-gateway create'), no_wait_param='no_wait', exception_handler=handle_long_running_operation_exception, table_transformer=deployment_validate_table_format)
cli_command(__name__, 'network application-gateway delete', ag_path + 'delete', cf_application_gateways, no_wait_param='raw')
cli_command(__name__, 'network application-gateway show', ag_path + 'get', cf_application_gateways, exception_handler=empty_on_404)
cli_command(__name__, 'network application-gateway list', custom_path + 'list_application_gateways')
cli_command(__name__, 'network application-gateway start', ag_path + 'start', cf_application_gateways)
cli_command(__name__, 'network application-gateway stop', ag_path + 'stop', cf_application_gateways)

if supported_api_version(ResourceType.MGMT_NETWORK, min_api='2016-09-01'):
    cli_command(__name__, 'network application-gateway show-backend-health', ag_path + 'backend_health', cf_application_gateways)

cli_generic_update_command(__name__, 'network application-gateway update',
                           ag_path + 'get', ag_path + 'create_or_update', cf_application_gateways,
                           no_wait_param='raw', custom_function_op=custom_path + 'update_application_gateway')
cli_generic_wait_command(__name__, 'network application-gateway wait', ag_path + 'get', cf_application_gateways)


property_map = {
    'authentication_certificates': 'auth-cert',
    'ssl_certificates': 'ssl-cert',
    'frontend_ip_configurations': 'frontend-ip',
    'frontend_ports': 'frontend-port',
    'backend_address_pools': 'address-pool',
    'backend_http_settings_collection': 'http-settings',
    'http_listeners': 'http-listener',
    'request_routing_rules': 'rule',
    'probes': 'probe',
    'url_path_maps': 'url-path-map',
}
Exemple #10
0
            custom_path.format('list_ip_addresses'))
cli_command(__name__, 'vm get-instance-view',
            custom_path.format('get_instance_view'))
cli_command(__name__, 'vm list', custom_path.format('list_vm'))
cli_command(__name__, 'vm resize', custom_path.format('resize_vm'))
cli_command(__name__, 'vm capture', custom_path.format('capture_vm'))
cli_command(__name__, 'vm open-port', custom_path.format('vm_open_port'))
cli_generic_update_command(__name__,
                           'vm update',
                           mgmt_path.format(op_var, op_class, 'get'),
                           mgmt_path.format(op_var, op_class,
                                            'create_or_update'),
                           cf_vm,
                           no_wait_param='raw')
cli_generic_wait_command(
    __name__, 'vm wait',
    'azure.cli.command_modules.vm.custom#get_instance_view')

# VM NIC
cli_command(__name__, 'vm nic add', custom_path.format('vm_add_nics'))
cli_command(__name__, 'vm nic remove', custom_path.format('vm_remove_nics'))
cli_command(__name__, 'vm nic set', custom_path.format('vm_set_nics'))
cli_command(__name__, 'vm nic show', custom_path.format('vm_show_nic'))
cli_command(__name__, 'vm nic list', custom_path.format('vm_list_nics'))

# VMSS NIC
cli_command(
    __name__, 'vmss nic list',
    'azure.mgmt.network.operations.network_interfaces_operations#NetworkInterfacesOperations.list_virtual_machine_scale_set_network_interfaces',
    cf_ni)
cli_command(
Exemple #11
0
cli_command(__name__, 'vm stop', mgmt_path.format(op_var, op_class, 'power_off'), cf_vm)
cli_command(__name__, 'vm restart', mgmt_path.format(op_var, op_class, 'restart'), cf_vm)
cli_command(__name__, 'vm start', mgmt_path.format(op_var, op_class, 'start'), cf_vm)
cli_command(__name__, 'vm redeploy', mgmt_path.format(op_var, op_class, 'redeploy'), cf_vm)
cli_command(__name__, 'vm list-ip-addresses', custom_path.format('list_ip_addresses'), table_transformer=transform_ip_addresses)
cli_command(__name__, 'vm get-instance-view', custom_path.format('get_instance_view'))
cli_command(__name__, 'vm list', custom_path.format('list_vm'), table_transformer=transform_vm_list)
cli_command(__name__, 'vm resize', custom_path.format('resize_vm'))
cli_command(__name__, 'vm capture', custom_path.format('capture_vm'))
cli_command(__name__, 'vm open-port', custom_path.format('vm_open_port'))
cli_generic_update_command(__name__, 'vm update',
                           mgmt_path.format(op_var, op_class, 'get'),
                           mgmt_path.format(op_var, op_class, 'create_or_update'),
                           cf_vm,
                           no_wait_param='raw')
cli_generic_wait_command(__name__, 'vm wait', 'azure.cli.command_modules.vm.custom#get_instance_view')

# VM NIC
cli_command(__name__, 'vm nic add', custom_path.format('vm_add_nics'))
cli_command(__name__, 'vm nic remove', custom_path.format('vm_remove_nics'))
cli_command(__name__, 'vm nic set', custom_path.format('vm_set_nics'))
cli_command(__name__, 'vm nic show', custom_path.format('vm_show_nic'))
cli_command(__name__, 'vm nic list', custom_path.format('vm_list_nics'))

# VMSS NIC
cli_command(__name__, 'vmss nic list', 'azure.mgmt.network.operations.network_interfaces_operations#NetworkInterfacesOperations.list_virtual_machine_scale_set_network_interfaces', cf_ni)
cli_command(__name__, 'vmss nic list-vm-nics', 'azure.mgmt.network.operations.network_interfaces_operations#NetworkInterfacesOperations.list_virtual_machine_scale_set_vm_network_interfaces', cf_ni)
cli_command(__name__, 'vmss nic show', 'azure.mgmt.network.operations.network_interfaces_operations#NetworkInterfacesOperations.get_virtual_machine_scale_set_network_interface', cf_ni)

# VM Access
cli_command(__name__, 'vm access set-linux-user', custom_path.format('set_linux_user'))
Exemple #12
0
custom_path = 'azure.cli.command_modules.network.custom#{}'

# Application gateways
cli_command(__name__, 'network application-gateway delete', 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.delete', cf_application_gateways, no_wait_param='raw')
cli_command(__name__, 'network application-gateway show', 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.get', cf_application_gateways)
cli_command(__name__, 'network application-gateway list', custom_path.format('list_application_gateways'))
cli_command(__name__, 'network application-gateway start', 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.start', cf_application_gateways)
cli_command(__name__, 'network application-gateway stop', 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.stop', cf_application_gateways)
cli_command(__name__, 'network application-gateway show-backend-health', 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.backend_health', cf_application_gateways)
cli_generic_update_command(__name__, 'network application-gateway update',
                           'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.get',
                           'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.create_or_update',
                           cf_application_gateways, no_wait_param='raw',
                           custom_function_op=custom_path.format('update_application_gateway'))
cli_generic_wait_command(__name__, 'network application-gateway wait',
                         'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.get', cf_application_gateways)

cli_command(__name__, 'network application-gateway create',
            'azure.cli.command_modules.network.mgmt_app_gateway.lib.operations.app_gateway_operations#AppGatewayOperations.create_or_update',
            cf_application_gateway_create,
            transform=DeploymentOutputLongRunningOperation('Starting network application-gateway create'),
            no_wait_param='raw')

property_map = {
    'authentication_certificates': 'auth-cert',
    'ssl_certificates': 'ssl-cert',
    'frontend_ip_configurations': 'frontend-ip',
    'frontend_ports': 'frontend-port',
    'backend_address_pools': 'address-pool',
    'backend_http_settings_collection': 'http-settings',
    'http_listeners': 'http-listener',
cli_command(__name__, 'network application-gateway create', custom_path.format('create_application_gateway'), transform=DeploymentOutputLongRunningOperation('Starting network application-gateway create'), no_wait_param='no_wait')
cli_command(__name__, 'network application-gateway delete', 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.delete', cf_application_gateways, no_wait_param='raw')
cli_command(__name__, 'network application-gateway show', 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.get', cf_application_gateways, exception_handler=empty_on_404)
cli_command(__name__, 'network application-gateway list', custom_path.format('list_application_gateways'))
cli_command(__name__, 'network application-gateway start', 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.start', cf_application_gateways)
cli_command(__name__, 'network application-gateway stop', 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.stop', cf_application_gateways)

if supported_api_version(ResourceType.MGMT_NETWORK, min_api='2016-09-01'):
    cli_command(__name__, 'network application-gateway show-backend-health', 'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.backend_health', cf_application_gateways)

cli_generic_update_command(__name__, 'network application-gateway update',
                           'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.get',
                           'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.create_or_update',
                           cf_application_gateways, no_wait_param='raw',
                           custom_function_op=custom_path.format('update_application_gateway'))
cli_generic_wait_command(__name__, 'network application-gateway wait',
                         'azure.mgmt.network.operations.application_gateways_operations#ApplicationGatewaysOperations.get', cf_application_gateways)


property_map = {
    'authentication_certificates': 'auth-cert',
    'ssl_certificates': 'ssl-cert',
    'frontend_ip_configurations': 'frontend-ip',
    'frontend_ports': 'frontend-port',
    'backend_address_pools': 'address-pool',
    'backend_http_settings_collection': 'http-settings',
    'http_listeners': 'http-listener',
    'request_routing_rules': 'rule',
    'probes': 'probe',
    'url_path_maps': 'url-path-map',
}
def _make_singular(value):
Exemple #14
0
# Subscription lock commands
cli_command(__name__, 'account lock create', 'azure.cli.command_modules.resource.custom#create_lock')
cli_command(__name__, 'account lock delete', 'azure.cli.command_modules.resource.custom#delete_lock')
cli_command(__name__, 'account lock list', 'azure.cli.command_modules.resource.custom#list_locks')
cli_command(__name__, 'account lock show', 'azure.cli.command_modules.resource.custom#get_lock',
            exception_handler=empty_on_404)
cli_command(__name__, 'account lock update', 'azure.cli.command_modules.resource.custom#update_lock')


# Resource group commands
def transform_resource_group_list(result):
    return [OrderedDict([('Name', r['name']), ('Location', r['location']), ('Status', r['properties']['provisioningState'])]) for r in result]


cli_command(__name__, 'group delete', 'azure.mgmt.resource.resources.operations.resource_groups_operations#ResourceGroupsOperations.delete', cf_resource_groups, no_wait_param='raw', confirmation=True)
cli_generic_wait_command(__name__, 'group wait', 'azure.mgmt.resource.resources.operations.resource_groups_operations#ResourceGroupsOperations.get', cf_resource_groups)
cli_command(__name__, 'group show', 'azure.mgmt.resource.resources.operations.resource_groups_operations#ResourceGroupsOperations.get', cf_resource_groups, exception_handler=empty_on_404)
cli_command(__name__, 'group exists', 'azure.mgmt.resource.resources.operations.resource_groups_operations#ResourceGroupsOperations.check_existence', cf_resource_groups)
cli_command(__name__, 'group list', 'azure.cli.command_modules.resource.custom#list_resource_groups', table_transformer=transform_resource_group_list)
cli_command(__name__, 'group create', 'azure.cli.command_modules.resource.custom#create_resource_group')
cli_command(__name__, 'group export', 'azure.cli.command_modules.resource.custom#export_group_as_template')
cli_command(__name__, 'group lock create', 'azure.cli.command_modules.resource.custom#create_lock')
cli_command(__name__, 'group lock delete', 'azure.cli.command_modules.resource.custom#delete_lock')
cli_command(__name__, 'group lock list', 'azure.cli.command_modules.resource.custom#list_locks')
cli_command(__name__, 'group lock show', 'azure.cli.command_modules.resource.custom#get_lock',
            exception_handler=empty_on_404)
cli_command(__name__, 'group lock update', 'azure.cli.command_modules.resource.custom#update_lock')


# Resource commands
def transform_resource_list(result):
Exemple #15
0
# pylint: disable=line-too-long

from azure.cli.core.commands import cli_command
from azure.cli.core.util import empty_on_404
from azure.cli.core.commands.arm import \
    (cli_generic_wait_command, handle_long_running_operation_exception, deployment_validate_table_format)
from azure.cli.core.profiles import supported_api_version, PROFILE_TYPE
from ._client_factory import _acs_client_factory

if not supported_api_version(PROFILE_TYPE, max_api='2017-03-09-profile'):
    cli_command(__name__, 'acs show', 'azure.mgmt.containerservice.operations.container_services_operations#ContainerServicesOperations.get', _acs_client_factory, exception_handler=empty_on_404)
    cli_command(__name__, 'acs delete', 'azure.mgmt.containerservice.operations.container_services_operations#ContainerServicesOperations.delete', _acs_client_factory)

    # Per conversation with ACS team, hide the update till we have something meaningful to tweak
    # from azure.cli.command_modules.acs.custom import update_acs
    # cli_generic_update_command(__name__, 'acs update', ContainerServicesOperations.get, ContainerServicesOperations.create_or_update, cf_acs)

    # custom commands
    cli_command(__name__, 'acs list-locations', 'azure.cli.command_modules.acs.custom#list_acs_locations')
    cli_command(__name__, 'acs scale', 'azure.cli.command_modules.acs.custom#update_acs', _acs_client_factory)
    cli_command(__name__, 'acs list', 'azure.cli.command_modules.acs.custom#list_container_services', _acs_client_factory)
    cli_command(__name__, 'acs browse', 'azure.cli.command_modules.acs.custom#acs_browse')
    cli_command(__name__, 'acs install-cli', 'azure.cli.command_modules.acs.custom#acs_install_cli')
    cli_command(__name__, 'acs dcos browse', 'azure.cli.command_modules.acs.custom#dcos_browse')
    cli_command(__name__, 'acs dcos install-cli', 'azure.cli.command_modules.acs.custom#dcos_install_cli')
    cli_command(__name__, 'acs create', 'azure.cli.command_modules.acs.custom#acs_create', no_wait_param='no_wait', exception_handler=handle_long_running_operation_exception, table_transformer=deployment_validate_table_format)
    cli_generic_wait_command(__name__, 'acs wait', 'azure.mgmt.containerservice.operations.container_services_operations#ContainerServicesOperations.get', _acs_client_factory)
    cli_command(__name__, 'acs kubernetes browse', 'azure.cli.command_modules.acs.custom#k8s_browse')
    cli_command(__name__, 'acs kubernetes install-cli', 'azure.cli.command_modules.acs.custom#k8s_install_cli')
    cli_command(__name__, 'acs kubernetes get-credentials', 'azure.cli.command_modules.acs.custom#k8s_get_credentials')
cli_command(__name__, 'vm restart', mgmt_path.format(op_var, op_class, 'restart'), cf_vm, no_wait_param='raw')
cli_command(__name__, 'vm start', mgmt_path.format(op_var, op_class, 'start'), cf_vm, no_wait_param='raw')
cli_command(__name__, 'vm redeploy', mgmt_path.format(op_var, op_class, 'redeploy'), cf_vm, no_wait_param='raw')
cli_command(__name__, 'vm list-ip-addresses', custom_path.format('list_ip_addresses'), table_transformer=transform_ip_addresses)
cli_command(__name__, 'vm get-instance-view', custom_path.format('get_instance_view'))
cli_command(__name__, 'vm list', custom_path.format('list_vm'), table_transformer=transform_vm_list)
cli_command(__name__, 'vm resize', custom_path.format('resize_vm'), no_wait_param='no_wait')
cli_command(__name__, 'vm capture', custom_path.format('capture_vm'))
cli_command(__name__, 'vm open-port', custom_path.format('vm_open_port'))
cli_command(__name__, 'vm format-secret', custom_path.format('get_vm_format_secret'))
cli_generic_update_command(__name__, 'vm update',
                           mgmt_path.format(op_var, op_class, 'get'),
                           mgmt_path.format(op_var, op_class, 'create_or_update'),
                           cf_vm,
                           no_wait_param='raw')
cli_generic_wait_command(__name__, 'vm wait', 'azure.cli.command_modules.vm.custom#get_instance_view')

if supported_api_version(ResourceType.MGMT_COMPUTE, min_api='2016-04-30-preview'):
    cli_command(__name__, 'vm convert', mgmt_path.format(op_var, op_class, 'convert_to_managed_disks'), cf_vm)
    cli_command(__name__, 'vm encryption enable', 'azure.cli.command_modules.vm.disk_encryption#enable')
    cli_command(__name__, 'vm encryption disable', 'azure.cli.command_modules.vm.disk_encryption#disable')
    cli_command(__name__, 'vm encryption show', 'azure.cli.command_modules.vm.disk_encryption#show', exception_handler=empty_on_404)

# VM NIC
cli_command(__name__, 'vm nic add', custom_path.format('vm_add_nics'))
cli_command(__name__, 'vm nic remove', custom_path.format('vm_remove_nics'))
cli_command(__name__, 'vm nic set', custom_path.format('vm_set_nics'))
cli_command(__name__, 'vm nic show', custom_path.format('vm_show_nic'), exception_handler=empty_on_404)
cli_command(__name__, 'vm nic list', custom_path.format('vm_list_nics'))

# VMSS NIC