Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert STG79 #21317

Merged
merged 1 commit into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -1872,21 +1872,9 @@ def _start_copy_from_url_options(self, source_url, metadata=None, incremental_co

tier = kwargs.pop('premium_page_blob_tier', None) or kwargs.pop('standard_blob_tier', None)
requires_sync = kwargs.pop('requires_sync', None)
encryption_scope_str = kwargs.pop('encryption_scope', None)
source_authorization = kwargs.pop('source_authorization', None)

if not requires_sync and encryption_scope_str:
raise ValueError("Encryption_scope is only supported for sync copy, please specify requires_sync=True")
if source_authorization and incremental_copy:
raise ValueError("Source authorization tokens are not applicable for incremental copying.")
#
# TODO: refactor start_copy_from_url api in _blob_client.py. Call _generated/_blob_operations.py copy_from_url
# when requires_sync=True is set.
# Currently both sync copy and async copy are calling _generated/_blob_operations.py start_copy_from_url.
# As sync copy diverges more from async copy, more problem will surface.
if encryption_scope_str:
headers.update({'x-ms-encryption-scope': encryption_scope_str})

if requires_sync is True:
headers['x-ms-requires-sync'] = str(requires_sync)
if source_authorization:
Expand Down Expand Up @@ -2071,17 +2059,6 @@ def start_copy_from_url(self, source_url, metadata=None, incremental_copy=False,
Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is
the prefix of the source_authorization string. This option is only available when `incremental_copy` is
set to False and `requires_sync` is set to True.

.. versionadded:: 12.9.0

:keyword str encryption_scope:
A predefined encryption scope used to encrypt the data on the sync copied blob. An encryption
scope can be created using the Management API and referenced here by name. If a default
encryption scope has been defined at the container, this value will override it if the
container-level scope is configured to allow overrides. Otherwise an error will be raised.

.. versionadded:: 12.10.0

:returns: A dictionary of copy properties (etag, last_modified, copy_id, copy_status).
:rtype: dict[str, Union[str, ~datetime.datetime]]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(
super(AzureBlobStorageConfiguration, self).__init__(**kwargs)

self.url = url
self.version = "2020-12-06"
self.version = "2020-10-02"
kwargs.setdefault('sdk_moniker', 'azureblobstorage/{}'.format(VERSION))
self._configure(**kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(
super(AzureBlobStorageConfiguration, self).__init__(**kwargs)

self.url = url
self.version = "2020-12-06"
self.version = "2020-10-02"
kwargs.setdefault('sdk_moniker', 'azureblobstorage/{}'.format(VERSION))
self._configure(**kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2139,7 +2139,6 @@ async def copy_from_url(
source_modified_access_conditions: Optional["_models.SourceModifiedAccessConditions"] = None,
modified_access_conditions: Optional["_models.ModifiedAccessConditions"] = None,
lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
cpk_scope_info: Optional["_models.CpkScopeInfo"] = None,
**kwargs: Any
) -> None:
"""The Copy From URL operation copies a blob or an internet resource to a new blob. It will not
Expand Down Expand Up @@ -2189,8 +2188,6 @@ async def copy_from_url(
:type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions
:param lease_access_conditions: Parameter group.
:type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions
:param cpk_scope_info: Parameter group.
:type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
Expand All @@ -2212,9 +2209,6 @@ async def copy_from_url(
_if_none_match = None
_if_tags = None
_lease_id = None
_encryption_scope = None
if cpk_scope_info is not None:
_encryption_scope = cpk_scope_info.encryption_scope
if lease_access_conditions is not None:
_lease_id = lease_access_conditions.lease_id
if modified_access_conditions is not None:
Expand Down Expand Up @@ -2286,8 +2280,6 @@ async def copy_from_url(
header_parameters['x-ms-legal-hold'] = self._serialize.header("legal_hold", legal_hold, 'bool')
if copy_source_authorization is not None:
header_parameters['x-ms-copy-source-authorization'] = self._serialize.header("copy_source_authorization", copy_source_authorization, 'str')
if _encryption_scope is not None:
header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')

request = self._client.put(url, query_parameters, header_parameters)
Expand All @@ -2311,7 +2303,6 @@ async def copy_from_url(
response_headers['x-ms-copy-status']=self._deserialize('str', response.headers.get('x-ms-copy-status'))
response_headers['Content-MD5']=self._deserialize('bytearray', response.headers.get('Content-MD5'))
response_headers['x-ms-content-crc64']=self._deserialize('bytearray', response.headers.get('x-ms-content-crc64'))
response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope'))

if cls:
return cls(pipeline_response, None, response_headers)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@ async def submit_batch(
content_type = kwargs.pop("content_type", "application/xml")
accept = "application/xml"

multipart_content_type = kwargs.pop("content_type", None)
# Construct URL
url = self.submit_batch.metadata['url'] # type: ignore
path_format_arguments = {
Expand All @@ -854,7 +855,7 @@ async def submit_batch(
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')

body_content_kwargs = {} # type: Dict[str, Any]
body_content = self._serialize.body(body, 'IO', is_xml=True)
body_content = self._serialize.body(body, 'IO')
body_content_kwargs['content'] = body_content
request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs)
Expand Down
Loading