from azure.cli.core.commands import register_cli_argument from azure.mgmt.iothub.models.iot_hub_client_enums import IotHubSku from ._factory import iot_hub_service_factory from .custom import iot_device_list def get_device_id_completion_list(prefix, action, parsed_args, **kwargs): #pylint: disable=unused-argument client = iot_hub_service_factory(kwargs) return [ d.device_id for d in iot_device_list(client, parsed_args.hub_name, top=100) ] if parsed_args.hub_name else [] hub_name_type = CliArgumentType( completer=get_resource_name_completion_list('Microsoft.Devices/IotHubs'), help='IoT Hub name.') register_cli_argument('iot hub', 'hub_name', hub_name_type, options_list=('--name', '-n')) for subgroup in ['consumer-group', 'policy']: register_cli_argument('iot hub {}'.format(subgroup), 'hub_name', options_list=('--hub-name', )) register_cli_argument('iot device', 'hub_name', hub_name_type) register_cli_argument('iot', 'device_id',
def get_hostname_completion_list(prefix, action, parsed_args, **kwargs): # pylint: disable=unused-argument if parsed_args.resource_group_name and parsed_args.webapp: rg = parsed_args.resource_group_name webapp = parsed_args.webapp slot = getattr(parsed_args, 'slot', None) result = _generic_site_operation(rg, webapp, 'get_site_host_name_bindings', slot) # workaround an api defect, that 'name' is '<webapp>/<hostname>' return [r.name.split('/', 1)[1] for r in result] # pylint: disable=line-too-long # PARAMETER REGISTRATION name_arg_type = CliArgumentType(options_list=('--name', '-n'), metavar='NAME') sku_arg_type = CliArgumentType( help= 'The pricing tiers, e.g., F1(Free), D1(Shared), B1(Basic Small), B2(Basic Medium), B3(Basic Large), S1(Standard Small), P1(Premium Small), P1V2(Premium V2 Small) etc', **enum_choice_list([ 'F1', 'FREE', 'D1', 'SHARED', 'B1', 'B2', 'B3', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P1V2', 'P2V2', 'P3V2' ])) webapp_name_arg_type = CliArgumentType( configured_default='web', options_list=('--name', '-n'), metavar='NAME', completer=get_resource_name_completion_list('Microsoft.Web/sites'), id_part='name', help= "name of the web. You can configure the default using 'az configure --defaults web=<name>'"
else m(resource_group_name, name, extra_parameter, slot)) def get_hostname_completion_list(prefix, action, parsed_args, **kwargs): # pylint: disable=unused-argument if parsed_args.resource_group_name and parsed_args.webapp: rg = parsed_args.resource_group_name webapp = parsed_args.webapp slot = getattr(parsed_args, 'slot', None) result = _generic_site_operation(rg, webapp, 'get_site_host_name_bindings', slot) #workaround an api defect, that 'name' is '<webapp>/<hostname>' return [r.name.split('/', 1)[1] for r in result] #pylint: disable=line-too-long # PARAMETER REGISTRATION name_arg_type = CliArgumentType(options_list=('--name', '-n'), metavar='NAME') sku_arg_type = CliArgumentType( help= 'The pricing tiers, e.g., F1(Free), D1(Shared), B1(Basic Small), B2(Basic Medium), B3(Basic Large), S1(Standard Small), P1(Premium Small), etc', **enum_choice_list([ 'F1', 'FREE', 'D1', 'SHARED', 'B1', 'B2', 'B3', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3' ])) register_cli_argument('appservice', 'resource_group_name', arg_type=resource_group_name_type) register_cli_argument('appservice', 'location', arg_type=location_type) register_cli_argument( 'appservice plan',
if parsed_args.resource_group_name: client = web_client_factory() #pylint: disable=no-member result = client.sites.get_sites(parsed_args.resource_group_name).value return [x.name for x in result] def list_app_service_plan_names(prefix, action, parsed_args, **kwargs):#pylint: disable=unused-argument if parsed_args.resource_group_name: client = web_client_factory() #pylint: disable=no-member result = client.server_farms.get_server_farms(parsed_args.resource_group_name).value return [x.name for x in result] #pylint: disable=line-too-long # PARAMETER REGISTRATION name_arg_type = CliArgumentType(options_list=('--name', '-n'), metavar='NAME') existing_plan_name = CliArgumentType(overrides=name_arg_type, help='The name of the app service plan', completer=list_app_service_plan_names, id_part='name') existing_webapp_name = CliArgumentType(overrides=name_arg_type, help='The name of the web app', completer=list_webapp_names, id_part='name') register_cli_argument('appservice web', 'resource_group', arg_type=resource_group_name_type) register_cli_argument('appservice web', 'location', arg_type=location_type) register_cli_argument('appservice web', 'slot', help="the name of the slot. Default to the productions slot if not specified") register_cli_argument('appservice plan', 'resource_group', arg_type=resource_group_name_type) register_cli_argument('appservice plan', 'location', arg_type=location_type) register_cli_argument('appservice plan', 'name', arg_type=existing_plan_name) register_cli_argument('appservice plan create', 'name', options_list=('--name', '-n'), help="Name of the new app service plan") register_cli_argument('appservice plan', 'tier', options_list=('--sku',), type=str.upper, choices=['FREE', 'SHARED', 'B1', 'B2', 'B3', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3'], default='B1', help='The pricing tiers, e.g., FREE, SHARED, B1(Basic Small), B2(Basic Medium), B3(Basic Large), S1(Standard Small), P1(Premium Small), etc') register_cli_argument('appservice plan', 'number_of_workers', help='Number of workers to be allocated.', type=int, default=1) register_cli_argument('appservice plan', 'admin_site_name', help='The name of the admin web app.')
from azure.mgmt.iothub.models.iot_hub_client_enums import IotHubSku from ._factory import iot_hub_service_factory from .custom import iot_device_list, KeyType, SimpleAccessRights from ._validators import validate_policy_permissions def get_device_id_completion_list(prefix, action, parsed_args, **kwargs): # pylint: disable=unused-argument client = iot_hub_service_factory(kwargs) return [ d.device_id for d in iot_device_list(client, parsed_args.hub_name, top=100) ] if parsed_args.hub_name else [] hub_name_type = CliArgumentType( completer=get_resource_name_completion_list('Microsoft.Devices/IotHubs'), help='IoT Hub name.') etag_type = CliArgumentType(None, help='Entity Tag (etag) of the object.') register_cli_argument('iot hub', 'hub_name', hub_name_type, options_list=('--name', '-n'), id_part='name') register_cli_argument('iot hub', 'etag', etag_type, options_list=('--etag', '-e'))
else m(resource_group_name, name, extra_parameter, slot)) def get_hostname_completion_list(prefix, action, parsed_args, **kwargs): # pylint: disable=unused-argument if parsed_args.resource_group_name and parsed_args.webapp: rg = parsed_args.resource_group_name webapp = parsed_args.webapp slot = getattr(parsed_args, 'slot', None) result = _generic_site_operation(rg, webapp, 'get_site_host_name_bindings', slot) #workaround an api defect, that 'name' is '<webapp>/<hostname>' return [r.name.split('/', 1)[1] for r in result] #pylint: disable=line-too-long # PARAMETER REGISTRATION name_arg_type = CliArgumentType(options_list=('--name', '-n'), metavar='NAME') _SKU_HELP = 'The pricing tiers, e.g., F1(Free), D1(Shared), B1(Basic Small), B2(Basic Medium), B3(Basic Large), S1(Standard Small), P1(Premium Small), etc' _SKU_LIST = [ 'F1', 'FREE', 'D1', 'SHARED', 'B1', 'B2', 'B3', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3' ] sku_arg_type = CliArgumentType(help=_SKU_HELP, **enum_choice_list(_SKU_LIST)) register_cli_argument('appservice', 'resource_group_name', arg_type=resource_group_name_type) register_cli_argument('appservice', 'location', arg_type=location_type) register_cli_argument( 'appservice list-locations', 'linux_workers_enabled',