Skip to content

Commit

Permalink
disable undelete_container
Browse files Browse the repository at this point in the history
  • Loading branch information
xiafu-msft committed Jun 30, 2020
1 parent 6ef5915 commit 6310cbc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,6 @@ def list_containers(
:param bool include_metadata:
Specifies that container metadata to be returned in the response.
The default value is `False`.
:keyword bool include_deleted:
Specifies that deleted containers to be returned in the response. This is for container restore enabled
account. The default value is `False`.
.. versionadded:: 12.4.0
:keyword int results_per_page:
The maximum number of container names to retrieve per API
call. If the request does not specify the server will return up to 5,000 items.
Expand All @@ -407,9 +401,6 @@ def list_containers(
:caption: Listing the containers in the blob service.
"""
include = ['metadata'] if include_metadata else []
include_deleted = kwargs.pop('include_deleted', None)
if include_deleted:
include.append("deleted")

timeout = kwargs.pop('timeout', None)
results_per_page = kwargs.pop('results_per_page', None)
Expand Down Expand Up @@ -566,7 +557,7 @@ def delete_container(
**kwargs)

@distributed_trace
def undelete_container(self, deleted_container_name, deleted_container_version, new_name=None, **kwargs):
def _undelete_container(self, deleted_container_name, deleted_container_version, new_name=None, **kwargs):
# type: (str, str, str, **Any) -> ContainerClient
"""Restores soft-deleted container.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,6 @@ def list_containers(
:param bool include_metadata:
Specifies that container metadata to be returned in the response.
The default value is `False`.
:keyword bool include_deleted:
Specifies that deleted containers to be returned in the response. This is for container restore enabled
account. The default value is `False`.
.. versionadded:: 12.4.0
:keyword int results_per_page:
The maximum number of container names to retrieve per API
call. If the request does not specify the server will return up to 5,000 items.
Expand All @@ -361,9 +355,6 @@ def list_containers(
:caption: Listing the containers in the blob service.
"""
include = ['metadata'] if include_metadata else []
include_deleted = kwargs.pop('include_deleted', None)
if include_deleted:
include.append("deleted")
timeout = kwargs.pop('timeout', None)
results_per_page = kwargs.pop('results_per_page', None)
command = functools.partial(
Expand Down Expand Up @@ -519,7 +510,7 @@ async def delete_container(
**kwargs)

@distributed_trace_async
async def undelete_container(self, deleted_container_name, deleted_container_version, new_name=None, **kwargs):
async def _undelete_container(self, deleted_container_name, deleted_container_version, new_name=None, **kwargs):
# type: (str, str, str, **Any) -> ContainerClient
"""Restores soft-deleted container.
Expand Down
12 changes: 6 additions & 6 deletions sdk/storage/azure-storage-blob/tests/test_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,8 @@ def test_undelete_container(self, resource_group, location, storage_account, sto
for container in container_list:
# find the deleted container and restore it
if container.deleted and container.name == container_client.container_name:
restored_ctn_client = bsc.undelete_container(container.name, container.version,
new_name="restored" + str(restored_version))
restored_ctn_client = bsc._undelete_container(container.name, container.version,
new_name="restored" + str(restored_version))
restored_version += 1

# to make sure the deleted container is restored
Expand Down Expand Up @@ -771,8 +771,8 @@ def test_restore_to_existing_container(self, resource_group, location, storage_a
# find the deleted container and restore it
if container.deleted and container.name == container_client.container_name:
with self.assertRaises(HttpResponseError):
bsc.undelete_container(container.name, container.version,
new_name=existing_container_client.container_name)
bsc._undelete_container(container.name, container.version,
new_name=existing_container_client.container_name)

@pytest.mark.live_test_only # sas token is dynamically generated
@pytest.mark.playback_test_only # we need container soft delete enabled account
Expand Down Expand Up @@ -800,8 +800,8 @@ def test_restore_with_sas(self, resource_group, location, storage_account, stora
for container in container_list:
# find the deleted container and restore it
if container.deleted and container.name == container_client.container_name:
restored_ctn_client = bsc.undelete_container(container.name, container.version,
new_name="restored" + str(restored_version))
restored_ctn_client = bsc._undelete_container(container.name, container.version,
new_name="restored" + str(restored_version))
restored_version += 1

# to make sure the deleted container is restored
Expand Down
8 changes: 4 additions & 4 deletions sdk/storage/azure-storage-blob/tests/test_container_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,8 @@ async def test_undelete_container(self, resource_group, location, storage_accoun
for container in container_list:
# find the deleted container and restore it
if container.deleted and container.name == container_client.container_name:
restored_ctn_client = await bsc.undelete_container(container.name, container.version,
new_name="restoredctn" + str(restored_version))
restored_ctn_client = await bsc._undelete_container(container.name, container.version,
new_name="restoredctn" + str(restored_version))
restored_version += 1

# to make sure the deleted container is restored
Expand Down Expand Up @@ -838,8 +838,8 @@ async def test_restore_to_existing_container(self, resource_group, location, sto
# find the deleted container and restore it
if container.deleted and container.name == container_client.container_name:
with self.assertRaises(HttpResponseError):
await bsc.undelete_container(container.name, container.version,
new_name=existing_container_client.container_name)
await bsc._undelete_container(container.name, container.version,
new_name=existing_container_client.container_name)

@GlobalStorageAccountPreparer()
@AsyncStorageTestCase.await_prepared_test
Expand Down

0 comments on commit 6310cbc

Please sign in to comment.