|
23 | 23 | validate_fs_public_access, validate_logging_version, validate_or_policy, validate_policy,
|
24 | 24 | get_api_version_type, blob_download_file_path_validator, blob_tier_validator, validate_subnet,
|
25 | 25 | validate_immutability_arguments, validate_blob_name_for_upload, validate_share_close_handle,
|
26 |
| - add_upload_progress_callback, blob_tier_validator_track2) |
| 26 | + add_upload_progress_callback, blob_tier_validator_track2, add_download_progress_callback) |
27 | 27 |
|
28 | 28 |
|
29 | 29 | def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statements, too-many-lines, too-many-branches, line-too-long
|
@@ -247,6 +247,11 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
|
247 | 247 | public_network_access_enum = self.get_sdk('models._storage_management_client_enums#PublicNetworkAccess',
|
248 | 248 | resource_type=ResourceType.MGMT_STORAGE)
|
249 | 249 |
|
| 250 | + version_id_type = CLIArgumentType( |
| 251 | + help='An optional blob version ID. This parameter is only for versioning enabled account. ', |
| 252 | + min_api='2019-12-12', is_preview=True |
| 253 | + ) |
| 254 | + |
250 | 255 | with self.argument_context('storage') as c:
|
251 | 256 | c.argument('container_name', container_name_type)
|
252 | 257 | c.argument('directory_name', directory_type)
|
@@ -986,22 +991,45 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
|
986 | 991 | 'blob. If set overwrite=True, then the existing append blob will be deleted, and a new one created. '
|
987 | 992 | 'Defaults to False.')
|
988 | 993 |
|
989 |
| - with self.argument_context('storage blob download') as c: |
990 |
| - c.argument('file_path', options_list=('--file', '-f'), type=file_type, |
991 |
| - completer=FilesCompleter(), validator=blob_download_file_path_validator) |
992 |
| - c.argument('max_connections', type=int) |
993 |
| - c.argument('start_range', type=int) |
994 |
| - c.argument('end_range', type=int) |
995 |
| - c.argument('validate_content', action='store_true', min_api='2016-05-31') |
996 |
| - c.extra('no_progress', progress_type) |
| 994 | + with self.argument_context('storage blob download', resource_type=ResourceType.DATA_STORAGE_BLOB) as c: |
| 995 | + c.register_blob_arguments_track2() |
| 996 | + c.register_precondition_options() |
| 997 | + c.argument('file_path', options_list=('--file', '-f'), type=file_type, completer=FilesCompleter(), |
| 998 | + help='Path of file to write out to.', validator=blob_download_file_path_validator) |
| 999 | + c.argument('start_range', type=int, |
| 1000 | + help='Start of byte range to use for downloading a section of the blob. If no end_range is given, ' |
| 1001 | + 'all bytes after the start_range will be downloaded. The start_range and end_range params are ' |
| 1002 | + 'inclusive. Ex: start_range=0, end_range=511 will download first 512 bytes of blob.') |
| 1003 | + c.argument('end_range', type=int, |
| 1004 | + help='End of byte range to use for downloading a section of the blob. If end_range is given, ' |
| 1005 | + 'start_range must be provided. The start_range and end_range params are inclusive. ' |
| 1006 | + 'Ex: start_range=0, end_range=511 will download first 512 bytes of blob.') |
| 1007 | + c.extra('no_progress', progress_type, validator=add_download_progress_callback) |
| 1008 | + c.extra('snapshot', help='The snapshot parameter is an opaque DateTime value that, when present, ' |
| 1009 | + 'specifies the blob snapshot to retrieve.') |
| 1010 | + c.extra('lease', options_list=['--lease-id'], help='Required if the blob has an active lease.') |
| 1011 | + c.extra('version_id', version_id_type) |
| 1012 | + c.extra('max_concurrency', options_list=['--max-connections'], type=int, default=2, |
| 1013 | + help='The number of parallel connections with which to download.') |
| 1014 | + c.argument('open_mode', help='Mode to use when opening the file. Note that specifying append only open_mode ' |
| 1015 | + 'prevents parallel download. So, max_connections must be set to 1 ' |
| 1016 | + 'if this open_mode is used.') |
| 1017 | + c.extra('validate_content', action='store_true', min_api='2016-05-31', |
| 1018 | + help='If true, calculates an MD5 hash for each chunk of the blob. The storage service checks the ' |
| 1019 | + 'hash of the content that has arrived with the hash that was sent. This is primarily valuable for ' |
| 1020 | + 'detecting bitflips on the wire if using http instead of https, as https (the default), ' |
| 1021 | + 'will already validate. Note that this MD5 hash is not stored with the blob. Also note that ' |
| 1022 | + 'if enabled, the memory-efficient algorithm will not be used because computing the MD5 hash ' |
| 1023 | + 'requires buffering entire blocks, and doing so defeats the purpose of the memory-efficient ' |
| 1024 | + 'algorithm.') |
997 | 1025 |
|
998 | 1026 | with self.argument_context('storage blob download-batch') as c:
|
999 | 1027 | c.ignore('source_container_name')
|
1000 | 1028 | c.argument('destination', options_list=('--destination', '-d'))
|
1001 | 1029 | c.argument('source', options_list=('--source', '-s'))
|
1002 | 1030 | c.extra('no_progress', progress_type)
|
1003 |
| - c.argument('max_connections', type=int, |
1004 |
| - help='Maximum number of parallel connections to use when the blob size exceeds 64MB.') |
| 1031 | + c.extra('max_concurrency', options_list=['--max-connections'], type=int, default=2, |
| 1032 | + help='The number of parallel connections with which to download.') |
1005 | 1033 |
|
1006 | 1034 | with self.argument_context('storage blob delete') as c:
|
1007 | 1035 | from .sdkutil import get_delete_blob_snapshot_type_names
|
|
0 commit comments