예제 #1
0
def register_path_argument(scope, default_file_param=None, options_list=None):
    path_help = 'The path to the file within the file share.'
    if default_file_param:
        path_help = '{} If the file name is omitted, the source file name will be used.'.format(path_help)
    register_extra_cli_argument(scope, 'path', options_list=options_list or ('--path', '-p'), required=default_file_param is None, help=path_help, validator=get_file_path_validator(default_file_param=default_file_param), completer=file_path_completer)
    register_cli_argument(scope, 'file_name', ignore_type)
    register_cli_argument(scope, 'directory_name', ignore_type)
예제 #2
0
    def test_register_extra_cli_argument(self):
        command_table.clear()

        cli_command(
            None, 'test command sample-vm-get',
            '{}#Test_command_registration.sample_vm_get'.format(__name__),
            None)
        register_extra_cli_argument('test command sample-vm-get',
                                    'added_param',
                                    options_list=('--added-param', ),
                                    metavar='ADDED',
                                    help='Just added this right now!',
                                    required=True)

        command_table['test command sample-vm-get'].load_arguments()
        _update_command_definitions(command_table)

        self.assertEqual(len(command_table), 1,
                         'We expect exactly one command in the command table')
        command_metadata = command_table['test command sample-vm-get']
        self.assertEqual(len(command_metadata.arguments), 5,
                         'We expected exactly 5 arguments')

        some_expected_arguments = {
            'added_param': CliArgumentType(dest='added_param', required=True)
        }

        for probe in some_expected_arguments:
            existing = next(arg for arg in command_metadata.arguments
                            if arg == probe)
            self.assertDictContainsSubset(
                some_expected_arguments[existing].settings,
                command_metadata.arguments[existing].options)

        command_table.clear()
예제 #3
0
    def test_register_extra_cli_argument(self):
        command_table.clear()

        cli_command(None, 'test command sample-vm-get',
                    '{}#Test_command_registration.sample_vm_get'.format(__name__), None)
        register_extra_cli_argument(
            'test command sample-vm-get', 'added_param', options_list=('--added-param',),
            metavar='ADDED', help='Just added this right now!', required=True
        )

        command_table['test command sample-vm-get'].load_arguments()
        _update_command_definitions(command_table)

        self.assertEqual(len(command_table), 1,
                         'We expect exactly one command in the command table')
        command_metadata = command_table['test command sample-vm-get']
        self.assertEqual(len(command_metadata.arguments), 5, 'We expected exactly 5 arguments')

        some_expected_arguments = {
            'added_param': CliArgumentType(dest='added_param', required=True)
        }

        for probe in some_expected_arguments:
            existing = next(arg for arg in command_metadata.arguments if arg == probe)
            self.assertDictContainsSubset(some_expected_arguments[existing].settings,
                                          command_metadata.arguments[existing].options)

        command_table.clear()
예제 #4
0
def register_path_argument(scope, default_file_param=None, options_list=None):
    path_help = 'The path to the file within the file share.'
    if default_file_param:
        path_help = '{} If the file name is omitted, the source file name will be used.'.format(path_help)
    register_extra_cli_argument(scope, 'path', options_list=options_list or ('--path', '-p'), required=default_file_param is None, help=path_help, validator=get_file_path_validator(default_file_param=default_file_param), completer=file_path_completer)
    register_cli_argument(scope, 'file_name', ignore_type)
    register_cli_argument(scope, 'directory_name', ignore_type)
예제 #5
0
def register_attributes_argument(scope, name, attr_class, create=False):
    register_cli_argument(scope,
                          '{}_attributes'.format(name),
                          ignore_type,
                          validator=get_attribute_validator(
                              name, attr_class, create))
    if create:
        register_extra_cli_argument(
            scope,
            'disabled',
            action='store_true',
            help='Create {} in disabled state.'.format(name))
    else:
        register_extra_cli_argument(scope,
                                    'enabled',
                                    default=None,
                                    choices=['true', 'false'],
                                    help='Enable the {}.'.format(name))
    register_extra_cli_argument(
        scope,
        'expires',
        default=None,
        help='Expiration UTC datetime  (Y-m-d\'T\'H:M\'Z\').',
        type=datetime_type)
    register_extra_cli_argument(
        scope,
        'not_before',
        default=None,
        help=
        'Key not usable before the provided UTC datetime  (Y-m-d\'T\'H:M\'Z\').',
        type=datetime_type)
예제 #6
0
def register_attributes_argument(scope, name, attr_class, create=False):
    register_cli_argument(scope, '{}_attributes'.format(name), ignore_type, validator=get_attribute_validator(name, attr_class, create))
    if create:
        register_extra_cli_argument(scope, 'disabled', action='store_true', help='Create {} in disabled state.'.format(name))
    else:
        register_extra_cli_argument(scope, 'enabled', default=None, choices=['true', 'false'], help='Enable the {}.'.format(name))
    register_extra_cli_argument(scope, 'expires', default=None, help='Expiration UTC datetime  (Y-m-d\'T\'H:M:S\'Z\').', type=datetime_type)
    register_extra_cli_argument(scope, 'not_before', default=None, help='Key not usable before the provided UTC datetime  (Y-m-d\'T\'H:M:S\'Z\').', type=datetime_type)
예제 #7
0
def register_resource_parameter(command, dest, arg_group=None, required=True):
    """ Helper method to add the extra parameters needed to support specifying name or ID
        for target resources. """
    register_cli_argument(command, dest, options_list=['--{}'.format(dest)], arg_group=arg_group, required=required, validator=get_target_resource_validator(dest, required), help="Name or ID of the target resource.")
    register_extra_cli_argument(command, 'namespace', options_list=['--{}-namespace'.format(dest)], arg_group=arg_group, help="Target resource provider namespace.")
    register_extra_cli_argument(command, 'parent', options_list=['--{}-parent'.format(dest)], arg_group=arg_group, help="Target resource parent path, if applicable.")
    register_extra_cli_argument(command, 'resource_type', options_list=['--{}-type'.format(dest)], arg_group=arg_group, help="Target resource type. Can also accept namespace/type format (Ex: 'Microsoft.Compute/virtualMachines)')")
예제 #8
0
def register_attributes_argument(scope, name, attr_class, create=False, ignore=None):
    ignore = ignore or []
    register_cli_argument(scope, '{}_attributes'.format(name), ignore_type,
                          validator=get_attribute_validator(name, attr_class, create))
    if create:
        register_extra_cli_argument(scope, 'disabled',
                                    help='Create {} in disabled state.'.format(name),
                                    **three_state_flag())
    else:
        register_extra_cli_argument(scope, 'enabled', help='Enable the {}.'.format(name),
                                    **three_state_flag())
    if 'expires' not in ignore:
        register_extra_cli_argument(scope, 'expires', default=None,
                                    help='Expiration UTC datetime  (Y-m-d\'T\'H:M:S\'Z\').',
                                    type=datetime_type)
    if 'not_before' not in ignore:
        register_extra_cli_argument(scope, 'not_before', default=None,
                                    help='Key not usable before the provided UTC datetime  '
                                         '(Y-m-d\'T\'H:M:S\'Z\').',
                                    type=datetime_type)
예제 #9
0
def register_attributes_argument(scope, name, attr_class, create=False, ignore=None):
    ignore = ignore or []
    register_cli_argument(scope, '{}_attributes'.format(name), ignore_type,
                          validator=get_attribute_validator(name, attr_class, create))
    if create:
        register_extra_cli_argument(scope, 'disabled',
                                    help='Create {} in disabled state.'.format(name),
                                    **three_state_flag())
    else:
        register_extra_cli_argument(scope, 'enabled', help='Enable the {}.'.format(name),
                                    **three_state_flag())
    if 'expires' not in ignore:
        register_extra_cli_argument(scope, 'expires', default=None,
                                    help='Expiration UTC datetime  (Y-m-d\'T\'H:M:S\'Z\').',
                                    type=datetime_type)
    if 'not_before' not in ignore:
        register_extra_cli_argument(scope, 'not_before', default=None,
                                    help='Key not usable before the provided UTC datetime  '
                                         '(Y-m-d\'T\'H:M:S\'Z\').',
                                    type=datetime_type)
예제 #10
0
def register_content_settings_argument(scope, settings_class, update, arg_group=None):
    register_cli_argument(scope, 'content_settings', ignore_type, validator=get_content_setting_validator(settings_class, update), arg_group=arg_group)
    register_extra_cli_argument(scope, 'content_type', default=None, help='The content MIME type.', arg_group=arg_group)
    register_extra_cli_argument(scope, 'content_encoding', default=None, help='The content encoding type.', arg_group=arg_group)
    register_extra_cli_argument(scope, 'content_language', default=None, help='The content language.', arg_group=arg_group)
    register_extra_cli_argument(scope, 'content_disposition', default=None, help='Conveys additional information about how to process the response payload, and can also be used to attach additional metadata.', arg_group=arg_group)
    register_extra_cli_argument(scope, 'content_cache_control', default=None, help='The cache control string.', arg_group=arg_group)
    register_extra_cli_argument(scope, 'content_md5', default=None, help='The content\'s MD5 hash.', arg_group=arg_group)
예제 #11
0
    register_cli_argument('storage account show-connection-string', '{}_endpoint'.format(item), help='Custom endpoint for {}s.'.format(item))

register_cli_argument('storage account create', 'account_name', account_name_type, options_list=('--name', '-n'), completer=None)

register_cli_argument('storage account create', 'kind', help='Indicates the type of storage account.', **enum_choice_list(Kind))
register_cli_argument('storage account create', 'tags', tags_type)

for item in ['create', 'update']:
    register_cli_argument('storage account {}'.format(item), 'sku', help='The storage account SKU.', **enum_choice_list(SkuName))
    register_cli_argument('storage account {}'.format(item), 'encryption', nargs='+', help='Specifies which service(s) to encrypt.', validator=validate_encryption, **enum_choice_list(list(EncryptionServices._attribute_map.keys())))  # pylint: disable=protected-access

register_cli_argument('storage account create', 'access_tier', help='Required for StandardBlob accounts. The access tier used for billing. Cannot be set for StandardLRS, StandardGRS, StandardRAGRS, or PremiumLRS account types.', **enum_choice_list(AccessTier))
register_cli_argument('storage account update', 'access_tier', help='The access tier used for billing StandardBlob accounts. Cannot be set for StandardLRS, StandardGRS, StandardRAGRS, or PremiumLRS account types.', **enum_choice_list(AccessTier))
register_cli_argument('storage account create', 'custom_domain', help='User domain assigned to the storage account. Name is the CNAME source.', validator=validate_custom_domain)
register_cli_argument('storage account update', 'custom_domain', help='User domain assigned to the storage account. Name is the CNAME source. Use "" to clear existing value.', validator=validate_custom_domain)
register_extra_cli_argument('storage account create', 'subdomain', options_list=('--use-subdomain',), help='Specify to enable indirect CNAME validation.', action='store_true')
register_extra_cli_argument('storage account update', 'subdomain', options_list=('--use-subdomain',), help='Specify whether to use indirect CNAME validation.', default=None, **enum_choice_list(['true', 'false']))

register_cli_argument('storage account update', 'tags', tags_type, default=None)

register_cli_argument('storage account keys renew', 'key_name', options_list=('--key',), help='The key to regenerate.', validator=validate_key, **enum_choice_list(list(storage_account_key_options.keys())))
register_cli_argument('storage account keys renew', 'account_name', account_name_type, id_part=None)
register_cli_argument('storage account keys list', 'account_name', account_name_type, id_part=None)

register_cli_argument('storage blob', 'blob_name', blob_name_type, options_list=('--name', '-n'))

for item in ['container', 'blob']:
    register_cli_argument('storage {} lease'.format(item), 'lease_duration', type=int)
    register_cli_argument('storage {} lease'.format(item), 'lease_break_period', type=int)

register_cli_argument('storage blob lease', 'blob_name', blob_name_type)
예제 #12
0
                      help='Whether the Batch service should wait for the start task to complete successfully (that is, to exit with exit code 0) before scheduling any tasks on the compute node. True if flag present, otherwise defaults to False.')
register_cli_argument('batch pool reset', 'start_task_max_task_retry_count', arg_group='Pool: Start Task',
                      help='The maximum number of times the task may be retried.')
register_cli_argument('batch pool reset', 'start_task_environment_settings', nargs='+', type=environment_setting_format, arg_group='Pool: Start Task',
                      help='A list of environment variable settings for the start task. Space separated values in \'key=value\' format.')

register_cli_argument('batch job list', 'filter', help=' An OData $filter clause.', arg_group='Pre-condition and Query')
register_cli_argument('batch job list', 'select', help=' An OData $select clause.', arg_group='Pre-condition and Query')
register_cli_argument('batch job list', 'expand', help=' An OData $expand clause.', arg_group='Pre-condition and Query')
register_cli_argument('batch job list', 'job_schedule_id', help='The ID of the job schedule from which you want to get a list of jobs. If omitted, lists all jobs in the account.')
for command in ['job create', 'job set', 'job reset', 'job-schedule create', 'job-schedule set', 'job-schedule reset']:
    register_cli_argument('batch {}'.format(command), 'pool_id', options_list=('--pool-id',), help='The id of an existing pool. All the tasks of the job will run on the specified pool.')

register_cli_argument('batch pool create', 'os_family', **enum_choice_list(['2', '3', '4', '5']))
register_cli_argument('batch pool create', 'auto_scale_formula', help='A formula for the desired number of compute nodes in the pool. The formula is checked for validity before the pool is created. If the formula is not valid, the Batch service rejects the request with detailed error information. For more information about specifying this formula, see https://azure.microsoft.com/documentation/articles/batch-automatic-scaling/.')
register_extra_cli_argument('batch pool create', 'image', completer=load_node_agent_skus, arg_group="Pool: Virtual Machine Configuration",
                            help="OS image URN in 'publisher:offer:sku[:version]' format. Version is optional and if omitted latest will be used.\n\tValues from 'az batch pool node-agent-skus list'.\n\tExample: 'MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest'")

register_cli_argument('batch certificate', 'thumbprint', help='The certificate thumbprint.')
register_cli_argument('batch certificate show', 'thumbprint', help='The certificate thumbprint.', validator=validate_cert_settings)
register_cli_argument('batch certificate', 'password', help='The password to access the certificate\'s private key.')
register_cli_argument('batch certificate', 'certificate_file', type=file_type, help='The certificate file: cer file or pfx file.', validator=validate_cert_file, completer=FilesCompleter())
register_cli_argument('batch certificate delete', 'abort', action='store_true', help='Cancel the failed certificate deletion operation.')

register_cli_argument('batch task create', 'json_file', type=file_type, help='The file containing the task(s) to create in JSON format, if this parameter is specified, all other parameters are ignored.', validator=validate_json_file, completer=FilesCompleter())
register_cli_argument('batch task create', 'application_package_references', nargs='+', help='The space separated list of IDs specifying the application packages to be installed. Space separated application IDs with optional version in \'id[#version]\' format.', type=application_package_reference_format)
register_cli_argument('batch task create', 'job_id', help='The ID of the job containing the task.')
register_cli_argument('batch task create', 'task_id', help='The ID of the task.')
register_cli_argument('batch task create', 'command_line', help='The command line of the task. The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux.')
register_cli_argument('batch task create', 'environment_settings', nargs='+', help='A list of environment variable settings for the task. Space separated values in \'key=value\' format.', type=environment_setting_format)
register_cli_argument('batch task create', 'resource_files', nargs='+', help='A list of files that the Batch service will download to the compute node before running the command line. Space separated resource references in filename=blobsource format.', type=resource_file_format)
예제 #13
0
register_cli_argument(
    'image',
    'image_name',
    arg_type=name_arg_type,
    id_part='name',
    completer=get_resource_name_completion_list('Microsoft.Compute/images'))
register_cli_argument('image create',
                      'name',
                      arg_type=name_arg_type,
                      help='new image name')

# here we collpase all difference image sources to under 2 common arguments --os-disk-source --data-disk-sources
register_extra_cli_argument(
    'image create',
    'source',
    validator=process_image_create_namespace,
    help=
    'OS disk source of the new image, including a virtual machine id or name, sas uri to a os disk blob, managed os disk id or name, or os snapshot id or name'
)
register_extra_cli_argument(
    'image create',
    'data_disk_sources',
    nargs='+',
    help=
    'space separated 1 or more data disk sources, including sas uri to a blob, managed disk id or name, or snapshot id or name'
)
register_cli_argument('image create', 'source_virtual_machine', ignore_type)
register_cli_argument('image create', 'os_blob_uri', ignore_type)
register_cli_argument('image create', 'os_disk', ignore_type)
register_cli_argument('image create', 'os_snapshot', ignore_type)
register_cli_argument('image create', 'data_blob_uris', ignore_type)
예제 #14
0
register_cli_argument('acs', 'name', arg_type=name_arg_type)
register_cli_argument('acs', 'orchestrator_type',
                      **enum_choice_list(ContainerServiceOchestratorTypes))
# some admin names are prohibited in acs, such as root, admin, etc. Because we have no control on the orchestrators, so default to a safe name.
register_cli_argument('acs',
                      'admin_username',
                      options_list=('--admin-username', ),
                      default='azureuser',
                      required=False)
register_cli_argument('acs',
                      'dns_name_prefix',
                      options_list=('--dns-prefix', '-d'))
register_extra_cli_argument(
    'acs create',
    'generate_ssh_keys',
    action='store_true',
    help='Generate SSH public and private key files if missing')
register_cli_argument('acs',
                      'container_service_name',
                      options_list=('--name', '-n'),
                      help='The name of the container service',
                      completer=get_resource_name_completion_list(
                          'Microsoft.ContainerService/ContainerServices'))
register_cli_argument('acs create',
                      'agent_vm_size',
                      completer=get_vm_size_completion_list)
register_cli_argument('acs scale',
                      'new_agent_count',
                      type=int,
                      help='The number of agents for the cluster')
예제 #15
0
               help='The Azure Key Vault key identifier of the server key to be made encryption protector.'
               'An example key identifier is '
               '"https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901"')
    c.argument('server_key_type',
               options_list=('--server-key-type', '-t'),
               help='The type of the server key',
               **enum_choice_list(ServerKeyType))


#####
#           sql server vnet-rule
#####


with ParametersContext(command='sql server vnet-rule') as c:
    # Help text needs to be specified because 'sql server vnet-rule create' is a custom
    # command.
    c.argument('server_name',
               options_list=('--server', '-s'), completer=get_resource_name_completion_list('Microsoft.SQL/servers'))

    c.argument('virtual_network_rule_name',
               options_list=('--name', '-n'))

    c.argument('virtual_network_subnet_id',
               options_list=('--subnet'),
               help='Name or ID of the subnet that allows access to an Azure Sql Server. '
               'If subnet name is provided, --vnet-name must be provided.')

register_extra_cli_argument('sql server vnet-rule create', 'vnet_name', options_list=('--vnet-name'),
                            help='The virtual network name', validator=validate_subnet)
예제 #16
0
        help=
        'The id of an existing pool. All the tasks of the job will run on the specified pool.'
    )

register_cli_argument('batch pool create', 'os_family',
                      **enum_choice_list(['2', '3', '4', '5']))
register_cli_argument(
    'batch pool create',
    'auto_scale_formula',
    help=
    'A formula for the desired number of compute nodes in the pool. The formula is checked for validity before the pool is created. If the formula is not valid, the Batch service rejects the request with detailed error information. For more information about specifying this formula, see https://azure.microsoft.com/documentation/articles/batch-automatic-scaling/.'
)
register_extra_cli_argument(
    'batch pool create',
    'image',
    completer=load_node_agent_skus,
    arg_group="Pool: Virtual Machine Configuration",
    help=
    "OS image reference. This can be either 'publisher:offer:sku[:version]' format, or a fully qualified ARM image id of the form '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}'. If 'publisher:offer:sku[:version]' format, version is optional and if omitted latest will be used. Valid values can be retrieved via 'az batch pool node-agent-skus list'. For example: 'MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest'"
)

register_cli_argument('batch certificate',
                      'thumbprint',
                      help='The certificate thumbprint.')
register_cli_argument('batch certificate show',
                      'thumbprint',
                      help='The certificate thumbprint.',
                      validator=validate_cert_settings)
register_cli_argument(
    'batch certificate',
    'password',
    help='The password to access the certificate\'s private key.')
예제 #17
0
파일: _params.py 프로젝트: Azure/azure-cli
register_cli_argument('network nic', 'network_security_group_type', help=argparse.SUPPRESS)
register_cli_argument('network nic', 'public_ip_address_type', help=argparse.SUPPRESS)
register_cli_argument('network nic', 'internal_dns_name_label', options_list=('--internal-dns-name',))

register_cli_argument('network nic create', 'network_interface_name', nic_type, options_list=('--name', '-n'), validator=process_nic_create_namespace, id_part=None)
register_cli_argument('network nic create', 'enable_ip_forwarding', options_list=('--ip-forwarding',), action='store_true')
register_cli_argument('network nic create', 'use_dns_settings', help=argparse.SUPPRESS)
register_folded_cli_argument('network nic create', 'public_ip_address', 'Microsoft.Network/publicIPAddresses', new_flag_value=None, default_value_flag='none', completer=get_resource_name_completion_list('Microsoft.Network/publicIPAddresses'))
register_folded_cli_argument('network nic create', 'subnet', 'subnets', none_flag_value=None, new_flag_value=None, default_value_flag='existingId', parent_name='virtual_network_name', parent_type='Microsoft.Network/virtualNetworks', completer=get_subnet_completion_list())
register_folded_cli_argument('network nic create', 'network_security_group', 'Microsoft.Network/networkSecurityGroups', new_flag_value=None, default_value_flag='none', completer=get_resource_name_completion_list('Microsoft.Network/networkSecurityGroups'))

register_cli_argument('network nic update', 'enable_ip_forwarding', options_list=('--ip-forwarding',), **enum_choice_list(['true', 'false']))
register_cli_argument('network nic update', 'network_security_group', validator=validate_nsg_name_or_id, completer=get_resource_name_completion_list('Microsoft.Network/networkSecurityGroups'))

for item in ['create', 'ip-config update', 'ip-config create']:
    register_extra_cli_argument('network nic {}'.format(item), 'load_balancer_name', options_list=('--lb-name',), completer=get_resource_name_completion_list('Microsoft.Network/loadBalancers'), help='The name of the load balancer to use when adding NAT rules or address pools by name (ignored when IDs are specified).')
    register_cli_argument('network nic {}'.format(item), 'load_balancer_backend_address_pool_ids', options_list=('--lb-address-pools',), nargs='+', validator=validate_address_pool_id_list, help='Space separated list of names or IDs of load balancer address pools to associate with the NIC. If names are used, --lb-name must be specified.', completer=get_lb_subresource_completion_list('backendAddresPools'))
    register_cli_argument('network nic {}'.format(item), 'load_balancer_inbound_nat_rule_ids', options_list=('--lb-inbound-nat-rules',), nargs='+', validator=validate_inbound_nat_rule_id_list, help='Space separated list of names or IDs of load balancer inbound NAT rules to associate with the NIC. If names are used, --lb-name must be specified.', completer=get_lb_subresource_completion_list('inboundNatRules'))

register_cli_argument('network nic ip-config', 'network_interface_name', options_list=('--nic-name',), metavar='NIC_NAME', help='The network interface (NIC).', id_part='name', completer=get_resource_name_completion_list('Microsoft.Network/networkInterfaces'))
register_cli_argument('network nic ip-config', 'ip_config_name', options_list=('--name', '-n'), metavar='IP_CONFIG_NAME', help='The name of the IP configuration.', id_part='child_name')
register_cli_argument('network nic ip-config', 'resource_name', options_list=('--nic-name',), metavar='NIC_NAME', help='The network interface (NIC).', id_part='name', completer=get_resource_name_completion_list('Microsoft.Network/networkInterfaces'))
register_cli_argument('network nic ip-config', 'item_name', options_list=('--name', '-n'), metavar='IP_CONFIG_NAME', help='The name of the IP configuration.', id_part='child_name')

for item in ['address-pool', 'inbound-nat-rule']:
    register_cli_argument('network nic ip-config {}'.format(item), 'ip_config_name', options_list=('--ip-config-name', '-n'), metavar='IP_CONFIG_NAME', help='The name of the IP configuration.', id_part='child_name')
    register_cli_argument('network nic ip-config {}'.format(item), 'network_interface_name', nic_type)

register_cli_argument('network nic ip-config address-pool remove', 'network_interface_name', nic_type, id_part=None)
register_cli_argument('network nic ip-config inbound-nat-rule remove', 'network_interface_name', nic_type, id_part=None)
예제 #18
0
파일: _params.py 프로젝트: Azure/azure-cli
    options_list=("--name", "-n"),
    help="The name of the container service",
    completer=get_resource_name_completion_list("Microsoft.ContainerService/ContainerServices"),
)

register_cli_argument(
    "acs",
    "ssh_key_value",
    required=False,
    help="SSH key file value or key file path.",
    default=os.path.join(os.path.expanduser("~"), ".ssh", "id_rsa.pub"),
    completer=FilesCompleter(),
)

register_extra_cli_argument(
    "acs create", "generate_ssh_keys", action="store_true", help="Generate SSH public and private key files if missing"
)
register_cli_argument("acs create", "agent_vm_size", completer=get_vm_size_completion_list)

register_cli_argument(
    "acs", "disable_browser", help="Do not open browser after opening a proxy to the cluster web user interface"
)
register_cli_argument("acs dcos browse", "name", name_type)
register_cli_argument("acs dcos browse", "resource_group_name", resource_group_name_type)
register_cli_argument(
    "acs dcos install-cli",
    "install_location",
    options_list=("--install-location",),
    default=_get_default_install_location("dcos"),
)
register_cli_argument("acs dcos install-cli", "client_version", options_list=("--client-version",), default="1.8")
예제 #19
0
                      help='Whether the Batch service should wait for the start task to complete successfully (that is, to exit with exit code 0) before scheduling any tasks on the compute node. True if flag present, otherwise defaults to False.')
register_cli_argument('batch pool reset', 'start_task_max_task_retry_count', arg_group='Pool: Start Task',
                      help='The maximum number of times the task may be retried.')
register_cli_argument('batch pool reset', 'start_task_environment_settings', nargs='+', type=environment_setting_format, arg_group='Pool: Start Task',
                      help='A list of environment variable settings for the start task. Space separated values in \'key=value\' format.')

register_cli_argument('batch job list', 'filter', help=' An OData $filter clause.', arg_group='Pre-condition and Query')
register_cli_argument('batch job list', 'select', help=' An OData $select clause.', arg_group='Pre-condition and Query')
register_cli_argument('batch job list', 'expand', help=' An OData $expand clause.', arg_group='Pre-condition and Query')
register_cli_argument('batch job list', 'job_schedule_id', help='The ID of the job schedule from which you want to get a list of jobs. If omitted, lists all jobs in the account.')
for command in ['job create', 'job set', 'job reset', 'job-schedule create', 'job-schedule set', 'job-schedule reset']:
    register_cli_argument('batch {}'.format(command), 'pool_id', options_list=('--pool-id',), help='The id of an existing pool. All the tasks of the job will run on the specified pool.')

register_cli_argument('batch pool create', 'os_family', **enum_choice_list(['2', '3', '4', '5']))
register_cli_argument('batch pool create', 'auto_scale_formula', help='A formula for the desired number of compute nodes in the pool. The formula is checked for validity before the pool is created. If the formula is not valid, the Batch service rejects the request with detailed error information. For more information about specifying this formula, see https://azure.microsoft.com/documentation/articles/batch-automatic-scaling/.')
register_extra_cli_argument('batch pool create', 'image', completer=load_node_agent_skus, arg_group="Pool: Virtual Machine Configuration",
                            help="OS image reference. This can be either 'publisher:offer:sku[:version]' format, or a fully qualified ARM image id of the form '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}'. If 'publisher:offer:sku[:version]' format, version is optional and if omitted latest will be used. Valid values can be retrieved via 'az batch pool node-agent-skus list'. For example: 'MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest'")

register_cli_argument('batch certificate', 'thumbprint', help='The certificate thumbprint.')
register_cli_argument('batch certificate show', 'thumbprint', help='The certificate thumbprint.', validator=validate_cert_settings)
register_cli_argument('batch certificate', 'password', help='The password to access the certificate\'s private key.')
register_cli_argument('batch certificate', 'certificate_file', type=file_type, help='The certificate file: cer file or pfx file.', validator=validate_cert_file, completer=FilesCompleter())
register_cli_argument('batch certificate delete', 'abort', action='store_true', help='Cancel the failed certificate deletion operation.')

register_cli_argument('batch task create', 'json_file', type=file_type, help='The file containing the task(s) to create in JSON format, if this parameter is specified, all other parameters are ignored.', validator=validate_json_file, completer=FilesCompleter())
register_cli_argument('batch task create', 'application_package_references', nargs='+', help='The space separated list of IDs specifying the application packages to be installed. Space separated application IDs with optional version in \'id[#version]\' format.', type=application_package_reference_format)
register_cli_argument('batch task create', 'job_id', help='The ID of the job containing the task.')
register_cli_argument('batch task create', 'task_id', help='The ID of the task.')
register_cli_argument('batch task create', 'command_line', help='The command line of the task. The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux.')
register_cli_argument('batch task create', 'environment_settings', nargs='+', help='A list of environment variable settings for the task. Space separated values in \'key=value\' format.', type=environment_setting_format)
register_cli_argument('batch task create', 'resource_files', nargs='+', help='A list of files that the Batch service will download to the compute node before running the command line. Space separated resource references in filename=blobsource format.', type=resource_file_format)
예제 #20
0
    register_cli_argument(scope, 'upgrade_policy_mode', choices=choices_upgrade_mode, help=None, type=str.lower)
    register_cli_argument(scope, 'os_disk_uri', help=argparse.SUPPRESS)
    register_cli_argument(scope, 'os_offer', help=argparse.SUPPRESS)
    register_cli_argument(scope, 'os_publisher', help=argparse.SUPPRESS)
    register_cli_argument(scope, 'os_sku', help=argparse.SUPPRESS)
    register_cli_argument(scope, 'os_type', help=argparse.SUPPRESS)
    register_cli_argument(scope, 'os_version', help=argparse.SUPPRESS)
    register_cli_argument(scope, 'dns_name_type', help=argparse.SUPPRESS)
    register_cli_argument(scope, 'admin_username', admin_username_type)
    register_cli_argument(scope, 'storage_type', help='The VM storage type.')
    register_cli_argument(scope, 'subnet_name', help='The subnet name.  Creates if creating a new VNet, references if referencing an existing VNet.')
    register_cli_argument(scope, 'admin_password', help='Password for the Virtual Machine if Authentication Type is Password.')
    register_cli_argument(scope, 'ssh_key_value', action=VMSSHFieldAction)
    register_cli_argument(scope, 'ssh_dest_key_path', completer=FilesCompleter())
    register_cli_argument(scope, 'dns_name_for_public_ip', action=VMDNSNameAction, options_list=('--public-ip-address-dns-name',), help='Globally unique DNS Name for the Public IP.')
    register_cli_argument(scope, 'authentication_type', authentication_type)
    register_folded_cli_argument(scope, 'availability_set', 'Microsoft.Compute/availabilitySets', new_flag_value=None, default_value_flag='none')
    register_cli_argument(scope, 'private_ip_address_allocation', help=argparse.SUPPRESS)
    register_cli_argument(scope, 'virtual_network_ip_address_prefix', options_list=('--vnet-ip-address-prefix',))
    register_cli_argument(scope, 'subnet_ip_address_prefix', options_list=('--subnet-ip-address-prefix',))
    register_cli_argument(scope, 'private_ip_address', help='Static private IP address (e.g. 10.0.0.5).', options_list=('--private-ip-address',), action=PrivateIpAction)
    register_cli_argument(scope, 'public_ip_address_allocation', choices=['dynamic', 'static'], help='', default='dynamic', type=str.lower)
    register_folded_cli_argument(scope, 'public_ip_address', 'Microsoft.Network/publicIPAddresses')
    register_folded_cli_argument(scope, 'storage_account', 'Microsoft.Storage/storageAccounts', validator=_find_default_storage_account, none_flag_value=None, default_value_flag='existingId')
    register_folded_cli_argument(scope, 'virtual_network', 'Microsoft.Network/virtualNetworks', options_list=('--vnet',), validator=_find_default_vnet, none_flag_value=None, default_value_flag='existingId')
    register_folded_cli_argument(scope, 'network_security_group', 'Microsoft.Network/networkSecurityGroups', options_list=('--nsg',))
    register_folded_cli_argument(scope, 'load_balancer', 'Microsoft.Network/loadBalancers')
    register_cli_argument(scope, 'network_security_group_rule', nsg_rule_type, options_list=('--nsg-rule',))
    register_extra_cli_argument(scope, 'image', options_list=('--image',), action=VMImageFieldAction, completer=get_urn_aliases_completion_list, required=True)

예제 #21
0
 def extra(self, argument_name, **kwargs):
     from azure.cli.core.commands import register_extra_cli_argument
     register_extra_cli_argument(self._commmand, argument_name, **kwargs)
예제 #22
0
register_cli_argument('network nic', 'network_security_group_type', help=argparse.SUPPRESS)
register_cli_argument('network nic', 'public_ip_address_type', help=argparse.SUPPRESS)
register_cli_argument('network nic', 'internal_dns_name_label', options_list=('--internal-dns-name',))

register_cli_argument('network nic create', 'network_interface_name', nic_type, options_list=('--name', '-n'), validator=process_nic_create_namespace, id_part=None)
register_cli_argument('network nic create', 'enable_ip_forwarding', options_list=('--ip-forwarding',), action='store_true')
register_cli_argument('network nic create', 'use_dns_settings', help=argparse.SUPPRESS)
register_folded_cli_argument('network nic create', 'public_ip_address', 'Microsoft.Network/publicIPAddresses', new_flag_value=None, default_value_flag='none', completer=get_resource_name_completion_list('Microsoft.Network/publicIPAddresses'))
register_folded_cli_argument('network nic create', 'subnet', 'subnets', none_flag_value=None, new_flag_value=None, default_value_flag='existingId', parent_name='virtual_network_name', parent_type='Microsoft.Network/virtualNetworks', completer=get_subnet_completion_list())
register_folded_cli_argument('network nic create', 'network_security_group', 'Microsoft.Network/networkSecurityGroups', new_flag_value=None, default_value_flag='none', completer=get_resource_name_completion_list('Microsoft.Network/networkSecurityGroups'))

register_cli_argument('network nic update', 'enable_ip_forwarding', options_list=('--ip-forwarding',), **enum_choice_list(['true', 'false']))
register_cli_argument('network nic update', 'network_security_group', validator=validate_nsg_name_or_id, completer=get_resource_name_completion_list('Microsoft.Network/networkSecurityGroups'))

for item in ['create', 'ip-config update', 'ip-config create']:
    register_extra_cli_argument('network nic {}'.format(item), 'load_balancer_name', options_list=('--lb-name',), completer=get_resource_name_completion_list('Microsoft.Network/loadBalancers'), help='The name of the load balancer to use when adding NAT rules or address pools by name (ignored when IDs are specified).')
    register_cli_argument('network nic {}'.format(item), 'load_balancer_backend_address_pool_ids', options_list=('--lb-address-pools',), nargs='+', validator=validate_address_pool_id_list, help='Space separated list of names or IDs of load balancer address pools to associate with the NIC. If names are used, --lb-name must be specified.', completer=get_lb_subresource_completion_list('backendAddresPools'))
    register_cli_argument('network nic {}'.format(item), 'load_balancer_inbound_nat_rule_ids', options_list=('--lb-inbound-nat-rules',), nargs='+', validator=validate_inbound_nat_rule_id_list, help='Space separated list of names or IDs of load balancer inbound NAT rules to associate with the NIC. If names are used, --lb-name must be specified.', completer=get_lb_subresource_completion_list('inboundNatRules'))

register_cli_argument('network nic ip-config', 'network_interface_name', options_list=('--nic-name',), metavar='NIC_NAME', help='The network interface (NIC).', id_part='name', completer=get_resource_name_completion_list('Microsoft.Network/networkInterfaces'))
register_cli_argument('network nic ip-config', 'ip_config_name', options_list=('--name', '-n'), metavar='IP_CONFIG_NAME', help='The name of the IP configuration.', id_part='child_name')
register_cli_argument('network nic ip-config', 'resource_name', options_list=('--nic-name',), metavar='NIC_NAME', help='The network interface (NIC).', id_part='name', completer=get_resource_name_completion_list('Microsoft.Network/networkInterfaces'))
register_cli_argument('network nic ip-config', 'item_name', options_list=('--name', '-n'), metavar='IP_CONFIG_NAME', help='The name of the IP configuration.', id_part='child_name')

for item in ['address-pool', 'inbound-nat-rule']:
    register_cli_argument('network nic ip-config {}'.format(item), 'ip_config_name', options_list=('--ip-config-name', '-n'), metavar='IP_CONFIG_NAME', help='The name of the IP configuration.', id_part='child_name')
    register_cli_argument('network nic ip-config {}'.format(item), 'network_interface_name', nic_type)

register_cli_argument('network nic ip-config address-pool remove', 'network_interface_name', nic_type, id_part=None)
register_cli_argument('network nic ip-config inbound-nat-rule remove', 'network_interface_name', nic_type, id_part=None)
예제 #23
0
                      help='Whether the Batch service should wait for the start task to complete successfully (that is, to exit with exit code 0) before scheduling any tasks on the compute node. True if flag present, otherwise defaults to False.')
register_cli_argument('batch pool reset', 'start_task_max_task_retry_count', arg_group='Pool: Start Task',
                      help='The maximum number of times the task may be retried.')
register_cli_argument('batch pool reset', 'start_task_environment_settings', nargs='+', type=environment_setting_format, arg_group='Pool: Start Task',
                      help='A list of environment variable settings for the start task. Space separated values in \'key=value\' format.')

register_cli_argument('batch job list', 'filter', help=' An OData $filter clause.', arg_group='Pre-condition and Query')
register_cli_argument('batch job list', 'select', help=' An OData $select clause.', arg_group='Pre-condition and Query')
register_cli_argument('batch job list', 'expand', help=' An OData $expand clause.', arg_group='Pre-condition and Query')
register_cli_argument('batch job list', 'job_schedule_id', help='The ID of the job schedule from which you want to get a list of jobs. If omitted, lists all jobs in the account.')
for command in ['job create', 'job set', 'job reset', 'job-schedule create', 'job-schedule set', 'job-schedule reset']:
    register_cli_argument('batch {}'.format(command), 'pool_id', options_list=('--pool-id',), help='The id of an existing pool. All the tasks of the job will run on the specified pool.')

register_cli_argument('batch pool create', 'os_family', **enum_choice_list(['2', '3', '4', '5']))
register_cli_argument('batch pool create', 'auto_scale_formula', help='A formula for the desired number of compute nodes in the pool. The formula is checked for validity before the pool is created. If the formula is not valid, the Batch service rejects the request with detailed error information. For more information about specifying this formula, see https://azure.microsoft.com/documentation/articles/batch-automatic-scaling/.')
register_extra_cli_argument('batch pool create', 'image', completer=load_node_agent_skus, arg_group="Pool: Virtual Machine Configuration",
                            help="OS image URN in 'publisher:offer:sku[:version]' format. Version is optional and if omitted latest will be used.\n\tValues from 'az batch pool node-agent-skus list'.\n\tExample: 'MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest'")

register_cli_argument('batch certificate', 'thumbprint', help='The certificate thumbprint.')
register_cli_argument('batch certificate show', 'thumbprint', help='The certificate thumbprint.', validator=validate_cert_settings)
register_cli_argument('batch certificate', 'password', help='The password to access the certificate\'s private key.')
register_cli_argument('batch certificate', 'certificate_file', type=file_type, help='The certificate file: cer file or pfx file.', validator=validate_cert_file, completer=FilesCompleter())
register_cli_argument('batch certificate delete', 'abort', action='store_true', help='Cancel the failed certificate deletion operation.')

register_cli_argument('batch task create', 'json_file', type=file_type, help='The file containing the task(s) to create in JSON format, if this parameter is specified, all other parameters are ignored.', validator=validate_json_file, completer=FilesCompleter())
register_cli_argument('batch task create', 'application_package_references', nargs='+', help='The space separated list of IDs specifying the application packages to be installed. Space separated application IDs with optional version in \'id[#version]\' format.', type=application_package_reference_format)
register_cli_argument('batch task create', 'job_id', help='The ID of the job containing the task.')
register_cli_argument('batch task create', 'task_id', help='The ID of the task.')
register_cli_argument('batch task create', 'command_line', help='The command line of the task. The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux.')
register_cli_argument('batch task create', 'environment_settings', nargs='+', help='A list of environment variable settings for the task. Space separated values in \'key=value\' format.', type=environment_setting_format)
register_cli_argument('batch task create', 'resource_files', nargs='+', help='A list of files that the Batch service will download to the compute node before running the command line. Space separated resource references in filename=blobsource format.', type=resource_file_format)
예제 #24
0
register_cli_argument('acs',
                      'ssh_key_value',
                      required=False,
                      help='SSH key file value or key file path.',
                      type=file_type,
                      default=os.path.join('~', '.ssh', 'id_rsa.pub'),
                      completer=FilesCompleter())
register_cli_argument('acs create',
                      'name',
                      arg_type=name_arg_type,
                      validator=validate_ssh_key)

register_extra_cli_argument(
    'acs create',
    'generate_ssh_keys',
    action='store_true',
    help='Generate SSH public and private key files if missing',
    validator=validate_create_parameters)
register_cli_argument('acs create',
                      'agent_vm_size',
                      completer=get_vm_size_completion_list)

register_cli_argument('acs create',
                      'windows',
                      action='store_true',
                      help='If true, deploy a windows container cluster.')
register_cli_argument(
    'acs create',
    'validate',
    action='store_true',
    help='Generate and validate the ARM template without creating any resources'
예제 #25
0
register_cli_argument('keyvault key import', 'pem_file', type=file_type, help='PEM file containing the key to be imported.', arg_group='Key Source', completer=FilesCompleter(), validator=validate_key_import_source)
register_cli_argument('keyvault key import', 'pem_password', help='Password of PEM file.', arg_group='Key Source')
register_cli_argument('keyvault key import', 'byok_file', type=file_type, help='BYOK file containing the key to be imported. Must not be password protected.', completer=FilesCompleter(), arg_group='Key Source')

register_cli_argument('keyvault key backup', 'file_path', options_list=('--file', '-f'), type=file_type, completer=FilesCompleter(), help='Local file path in which to store key backup.')

register_cli_argument('keyvault key restore', 'file_path', options_list=('--file', '-f'), type=file_type, completer=FilesCompleter(), help='Local key backup from which to restore key.')

register_attributes_argument('keyvault key set-attributes', 'key', KeyAttributes)

register_cli_argument('keyvault secret', 'secret_version', options_list=('--version', '-v'), help='The secret version. If omitted, uses the latest version.', default='', required=False, completer=get_keyvault_version_completion_list('secret'))

register_cli_argument('keyvault secret set', 'content_type', options_list=('--description',), help='Description of the secret contents (e.g. password, connection string, etc)')
register_attributes_argument('keyvault secret set', 'secret', SecretAttributes, create=True)
register_cli_argument('keyvault secret set', 'value', options_list=('--value',), help="Plain text secret value. Cannot be used with '--file' or '--encoding'", required=False, arg_group='Content Source')
register_extra_cli_argument('keyvault secret set', 'file_path', options_list=('--file', '-f'), type=file_type, help="Source file for secret. Use in conjunction with '--encoding'", completer=FilesCompleter(), arg_group='Content Source')
register_extra_cli_argument('keyvault secret set', 'encoding', options_list=('--encoding', '-e'), help='Source file encoding. The value is saved as a tag (file-encoding=<val>) and used during download to automtically encode the resulting file.', default='utf-8', validator=process_secret_set_namespace, arg_group='Content Source', **enum_choice_list(secret_encoding_values))

register_attributes_argument('keyvault secret set-attributes', 'secret', SecretAttributes)

register_cli_argument('keyvault secret download', 'file_path', options_list=('--file', '-f'), type=file_type, completer=FilesCompleter(), help='File to receive the secret contents.')
register_cli_argument('keyvault secret download', 'encoding', options_list=('--encoding', '-e'), help="Encoding of the destination file. By default, will look for the 'file-encoding' tag on the secret. Otherwise will assume 'utf-8'.", default=None, **enum_choice_list(secret_encoding_values))

register_cli_argument('keyvault certificate', 'certificate_version', options_list=('--version', '-v'), help='The certificate version. If omitted, uses the latest version.', default='', required=False, completer=get_keyvault_version_completion_list('certificate'))
register_attributes_argument('keyvault certificate create', 'certificate', CertificateAttributes, True)
register_attributes_argument('keyvault certificate import', 'certificate', CertificateAttributes, True)
register_attributes_argument('keyvault certificate set-attributes', 'certificate', CertificateAttributes)
for item in ['create', 'set-attributes', 'import']:
    register_cli_argument('keyvault certificate {}'.format(item), 'certificate_policy', options_list=('--policy', '-p'), help='JSON encoded policy defintion. Use @{file} to load from a file.', type=get_json_object)

register_cli_argument('keyvault certificate import', 'base64_encoded_certificate', options_list=('--file', '-f'), completer=FilesCompleter(), help='PKCS12 file or PEM file containing the certificate and private key.', type=base64_encoded_certificate_type)
예제 #26
0
register_cli_argument('keyvault key import', 'pem_file', help='PEM file containing the key to be imported.', arg_group='Key Source', validator=validate_key_import_source)
register_cli_argument('keyvault key import', 'pem_password', help='Password of PEM file.', arg_group='Key Source')
register_cli_argument('keyvault key import', 'byok_file', help='BYOK file containing the key to be imported. Must not be password protected.', arg_group='Key Source')

register_cli_argument('keyvault key backup', 'file_path', options_list=('--file', '-f'), help='Local file path in which to store key backup.')

register_cli_argument('keyvault key restore', 'file_path', options_list=('--file', '-f'), help='Local key backup from which to restore key.')

register_attributes_argument('keyvault key set-attributes', 'key', KeyAttributes)

register_cli_argument('keyvault secret', 'secret_version', options_list=('--version', '-v'), help='The secret version. If omitted, uses the latest version.', default='', required=False, completer=get_keyvault_version_completion_list('secret'))

register_cli_argument('keyvault secret set', 'content_type', options_list=('--description',), help='Description of the secret contents (e.g. password, connection string, etc)')
register_attributes_argument('keyvault secret set', 'secret', SecretAttributes, create=True)
register_cli_argument('keyvault secret set', 'value', options_list=('--value',), help="Plain text secret value. Cannot be used with '--file' or '--encoding'", required=False, arg_group='Content Source')
register_extra_cli_argument('keyvault secret set', 'file_path', options_list=('--file', '-f'), help="Source file for secret. Use in conjunction with '--encoding'", arg_group='Content Source')
register_extra_cli_argument('keyvault secret set', 'encoding', options_list=('--encoding', '-e'), help='Source file encoding. The value is saved as a tag (file-encoding=<val>) and used during download to automtically encode the resulting file.', default='utf-8', validator=process_secret_set_namespace, arg_group='Content Source', **enum_choice_list(secret_encoding_values))

register_attributes_argument('keyvault secret set-attributes', 'secret', SecretAttributes)

register_cli_argument('keyvault secret download', 'file_path', options_list=('--file', '-f'), help='File to receive the secret contents.')
register_cli_argument('keyvault secret download', 'encoding', options_list=('--encoding', '-e'), help="Encoding of the destination file. By default, will look for the 'file-encoding' tag on the secret. Otherwise will assume 'utf-8'.", default=None, **enum_choice_list(secret_encoding_values))

register_cli_argument('keyvault certificate', 'certificate_version', options_list=('--version', '-v'), help='The certificate version. If omitted, uses the latest version.', default='', required=False, completer=get_keyvault_version_completion_list('certificate'))
register_attributes_argument('keyvault certificate create', 'certificate', CertificateAttributes, True)
register_attributes_argument('keyvault certificate import', 'certificate', CertificateAttributes, True)
register_attributes_argument('keyvault certificate set-attributes', 'certificate', CertificateAttributes)
for item in ['create', 'set-attributes', 'import']:
    register_cli_argument('keyvault certificate {}'.format(item), 'certificate_policy', options_list=('--policy', '-p'), help='JSON encoded policy defintion. Use @{file} to load from a file.', type=get_json_object)

register_cli_argument('keyvault certificate import', 'base64_encoded_certificate', options_list=('--file', '-f'), help='PKCS12 file or PEM file containing the certificate and private key.', type=base64_encoded_certificate_type)
예제 #27
0
register_cli_argument('disk', 'disk_name', existing_disk_name, completer=get_resource_name_completion_list('Microsoft.Compute/disks'))
register_cli_argument('disk', 'name', arg_type=name_arg_type)
register_cli_argument('disk', 'sku', arg_type=disk_sku)

existing_snapshot_name = CliArgumentType(overrides=name_arg_type, help='The name of the snapshot', completer=get_resource_name_completion_list('Microsoft.Compute/snapshots'), id_part='name')
register_cli_argument('snapshot', 'snapshot_name', existing_snapshot_name, id_part='name', completer=get_resource_name_completion_list('Microsoft.Compute/snapshots'))
register_cli_argument('snapshot', 'name', arg_type=name_arg_type)
register_cli_argument('snapshot', 'sku', arg_type=disk_sku)

existing_image_name = CliArgumentType(overrides=name_arg_type, help='The name of the custom image', completer=get_resource_name_completion_list('Microsoft.Compute/images'), id_part='name')
register_cli_argument('image', 'os_type', **enum_choice_list(['Windows', 'Linux']))
register_cli_argument('image', 'image_name', arg_type=name_arg_type, id_part='name', completer=get_resource_name_completion_list('Microsoft.Compute/images'))
register_cli_argument('image create', 'name', arg_type=name_arg_type, help='new image name')

# here we collpase all difference image sources to under 2 common arguments --os-disk-source --data-disk-sources
register_extra_cli_argument('image create', 'source', validator=process_image_create_namespace,
                            help='OS disk source of the new image, including a virtual machine id or name, sas uri to a os disk blob, managed os disk id or name, or os snapshot id or name')
register_extra_cli_argument('image create', 'data_disk_sources', nargs='+',
                            help='space separated 1 or more data disk sources, including sas uri to a blob, managed disk id or name, or snapshot id or name')
register_cli_argument('image create', 'source_virtual_machine', ignore_type)
register_cli_argument('image create', 'os_blob_uri', ignore_type)
register_cli_argument('image create', 'os_disk', ignore_type)
register_cli_argument('image create', 'os_snapshot', ignore_type)
register_cli_argument('image create', 'data_blob_uris', ignore_type)
register_cli_argument('image create', 'data_disks', ignore_type)
register_cli_argument('image create', 'data_snapshots', ignore_type)

for scope in ['disk', 'snapshot']:
    register_extra_cli_argument(scope + ' create', 'source', validator=process_disk_or_snapshot_create_namespace,
                                help='source to create the disk from, including a sas uri to a blob, managed disk id or name, or snapshot id or name')
    register_cli_argument(scope, 'source_blob_uri', ignore_type)
    register_cli_argument(scope, 'source_disk', ignore_type)
예제 #28
0
register_cli_argument('acs', 'name', arg_type=name_arg_type)
register_cli_argument('acs', 'orchestrator_type',
                      **enum_choice_list(ContainerServiceOchestratorTypes))
#some admin names are prohibited in acs, such as root, admin, etc. Because we have no control on the orchestrators, so default to a safe name.
register_cli_argument('acs',
                      'admin_username',
                      options_list=('--admin-username', ),
                      default='azureuser',
                      required=False)
register_cli_argument('acs',
                      'dns_name_prefix',
                      options_list=('--dns-prefix', '-d'))
register_extra_cli_argument(
    'acs create',
    'generate_ssh_keys',
    action='store_true',
    help='Generate SSH public and private key files if missing')
register_cli_argument('acs',
                      'container_service_name',
                      options_list=('--name', '-n'),
                      help='The name of the container service',
                      completer=get_resource_name_completion_list(
                          'Microsoft.ContainerService/ContainerServices'))
register_cli_argument('acs create',
                      'agent_vm_size',
                      completer=get_vm_size_completion_list)
register_cli_argument('acs scale',
                      'new_agent_count',
                      type=int,
                      help='The number of agents for the cluster')
예제 #29
0
 def reg_extra_arg(self, *args, **kwargs):
     return register_extra_cli_argument(self._scope, *args, **kwargs)
예제 #30
0
                                 'Microsoft.Network/publicIPAddresses')
    register_folded_cli_argument(scope,
                                 'storage_account',
                                 'Microsoft.Storage/storageAccounts',
                                 validator=_find_default_storage_account,
                                 none_flag_value=None,
                                 default_value_flag='existingId')
    register_folded_cli_argument(scope,
                                 'virtual_network',
                                 'Microsoft.Network/virtualNetworks',
                                 options_list=('--vnet', ),
                                 validator=_find_default_vnet,
                                 none_flag_value=None,
                                 default_value_flag='existingId')
    register_folded_cli_argument(scope,
                                 'network_security_group',
                                 'Microsoft.Network/networkSecurityGroups',
                                 options_list=('--nsg', ))
    register_folded_cli_argument(scope, 'load_balancer',
                                 'Microsoft.Network/loadBalancers')
    register_cli_argument(scope,
                          'network_security_group_rule',
                          nsg_rule_type,
                          options_list=('--nsg-rule', ))
    register_extra_cli_argument(scope,
                                'image',
                                options_list=('--image', ),
                                action=VMImageFieldAction,
                                completer=get_urn_aliases_completion_list,
                                required=True)
예제 #31
0
def register_content_settings_argument(scope,
                                       settings_class,
                                       update,
                                       arg_group=None):
    register_cli_argument(scope,
                          'content_settings',
                          ignore_type,
                          validator=get_content_setting_validator(
                              settings_class, update),
                          arg_group=arg_group)
    register_extra_cli_argument(scope,
                                'content_type',
                                default=None,
                                help='The content MIME type.',
                                arg_group=arg_group)
    register_extra_cli_argument(scope,
                                'content_encoding',
                                default=None,
                                help='The content encoding type.',
                                arg_group=arg_group)
    register_extra_cli_argument(scope,
                                'content_language',
                                default=None,
                                help='The content language.',
                                arg_group=arg_group)
    register_extra_cli_argument(
        scope,
        'content_disposition',
        default=None,
        help=
        'Conveys additional information about how to process the response payload, and can also be used to attach additional metadata.',
        arg_group=arg_group)
    register_extra_cli_argument(scope,
                                'content_cache_control',
                                default=None,
                                help='The cache control string.',
                                arg_group=arg_group)
    register_extra_cli_argument(scope,
                                'content_md5',
                                default=None,
                                help='The content\'s MD5 hash.',
                                arg_group=arg_group)
예제 #32
0
               help='The type of the server key',
               **enum_choice_list(ServerKeyType))


#####
#           sql server vnet-rule
#####


with ParametersContext(command='sql server vnet-rule') as c:
    # Help text needs to be specified because 'sql server vnet-rule create' is a custom
    # command.
    c.argument('server_name',
               options_list=('--server', '-s'), completer=get_resource_name_completion_list('Microsoft.SQL/servers'))

    c.argument('virtual_network_rule_name',
               options_list=('--name', '-n'))

    c.argument('virtual_network_subnet_id',
               options_list=('--subnet'),
               help='Name or ID of the subnet that allows access to an Azure Sql Server. '
               'If subnet name is provided, --vnet-name must be provided.')

    c.argument('ignore_missing_vnet_service_endpoint',
               options_list=('--ignore-missing-endpoint', '-i'),
               help='Create firewall rule before the virtual network has vnet service endpoint enabled',
               **three_state_flag())

register_extra_cli_argument('sql server vnet-rule create', 'vnet_name', options_list=('--vnet-name'),
                            help='The virtual network name', validator=validate_subnet)
예제 #33
0
 def reg_extra_arg(self, *args, **kwargs):
     return register_extra_cli_argument(self._scope, *args, **kwargs)
예제 #34
0
    options_list=('--type', '-t'),
    validator=validate_blob_type,
    **enum_choice_list(blob_types.keys()))
register_cli_argument(
    'storage blob upload',
    'maxsize_condition',
    help='The max length in bytes permitted for an append blob.')
register_cli_argument(
    'storage blob upload',
    'validate_content',
    help=
    'Specifies that an MD5 hash shall be calculated for each chunk of the blob and verified by the service when the chunk has arrived.'
)
# TODO: Remove once #807 is complete. Smart Create Generation requires this parameter.
register_extra_cli_argument('storage blob upload',
                            '_subscription_id',
                            options_list=('--subscription', ),
                            help=argparse.SUPPRESS)

# BLOB DOWNLOAD-BATCH PARAMETERS
register_cli_argument('storage blob download-batch',
                      'destination',
                      options_list=('--destination', '-d'))
register_cli_argument('storage blob download-batch',
                      'source',
                      options_list=('--source', '-s'),
                      validator=process_blob_download_batch_parameters)

register_cli_argument('storage blob download-batch', 'source_container_name',
                      ignore_type)

# BLOB UPLOAD-BATCH PARAMETERS
예제 #35
0
    arg_group="Pool: Virtual Machine Configuration",
    help=
    "OS image URN in 'publisher:offer:sku[:version]' format. Version is optional and if omitted latest will be used.\n\tValues from 'az batch pool node-agent-skus list'.\n\tExample: 'MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest'"
)
register_cli_argument(
    'batch pool create',
    'account_name',
    arg_group='Batch Account',
    validator=validate_client_parameters,
    help=
    'The Batch account name. Alternatively, set by environment variable: AZURE_BATCH_ACCOUNT'
)
register_extra_cli_argument(
    'batch pool create',
    'account_key',
    arg_group='Batch Account',
    help=
    'The Batch account key. Alternatively, set by environment variable: AZURE_BATCH_ACCESS_KEY'
)
register_cli_argument(
    'batch pool create',
    'account_endpoint',
    arg_group='Batch Account',
    help=
    'Batch service endpoint. Alternatively, set by environment variable: AZURE_BATCH_ENDPOINT'
)

register_cli_argument(
    'batch job create',
    'account_name',
    arg_group='Batch Account',
예제 #36
0
    register_cli_argument('storage account show-connection-string', '{}_endpoint'.format(item), help='Custom endpoint for {}s.'.format(item))

register_cli_argument('storage account create', 'account_name', account_name_type, options_list=('--name', '-n'), completer=None)

register_cli_argument('storage account create', 'kind', help='Indicates the type of storage account. (Storage, BlobStorage)', completer=get_enum_type_completion_list(Kind))
register_cli_argument('storage account create', 'tags', tags_type)

for item in ['create', 'update']:
    register_cli_argument('storage account {}'.format(item), 'sku', help='The storage account SKU. (Standard_LRS, Standard_GRS, Standard_RAGRS, Standard_ZRS, Premium_LRS)', completer=get_enum_type_completion_list(SkuName))
    register_cli_argument('storage account {}'.format(item), 'encryption', nargs='+', help='Specifies which service(s) to encrypt.', choices=list(EncryptionServices._attribute_map.keys()), validator=validate_encryption) # pylint: disable=protected-access

register_cli_argument('storage account create', 'access_tier', help='Required for StandardBlob accounts. The access tier used for billing. Cannot be set for StandardLRS, StandardGRS, StandardRAGRS, or PremiumLRS account types. (Hot, Cool)', completer=get_enum_type_completion_list(AccessTier))
register_cli_argument('storage account update', 'access_tier', help='The access tier used for billing StandardBlob accounts. Cannot be set for StandardLRS, StandardGRS, StandardRAGRS, or PremiumLRS account types. (Hot, Cool)', completer=get_enum_type_completion_list(AccessTier))
register_cli_argument('storage account create', 'custom_domain', help='User domain assigned to the storage account. Name is the CNAME source.', validator=validate_custom_domain)
register_cli_argument('storage account update', 'custom_domain', help='User domain assigned to the storage account. Name is the CNAME source. Use "" to clear existing value.', validator=validate_custom_domain)
register_extra_cli_argument('storage account create', 'subdomain', options_list=('--use-subdomain',), help='Specify to enable indirect CNAME validation.', action='store_true')
register_extra_cli_argument('storage account update', 'subdomain', options_list=('--use-subdomain',), help='Specify whether to use indirect CNAME validation.', choices=['true', 'false'], default=None)

register_cli_argument('storage account update', 'tags', tags_type, default=None)

register_cli_argument('storage account keys renew', 'key_name', options_list=('--key',), help='The key to regenerate.', choices=list(storage_account_key_options.keys()), validator=validate_key, type=str.lower)
register_cli_argument('storage account keys renew', 'account_name', account_name_type, id_part=None)

register_cli_argument('storage blob', 'blob_name', blob_name_type, options_list=('--name', '-n'))

for item in ['container', 'blob']:
    register_cli_argument('storage {} lease'.format(item), 'lease_duration', type=int)
    register_cli_argument('storage {} lease'.format(item), 'lease_break_period', type=int)

register_cli_argument('storage blob lease', 'blob_name', blob_name_type)
예제 #37
0
register_cli_argument('storage blob list', 'include', help='Specifies additional datasets to include: (c)opy-info, (m)etadata, (s)napshots. Can be combined.', validator=validate_included_datasets)

for item in ['download', 'upload']:
    register_cli_argument('storage blob {}'.format(item), 'file_path', options_list=('--file', '-f'), type=file_type, completer=FilesCompleter())
    register_cli_argument('storage blob {}'.format(item), 'max_connections', type=int)
    register_cli_argument('storage blob {}'.format(item), 'validate_content', action='store_true')

for item in ['update', 'upload', 'upload-batch']:
    register_content_settings_argument('storage blob {}'.format(item), BlobContentSettings, item == 'update')

register_cli_argument('storage blob upload', 'blob_type', help="Defaults to 'page' for *.vhd files, or 'block' otherwise.", options_list=('--type', '-t'), validator=validate_blob_type, **enum_choice_list(blob_types.keys()))
register_cli_argument('storage blob upload', 'maxsize_condition', help='The max length in bytes permitted for an append blob.')
register_cli_argument('storage blob upload', 'validate_content', help='Specifies that an MD5 hash shall be calculated for each chunk of the blob and verified by the service when the chunk has arrived.')
# TODO: Remove once #807 is complete. Smart Create Generation requires this parameter.
register_extra_cli_argument('storage blob upload', '_subscription_id', options_list=('--subscription',), help=argparse.SUPPRESS)

# BLOB DOWNLOAD-BATCH PARAMETERS
register_cli_argument('storage blob download-batch', 'destination', options_list=('--destination', '-d'))
register_cli_argument('storage blob download-batch', 'source', options_list=('--source', '-s'),
                      validator=process_blob_download_batch_parameters)

register_cli_argument('storage blob download-batch', 'source_container_name', ignore_type)

# BLOB UPLOAD-BATCH PARAMETERS
register_cli_argument('storage blob upload-batch', 'destination', options_list=('--destination', '-d'))
register_cli_argument('storage blob upload-batch', 'source', options_list=('--source', '-s'),
                      validator=process_blob_upload_batch_parameters)

register_cli_argument('storage blob upload-batch', 'source_files', ignore_type)
register_cli_argument('storage blob upload-batch', 'destination_container_name', ignore_type)
예제 #38
0
def register_source_uri_arguments(scope):
    register_cli_argument(scope, 'copy_source', options_list=('--source-uri', '-u'), validator=validate_source_uri, required=False, arg_group='Copy Source')
    register_extra_cli_argument(scope, 'source_sas', default=None, help='The shared access signature for the source storage account.', arg_group='Copy Source')
    register_extra_cli_argument(scope, 'source_share', default=None, help='The share name for the source storage account.', arg_group='Copy Source')
    register_extra_cli_argument(scope, 'source_path', default=None, help='The file path for the source storage account.', arg_group='Copy Source')
    register_extra_cli_argument(scope, 'source_container', default=None, help='The container name for the source storage account.', arg_group='Copy Source')
    register_extra_cli_argument(scope, 'source_blob', default=None, help='The blob name for the source storage account.', arg_group='Copy Source')
    register_extra_cli_argument(scope, 'source_snapshot', default=None, help='The blob snapshot for the source storage account.', arg_group='Copy Source')
예제 #39
0
    register_cli_argument('storage account show-connection-string', '{}_endpoint'.format(item), help='Custom endpoint for {}s.'.format(item))

register_cli_argument('storage account create', 'account_name', account_name_type, options_list=('--name', '-n'), completer=None)

register_cli_argument('storage account create', 'kind', help='Indicates the type of storage account.', **enum_choice_list(Kind))
register_cli_argument('storage account create', 'tags', tags_type)

for item in ['create', 'update']:
    register_cli_argument('storage account {}'.format(item), 'sku', help='The storage account SKU.', **enum_choice_list(SkuName))
    register_cli_argument('storage account {}'.format(item), 'encryption', nargs='+', help='Specifies which service(s) to encrypt.', validator=validate_encryption, **enum_choice_list(list(EncryptionServices._attribute_map.keys()))) # pylint: disable=protected-access

register_cli_argument('storage account create', 'access_tier', help='Required for StandardBlob accounts. The access tier used for billing. Cannot be set for StandardLRS, StandardGRS, StandardRAGRS, or PremiumLRS account types.', **enum_choice_list(AccessTier))
register_cli_argument('storage account update', 'access_tier', help='The access tier used for billing StandardBlob accounts. Cannot be set for StandardLRS, StandardGRS, StandardRAGRS, or PremiumLRS account types.', **enum_choice_list(AccessTier))
register_cli_argument('storage account create', 'custom_domain', help='User domain assigned to the storage account. Name is the CNAME source.', validator=validate_custom_domain)
register_cli_argument('storage account update', 'custom_domain', help='User domain assigned to the storage account. Name is the CNAME source. Use "" to clear existing value.', validator=validate_custom_domain)
register_extra_cli_argument('storage account create', 'subdomain', options_list=('--use-subdomain',), help='Specify to enable indirect CNAME validation.', action='store_true')
register_extra_cli_argument('storage account update', 'subdomain', options_list=('--use-subdomain',), help='Specify whether to use indirect CNAME validation.', default=None, **enum_choice_list(['true', 'false']))

register_cli_argument('storage account update', 'tags', tags_type, default=None)

register_cli_argument('storage account keys renew', 'key_name', options_list=('--key',), help='The key to regenerate.', validator=validate_key, **enum_choice_list(list(storage_account_key_options.keys())))
register_cli_argument('storage account keys renew', 'account_name', account_name_type, id_part=None)

register_cli_argument('storage blob', 'blob_name', blob_name_type, options_list=('--name', '-n'))

for item in ['container', 'blob']:
    register_cli_argument('storage {} lease'.format(item), 'lease_duration', type=int)
    register_cli_argument('storage {} lease'.format(item), 'lease_break_period', type=int)

register_cli_argument('storage blob lease', 'blob_name', blob_name_type)
예제 #40
0
    **enum_choice_list(AccessTier))
register_cli_argument(
    'storage account create',
    'custom_domain',
    help=
    'User domain assigned to the storage account. Name is the CNAME source.',
    validator=validate_custom_domain)
register_cli_argument(
    'storage account update',
    'custom_domain',
    help=
    'User domain assigned to the storage account. Name is the CNAME source. Use "" to clear existing value.',
    validator=validate_custom_domain)
register_extra_cli_argument(
    'storage account create',
    'subdomain',
    options_list=('--use-subdomain', ),
    help='Specify to enable indirect CNAME validation.',
    action='store_true')
register_extra_cli_argument(
    'storage account update',
    'subdomain',
    options_list=('--use-subdomain', ),
    help='Specify whether to use indirect CNAME validation.',
    default=None,
    **enum_choice_list(['true', 'false']))

register_cli_argument('storage account update',
                      'tags',
                      tags_type,
                      default=None)
예제 #41
0
register_cli_argument('acs', 'name', arg_type=name_arg_type, configured_default='acs',
                      help="ACS cluster name. You can configure the default using `az configure --defaults acs=<name>`",
                      completer=get_resource_name_completion_list('Microsoft.ContainerService/ContainerServices'))

register_cli_argument('acs', 'resource_group', arg_type=resource_group_name_type)

register_cli_argument('acs', 'orchestrator_type', options_list=('--orchestrator-type', '-t'), **enum_choice_list(ContainerServiceOchestratorTypes))
# some admin names are prohibited in acs, such as root, admin, etc. Because we have no control on the orchestrators, so default to a safe name.
register_cli_argument('acs', 'admin_username', options_list=('--admin-username',), default='azureuser', required=False)
register_cli_argument('acs', 'dns_name_prefix', options_list=('--dns-prefix', '-d'))
register_cli_argument('acs', 'container_service_name', options_list=('--name', '-n'), help='The name of the container service', completer=get_resource_name_completion_list('Microsoft.ContainerService/ContainerServices'))

register_cli_argument('acs', 'ssh_key_value', required=False, help='SSH key file value or key file path.', type=file_type, default=os.path.join('~', '.ssh', 'id_rsa.pub'), completer=FilesCompleter())
register_cli_argument('acs create', 'name', arg_type=name_arg_type, validator=validate_ssh_key)

register_extra_cli_argument('acs create', 'generate_ssh_keys', action='store_true', help='Generate SSH public and private key files if missing')
register_cli_argument('acs create', 'agent_vm_size', completer=get_vm_size_completion_list)

register_cli_argument('acs create', 'windows', action='store_true', help='If true, deploy a windows container cluster.')
register_cli_argument('acs create', 'validate', action='store_true', help='Generate and validate the ARM template without creating any resources')


register_cli_argument('acs', 'disable_browser', help='Do not open browser after opening a proxy to the cluster web user interface')
register_cli_argument('acs dcos browse', 'name', name_arg_type)
register_cli_argument('acs dcos install-cli', 'install_location',
                      options_list=('--install-location',),
                      default=_get_default_install_location('dcos'))
register_cli_argument('acs kubernetes install-cli', 'install_location',
                      options_list=('--install-location',),
                      default=_get_default_install_location('kubectl'))
예제 #42
0
def register_source_uri_arguments(scope):
    register_cli_argument(scope,
                          'copy_source',
                          options_list=('--source-uri', '-u'),
                          validator=validate_source_uri,
                          required=False,
                          arg_group='Copy Source')
    register_extra_cli_argument(
        scope,
        'source_sas',
        default=None,
        help='The shared access signature for the source storage account.',
        arg_group='Copy Source')
    register_extra_cli_argument(
        scope,
        'source_share',
        default=None,
        help='The share name for the source storage account.',
        arg_group='Copy Source')
    register_extra_cli_argument(
        scope,
        'source_path',
        default=None,
        help='The file path for the source storage account.',
        arg_group='Copy Source')
    register_extra_cli_argument(
        scope,
        'source_container',
        default=None,
        help='The container name for the source storage account.',
        arg_group='Copy Source')
    register_extra_cli_argument(
        scope,
        'source_blob',
        default=None,
        help='The blob name for the source storage account.',
        arg_group='Copy Source')
    register_extra_cli_argument(
        scope,
        'source_snapshot',
        default=None,
        help='The blob snapshot for the source storage account.',
        arg_group='Copy Source')
예제 #43
0
register_attributes_argument('keyvault secret set',
                             'secret',
                             SecretAttributes,
                             create=True)
register_cli_argument(
    'keyvault secret set',
    'value',
    options_list=('--value', ),
    help=
    "Plain text secret value. Cannot be used with '--file' or '--encoding'",
    required=False,
    arg_group='Content Source')
register_extra_cli_argument(
    'keyvault secret set',
    'file_path',
    options_list=('--file', '-f'),
    type=file_type,
    help="Source file for secret. Use in conjunction with '--encoding'",
    completer=FilesCompleter(),
    arg_group='Content Source')
register_extra_cli_argument(
    'keyvault secret set',
    'encoding',
    options_list=('--encoding', '-e'),
    help=
    'Source file encoding. The value is saved as a tag (`file-encoding=<val>`) and used during download to automtically encode the resulting file.',
    default='utf-8',
    validator=process_secret_set_namespace,
    arg_group='Content Source',
    **enum_choice_list(secret_encoding_values))

register_attributes_argument('keyvault secret set-attributes', 'secret',
예제 #44
0
register_cli_argument('vm disk', 'caching', help='Host caching policy', default=CachingTypes.none.value, **enum_choice_list(CachingTypes))

for item in ['attach-existing', 'attach-new', 'detach']:
    register_cli_argument('vm disk {}'.format(item), 'vm_name', arg_type=existing_vm_name, options_list=('--vm-name',), id_part=None)

register_cli_argument('vm availability-set', 'availability_set_name', name_arg_type, completer=get_resource_name_completion_list('Microsoft.Compute/availabilitySets'), help='Name of the availability set')

register_cli_argument('vm access', 'username', options_list=('--username', '-u'), help='The user name')
register_cli_argument('vm access', 'password', options_list=('--password', '-p'), help='The user password')

register_cli_argument('acs', 'name', arg_type=name_arg_type)
register_cli_argument('acs', 'orchestrator_type', **enum_choice_list(ContainerServiceOchestratorTypes))
# some admin names are prohibited in acs, such as root, admin, etc. Because we have no control on the orchestrators, so default to a safe name.
register_cli_argument('acs', 'admin_username', options_list=('--admin-username',), default='azureuser', required=False)
register_cli_argument('acs', 'dns_name_prefix', options_list=('--dns-prefix', '-d'))
register_extra_cli_argument('acs create', 'generate_ssh_keys', action='store_true', help='Generate SSH public and private key files if missing')
register_cli_argument('acs', 'container_service_name', options_list=('--name', '-n'), help='The name of the container service', completer=get_resource_name_completion_list('Microsoft.ContainerService/ContainerServices'))
register_cli_argument('acs create', 'agent_vm_size', completer=get_vm_size_completion_list)
register_cli_argument('acs scale', 'new_agent_count', type=int, help='The number of agents for the cluster')
register_cli_argument('acs create', 'service_principal', help='Service principal for making calls into Azure APIs')
register_cli_argument('acs create', 'client_secret', help='Client secret to use with the service principal for making calls to Azure APIs')

register_cli_argument('vm capture', 'overwrite', action='store_true')

register_cli_argument('vm diagnostics', 'vm_name', arg_type=existing_vm_name, options_list=('--vm-name',))
register_cli_argument('vm diagnostics set', 'storage_account', completer=get_resource_name_completion_list('Microsoft.Storage/storageAccounts'))

register_cli_argument('vm extension', 'vm_extension_name', name_arg_type, completer=get_resource_name_completion_list('Microsoft.Compute/virtualMachines/extensions'), id_part='child_name')
register_cli_argument('vm extension', 'vm_name', arg_type=existing_vm_name, options_list=('--vm-name',), id_part='name')

register_cli_argument('vm extension image', 'image_location', options_list=('--location', '-l'))
예제 #45
0
 def extra(self, argument_name, **kwargs):
     from azure.cli.core.commands import register_extra_cli_argument
     register_extra_cli_argument(self._commmand, argument_name, **kwargs)