Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
18 changes: 17 additions & 1 deletion sdk/storage/azure-storage-blob/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,25 @@

## Version 12.0.0b2:

- Added async APIs to subnamespace `azure.storage.blob.aio`.
**Breaking changes**
- Renamed `copy_blob_from_url` to `start_copy_from_url` and changed behaviour to return a dictionary of copy properties rather than a polling object. Status of the copy operation can be retrieved with the `get_blob_properties` operation.
- Added `abort_copy` operation to the `BlobClient` class. This replaces the previous abort operation on the copy status polling operation.
- The behavior of listing operations has been modified:
- The previous `marker` parameter has been removed.
- The iterable response object now supports a `by_page` function that will return a secondary iterator of batches of results. This function supports a `continuation_token` parameter to replace the previous `marker` parameter.
- Some parameters have become keyword only, rather than positional. Some examples include:
- `timeout`
- `lease`
- `encoding`
- Modification conditions, e.g. `if_modified_since`, `if_match` , `maxsize_condition`, etc

**New features**
- Added async APIs to subnamespace `azure.storage.blob.aio`.
- Distributed tracing framework OpenCensus is now supported.

**Fixes and improvements**
- Fix for SAS URL encoding (#6500)
- General refactor of duplicate and shared code.


## Version 12.0.0b1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# license information.
# --------------------------------------------------------------------------

VERSION = "12.0.0b1"
VERSION = "12.0.0b2"
13 changes: 9 additions & 4 deletions sdk/storage/azure-storage-blob/tests/test_blob_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import platform

from azure.storage.blob import (
VERSION,
BlobServiceClient,
ContainerClient,
BlobClient,
Expand Down Expand Up @@ -396,7 +397,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"azsdk-python-storage-blob/12.0.0b1 Python/{} ({})".format(
"azsdk-python-storage-blob/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand All @@ -412,7 +414,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"TestApp/v1.0 azsdk-python-storage-blob/12.0.0b1 Python/{} ({})".format(
"TestApp/v1.0 azsdk-python-storage-blob/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand All @@ -422,7 +425,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"TestApp/v2.0 azsdk-python-storage-blob/12.0.0b1 Python/{} ({})".format(
"TestApp/v2.0 azsdk-python-storage-blob/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand All @@ -436,7 +440,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"azsdk-python-storage-blob/12.0.0b1 Python/{} ({}) customer_user_agent".format(
"azsdk-python-storage-blob/{} Python/{} ({}) customer_user_agent".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand Down
13 changes: 9 additions & 4 deletions sdk/storage/azure-storage-blob/tests/test_blob_client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import platform
import asyncio

from azure.storage.blob import VERSION
from azure.storage.blob.aio import (
BlobServiceClient,
ContainerClient,
Expand Down Expand Up @@ -418,7 +419,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"azsdk-python-storage-blob/12.0.0b1 Python/{} ({})".format(
"azsdk-python-storage-blob/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand All @@ -438,7 +440,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"TestApp/v1.0 azsdk-python-storage-blob/12.0.0b1 Python/{} ({})".format(
"TestApp/v1.0 azsdk-python-storage-blob/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand All @@ -448,7 +451,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"TestApp/v2.0 azsdk-python-storage-blob/12.0.0b1 Python/{} ({})".format(
"TestApp/v2.0 azsdk-python-storage-blob/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand All @@ -466,7 +470,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"azsdk-python-storage-blob/12.0.0b1 Python/{} ({}) customer_user_agent".format(
"azsdk-python-storage-blob/{} Python/{} ({}) customer_user_agent".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand Down
22 changes: 22 additions & 0 deletions sdk/storage/azure-storage-file/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Change Log azure-storage-file


## Version 12.0.0b2:

**Breaking changes**
- Renamed `copy_file_from_url` to `start_copy_from_url` and changed behaviour to return a dictionary of copy properties rather than a polling object. Status of the copy operation can be retrieved with the `get_file_properties` operation.
- Added `abort_copy` operation to the `FileClient` class. This replaces the previous abort operation on the copy status polling operation.
- The behavior of listing operations has been modified:
- The previous `marker` parameter has been removed.
- The iterable response object now supports a `by_page` function that will return a secondary iterator of batches of results. This function supports a `continuation_token` parameter to replace the previous `marker` parameter.
- The new listing behaviour is also adopted by the `receive_messages` operation:
- The receive operation returns a message iterator as before.
- The returned iterator supports a `by_page` operation to receive messages in batches.

**New features**
- Added async APIs to subnamespace `azure.storage.file.aio`.
- Distributed tracing framework OpenCensus is now supported.

**Fixes and improvements**
- Fix for closing file handles - continuation token was not being passed to subsequent calls.
- General refactor of duplicate and shared code.


## Version 12.0.0b1:

Version 12.0.0b1 is the first preview of our efforts to create a user-friendly and Pythonic client library for Azure Storage Files. For more information about this, and preview releases of other Azure SDK libraries, please visit
Expand Down
12 changes: 6 additions & 6 deletions sdk/storage/azure-storage-file/azure/storage/file/_polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ class CloseHandles(PollingMethod):

def __init__(self, interval):
self._command = None
self._status = None
self._continuation_token = None
self._exception = None
self.handles_closed = 0
self.polling_interval = interval

def _update_status(self):
try:
status = self._command() # pylint: disable=protected-access
status = self._command(marker=self._continuation_token)
except StorageErrorException as error:
process_storage_error(error)
self._status = status.get('marker')
self.handles_closed += status['number_of_handles_closed']
self._continuation_token = status.get('marker')
self.handles_closed += status.get('number_of_handles_closed') or 0

def initialize(self, command, initial_status, _): # pylint: disable=arguments-differ
# type: (Any, Any, Callable) -> None
self._command = command
self._status = initial_status['marker']
self._continuation_token = initial_status['marker']
self.handles_closed = initial_status['number_of_handles_closed']

def run(self):
Expand All @@ -57,7 +57,7 @@ def finished(self):
"""Is this polling finished?
:rtype: bool
"""
return self._status is None
return self._continuation_token is None

def resource(self):
# type: () -> Any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ class CloseHandlesAsync(AsyncPollingMethod):

def __init__(self, interval):
self._command = None
self._status = None
self._continuation_token = None
self._exception = None
self.handles_closed = 0
self.polling_interval = interval

async def _update_status(self):
try:
status = await self._command() # pylint: disable=protected-access
status = await self._command(marker=self._continuation_token)
except StorageErrorException as error:
process_storage_error(error)
self._status = status.get('marker')
self.handles_closed += status['number_of_handles_closed']
self._continuation_token = status.get('marker')
self.handles_closed += status.get('number_of_handles_closed') or 0

def initialize(self, command, initial_status, _): # pylint: disable=arguments-differ
# type: (Any, Any, Callable) -> None
self._command = command
self._status = initial_status['marker']
self._continuation_token = initial_status['marker']
self.handles_closed = initial_status['number_of_handles_closed']

async def run(self):
Expand All @@ -57,7 +57,7 @@ def finished(self):
"""Is this polling finished?
:rtype: bool
"""
return self._status is None
return self._continuation_token is None

def resource(self):
# type: () -> Any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# license information.
# --------------------------------------------------------------------------

VERSION = '12.0.0b1'
VERSION = '12.0.0b2'
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-file/tests/test_file_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def setUp(self):
self.fsc2 = FileServiceClient(remote_url, credential=remote_credential, transport=AiohttpTestTransport())
self.remote_share_name = None
loop = asyncio.get_event_loop()
loop.run_until_complete(self.fsc.__aenter__())
loop.run_until_complete(self.fsc2.__aenter__())

def tearDown(self):
if not self.is_playback():
Expand Down
29 changes: 17 additions & 12 deletions sdk/storage/azure-storage-file/tests/test_file_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import platform

from azure.storage.file import (
VERSION,
FileServiceClient,
ShareClient,
DirectoryClient,
Expand Down Expand Up @@ -134,7 +135,7 @@ def test_create_service_missing_arguments(self):
for service_type in SERVICES:
# Act
with self.assertRaises(ValueError):
service = service_type(None)
service_type(None)

def test_create_service_with_socket_timeout(self):
# Arrange
Expand Down Expand Up @@ -204,11 +205,11 @@ def test_create_service_with_connection_string_endpoint_protocol(self):
def test_create_service_with_connection_string_emulated(self):
# Arrange
for service_type in SERVICES.items():
conn_string = 'UseDevelopmentStorage=true;'.format(self.account_name, self.account_key)
conn_string = 'UseDevelopmentStorage=true;'

# Act
with self.assertRaises(ValueError):
service = service_type[0].from_connection_string(
service_type[0].from_connection_string(
conn_string, share='foo', directory_path='bar', file_path='baz')

def test_create_service_with_connection_string_fails_if_secondary_without_primary(self):
Expand All @@ -221,7 +222,7 @@ def test_create_service_with_connection_string_fails_if_secondary_without_primar

# Fails if primary excluded
with self.assertRaises(ValueError):
service = service_type[0].from_connection_string(
service_type[0].from_connection_string(
conn_string, share='foo', directory_path='bar', file_path='baz')

def test_create_service_with_connection_string_succeeds_if_secondary_with_primary(self):
Expand Down Expand Up @@ -251,7 +252,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"azsdk-python-storage-file/12.0.0b1 Python/{} ({})".format(
"azsdk-python-storage-file/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand All @@ -263,25 +265,27 @@ def test_user_agent_custom(self):
service = FileServiceClient(
self.get_file_url(), credential=self.account_key, user_agent=custom_app)

def callback(response):
def callback1(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"TestApp/v1.0 azsdk-python-storage-file/12.0.0b1 Python/{} ({})".format(
"TestApp/v1.0 azsdk-python-storage-file/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

service.get_service_properties(raw_response_hook=callback)
service.get_service_properties(raw_response_hook=callback1)

def callback(response):
def callback2(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"TestApp/v2.0 azsdk-python-storage-file/12.0.0b1 Python/{} ({})".format(
"TestApp/v2.0 azsdk-python-storage-file/{} Python/{} ({})".format(
VERSION,
platform.python_version(),
platform.platform()))

service.get_service_properties(raw_response_hook=callback, user_agent="TestApp/v2.0")
service.get_service_properties(raw_response_hook=callback2, user_agent="TestApp/v2.0")

@record
def test_user_agent_append(self):
Expand All @@ -291,7 +295,8 @@ def callback(response):
self.assertTrue('User-Agent' in response.http_request.headers)
self.assertEqual(
response.http_request.headers['User-Agent'],
"azsdk-python-storage-file/12.0.0b1 Python/{} ({}) customer_user_agent".format(
"azsdk-python-storage-file/{} Python/{} ({}) customer_user_agent".format(
VERSION,
platform.python_version(),
platform.platform()))

Expand Down
Loading