Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[UploadPage]Adjust Stylistic Things
  • Loading branch information
xiafu-msft committed Sep 5, 2019
commit 336ee597d36b8098d47b9a7bb34a3aa281f53338
Original file line number Diff line number Diff line change
Expand Up @@ -1494,16 +1494,13 @@ async def upload_page( # type: ignore

@distributed_trace_async
async def upload_pages_from_url(self, source_url, # type: str
range_start,
range_end,
source_range_start,
source_content_md5=None,
source_if_modified_since=None,
source_if_unmodified_since=None, source_if_match=None, source_if_none_match=None,
lease=None, if_sequence_number_lte=None, if_sequence_number_lt=None,
if_sequence_number_eq=None, if_modified_since=None, if_unmodified_since=None,
if_match=None, if_none_match=None, timeout=None
):
range_start, # type: int
range_end, # type: int
source_range_start, # type: int
source_content_md5=None, # type: Optional[bytes]
**kwargs
):
# type: (...) -> Dict[str, Any]
"""
Updates a range of pages to a page blob where the contents are read from a URL.

Expand All @@ -1523,7 +1520,7 @@ async def upload_pages_from_url(self, source_url, # type: str
:param int source_range_start:
This indicates the start of the range of bytes(inclusive) that has to be taken from the copy source.
The service will read the same number of bytes as the destination range (end_range-start_range).
:param str source_content_md5:
:param bytes source_content_md5:
If given, the service will calculate the MD5 hash of the block content and compare against this value.
:param datetime source_if_modified_since:
A DateTime value. Azure expects the date value passed in to be UTC.
Expand Down Expand Up @@ -1578,11 +1575,6 @@ async def upload_pages_from_url(self, source_url, # type: str
the value specified. Specify the wildcard character (*) to perform
the operation only if the resource does not exist, and fail the
operation if it does exist.
:param ~azure.storage.blob.models.CustomerProvidedEncryptionKey cpk:
Encrypts the data on the service-side with the given key.
Use of customer-provided keys must be done over HTTPS.
As the encryption key itself is provided in the request,
a secure connection must be established to transfer the key.
:param int timeout:
The timeout parameter is expressed in seconds.
"""
Expand All @@ -1593,14 +1585,7 @@ async def upload_pages_from_url(self, source_url, # type: str
range_end,
source_range_start,
source_content_md5=source_content_md5,
lease=lease,
if_sequence_number_lte=if_sequence_number_lte, if_sequence_number_lt=if_sequence_number_lt,
if_sequence_number_eq=if_sequence_number_eq,
if_modified_since=if_modified_since,
if_unmodified_since=if_unmodified_since, if_match=if_match,
if_none_match=if_none_match, source_if_modified_since=source_if_modified_since,
source_if_unmodified_since=source_if_unmodified_since, source_if_match=source_if_match,
source_if_none_match=source_if_none_match, timeout=timeout
**kwargs
)
try:
return await self._client.page_blob.upload_pages_from_url(**options) # type: ignore
Expand Down
41 changes: 13 additions & 28 deletions sdk/storage/azure-storage-blob/azure/storage/blob/blob_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2270,10 +2270,10 @@ def upload_page( # type: ignore

def _upload_pages_from_url_options( # type: ignore
self, source_url, # type: str
range_start,
range_end,
source_range_start,
source_content_md5=None,
range_start, # type: int
range_end, # type: int
source_range_start, # type: int
source_content_md5=None, # type: Optional[bytes]
**kwargs
):
# type: (...) -> Dict[str, Any]
Expand Down Expand Up @@ -2314,7 +2314,7 @@ def _upload_pages_from_url_options( # type: ignore
'content_length': 0,
'source_range': source_range,
'range': destination_range,
'source_content_md5': source_content_md5,
'source_content_md5': bytearray(source_content_md5) if source_content_md5 else None,
'timeout': kwargs.pop('timeout', None),
'lease_access_conditions': access_conditions,
'sequence_number_access_conditions': seq_conditions,
Expand All @@ -2326,16 +2326,13 @@ def _upload_pages_from_url_options( # type: ignore

@distributed_trace
def upload_pages_from_url(self, source_url, # type: str
range_start,
range_end,
source_range_start,
source_content_md5=None,
source_if_modified_since=None,
source_if_unmodified_since=None, source_if_match=None, source_if_none_match=None,
lease=None, if_sequence_number_lte=None, if_sequence_number_lt=None,
if_sequence_number_eq=None, if_modified_since=None, if_unmodified_since=None,
if_match=None, if_none_match=None, timeout=None
range_start, # type: int
range_end, # type: int
source_range_start, # type: int
source_content_md5=None, # type: Optional[bytes]
**kwargs
):
# type: (...) -> Dict[str, Any]
"""
Updates a range of pages to a page blob where the contents are read from a URL.

Expand All @@ -2355,7 +2352,7 @@ def upload_pages_from_url(self, source_url, # type: str
:param int source_range_start:
This indicates the start of the range of bytes(inclusive) that has to be taken from the copy source.
The service will read the same number of bytes as the destination range (end_range-start_range).
:param str source_content_md5:
:param bytes source_content_md5:
If given, the service will calculate the MD5 hash of the block content and compare against this value.
:param datetime source_if_modified_since:
A DateTime value. Azure expects the date value passed in to be UTC.
Expand Down Expand Up @@ -2410,11 +2407,6 @@ def upload_pages_from_url(self, source_url, # type: str
the value specified. Specify the wildcard character (*) to perform
the operation only if the resource does not exist, and fail the
operation if it does exist.
:param ~azure.storage.blob.models.CustomerProvidedEncryptionKey cpk:
Encrypts the data on the service-side with the given key.
Use of customer-provided keys must be done over HTTPS.
As the encryption key itself is provided in the request,
a secure connection must be established to transfer the key.
:param int timeout:
The timeout parameter is expressed in seconds.
"""
Expand All @@ -2425,14 +2417,7 @@ def upload_pages_from_url(self, source_url, # type: str
range_end,
source_range_start,
source_content_md5=source_content_md5,
lease=lease,
if_sequence_number_lte=if_sequence_number_lte, if_sequence_number_lt=if_sequence_number_lt,
if_sequence_number_eq=if_sequence_number_eq,
if_modified_since=if_modified_since,
if_unmodified_since=if_unmodified_since, if_match=if_match,
if_none_match=if_none_match, source_if_modified_since=source_if_modified_since,
source_if_unmodified_since=source_if_unmodified_since, source_if_match=source_if_match,
source_if_none_match=source_if_none_match, timeout=timeout
**kwargs
)
try:
return self._client.page_blob.upload_pages_from_url(**options) # type: ignore
Expand Down