diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_api_version.py b/sdk/storage/azure-storage-blob/tests/test_blob_api_version.py
index 53e2a6020c5c..759885f9d7d1 100644
--- a/sdk/storage/azure-storage-blob/tests/test_blob_api_version.py
+++ b/sdk/storage/azure-storage-blob/tests/test_blob_api_version.py
@@ -17,7 +17,7 @@
BlobClient,
BlobSasPermissions
)
-from azure.storage.blob._generated import AzureBlobStorage
+from azure.storage.blob._shared.constants import X_MS_VERSION
from devtools_testutils import ResourceGroupPreparer, StorageAccountPreparer
from _shared.testcase import StorageTestCase, GlobalStorageAccountPreparer
@@ -29,7 +29,7 @@ class StorageClientTest(StorageTestCase):
def setUp(self):
super(StorageClientTest, self).setUp()
self.api_version_1 = "2019-02-02"
- self.api_version_2 = AzureBlobStorage(url="get_api_version")._config.version # pylint: disable=protected-access
+ self.api_version_2 = X_MS_VERSION
self.container_name = self.get_resource_name('utcontainer')
# --Helpers-----------------------------------------------------------------
diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_api_version_async.py b/sdk/storage/azure-storage-blob/tests/test_blob_api_version_async.py
index a4942175303c..3a1757c6af54 100644
--- a/sdk/storage/azure-storage-blob/tests/test_blob_api_version_async.py
+++ b/sdk/storage/azure-storage-blob/tests/test_blob_api_version_async.py
@@ -10,7 +10,7 @@
from azure.core.exceptions import AzureError, ResourceExistsError
from azure.storage.blob import generate_blob_sas, BlobSasPermissions
-from azure.storage.blob._generated import AzureBlobStorage
+from azure.storage.blob._shared.constants import X_MS_VERSION
from azure.storage.blob.aio import (
BlobServiceClient,
ContainerClient,
@@ -27,7 +27,7 @@ class StorageClientTest(AsyncStorageTestCase):
def setUp(self):
super(StorageClientTest, self).setUp()
self.api_version_1 = "2019-02-02"
- self.api_version_2 = AzureBlobStorage(url="get_api_version")._config.version # pylint: disable=protected-access
+ self.api_version_2 = X_MS_VERSION
self.container_name = self.get_resource_name('utcontainer')
# --Helpers-----------------------------------------------------------------
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_deserialize.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_deserialize.py
index a4b3500b1955..6839469f8030 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_deserialize.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_deserialize.py
@@ -49,7 +49,7 @@ def deserialize_file_properties(response, obj, headers):
def deserialize_file_stream(response, obj, headers):
file_properties = deserialize_file_properties(response, obj, headers)
obj.properties = file_properties
- return response.location_mode, obj
+ return response.http_response.location_mode, obj
def deserialize_permission(response, obj, headers): # pylint: disable=unused-argument
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_directory_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_directory_client.py
index f1c7c05554d4..6155d34aa938 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_directory_client.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_directory_client.py
@@ -10,6 +10,7 @@
Optional, Union, Any, Dict, TYPE_CHECKING
)
+
try:
from urllib.parse import urlparse, quote, unquote
except ImportError:
@@ -17,13 +18,12 @@
from urllib2 import quote, unquote # type: ignore
import six
+from azure.core.exceptions import HttpResponseError
from azure.core.paging import ItemPaged
from azure.core.pipeline import Pipeline
from azure.core.tracing.decorator import distributed_trace
from ._generated import AzureFileStorage
-from ._generated.version import VERSION
-from ._generated.models import StorageErrorException
from ._shared.base_client import StorageAccountHostsMixin, TransportWrapper, parse_connection_str, parse_query
from ._shared.request_handlers import add_metadata_headers
from ._shared.response_handlers import return_response_headers, process_storage_error
@@ -112,8 +112,9 @@ def __init__( # type: ignore
self._query_str, credential = self._format_query_string(
sas_token, credential, share_snapshot=self.snapshot)
super(ShareDirectoryClient, self).__init__(parsed_url, service='file-share', credential=credential, **kwargs)
- self._client = AzureFileStorage(version=VERSION, url=self.url, pipeline=self._pipeline)
- self._client._config.version = get_api_version(kwargs, VERSION) # pylint: disable=protected-access
+ self._client = AzureFileStorage(url=self.url, pipeline=self._pipeline)
+ default_api_version = self._client._config.version # pylint: disable=protected-access
+ self._client._config.version = get_api_version(kwargs, default_api_version) # pylint: disable=protected-access
@classmethod
def from_directory_url(cls, directory_url, # type: str
@@ -291,7 +292,7 @@ def create_directory(self, **kwargs):
cls=return_response_headers,
headers=headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -316,7 +317,7 @@ def delete_directory(self, **kwargs):
timeout = kwargs.pop('timeout', None)
try:
self._client.directory.delete(timeout=timeout, **kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -411,7 +412,7 @@ def close_handle(self, handle, **kwargs):
'closed_handles_count': response.get('number_of_handles_closed', 0),
'failed_handles_count': response.get('number_of_handles_failed', 0)
}
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -448,7 +449,7 @@ def close_all_handles(self, recursive=False, **kwargs):
cls=return_response_headers,
**kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
continuation_token = response.get('marker')
try_close = bool(continuation_token)
@@ -479,7 +480,7 @@ def get_directory_properties(self, **kwargs):
timeout=timeout,
cls=deserialize_directory_properties,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
return response # type: ignore
@@ -509,7 +510,7 @@ def set_directory_metadata(self, metadata, **kwargs):
cls=return_response_headers,
headers=headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -562,7 +563,7 @@ def set_http_headers(self, file_attributes="none", # type: Union[str, NTFSAttri
timeout=timeout,
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py
index 631adac62418..19a36e7911da 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py
@@ -12,6 +12,7 @@
TYPE_CHECKING
)
+
try:
from urllib.parse import urlparse, quote, unquote
except ImportError:
@@ -19,12 +20,12 @@
from urllib2 import quote, unquote # type: ignore
import six
+from azure.core.exceptions import HttpResponseError
from azure.core.paging import ItemPaged # pylint: disable=ungrouped-imports
from azure.core.tracing.decorator import distributed_trace
from ._generated import AzureFileStorage
-from ._generated.version import VERSION
-from ._generated.models import StorageErrorException, FileHTTPHeaders
+from ._generated.models import FileHTTPHeaders
from ._shared.uploads import IterStreamer, FileChunkUploader, upload_data_chunks
from ._shared.base_client import StorageAccountHostsMixin, parse_connection_str, parse_query
from ._shared.request_handlers import add_metadata_headers, get_length
@@ -89,7 +90,7 @@ def _upload_file_helper(
**kwargs
)
return sorted(responses, key=lambda r: r.get('last_modified'))[-1]
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@@ -165,8 +166,9 @@ def __init__( # type: ignore
self._query_str, credential = self._format_query_string(
sas_token, credential, share_snapshot=self.snapshot)
super(ShareFileClient, self).__init__(parsed_url, service='file-share', credential=credential, **kwargs)
- self._client = AzureFileStorage(version=VERSION, url=self.url, pipeline=self._pipeline)
- self._client._config.version = get_api_version(kwargs, VERSION) # pylint: disable=protected-access
+ self._client = AzureFileStorage(url=self.url, pipeline=self._pipeline)
+ default_api_version = self._client._config.version # pylint: disable=protected-access
+ self._client._config.version = get_api_version(kwargs, default_api_version) # pylint: disable=protected-access
@classmethod
def from_file_url(
@@ -396,7 +398,7 @@ def create_file( # type: ignore
timeout=timeout,
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -631,7 +633,7 @@ def start_copy_from_url(self, source_url, **kwargs):
cls=return_response_headers,
timeout=timeout,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
def abort_copy(self, copy_id, **kwargs):
@@ -669,7 +671,7 @@ def abort_copy(self, copy_id, **kwargs):
self._client.file.abort_copy(copy_id=copy_id,
lease_access_conditions=access_conditions,
timeout=timeout, **kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -772,7 +774,7 @@ def delete_file(self, **kwargs):
timeout = kwargs.pop('timeout', None)
try:
self._client.file.delete(lease_access_conditions=access_conditions, timeout=timeout, **kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -802,7 +804,7 @@ def get_file_properties(self, **kwargs):
timeout=timeout,
cls=deserialize_file_properties,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
file_props.name = self.file_name
file_props.share = self.share_name
@@ -884,7 +886,7 @@ def set_http_headers(self, content_settings, # type: ContentSettings
timeout=timeout,
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -924,7 +926,7 @@ def set_file_metadata(self, metadata=None, **kwargs):
metadata=metadata,
lease_access_conditions=access_conditions,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -987,7 +989,7 @@ def upload_range( # type: ignore
lease_access_conditions=access_conditions,
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@staticmethod
@@ -1091,7 +1093,7 @@ def upload_range_from_url(self, source_url,
)
try:
return self._client.file.upload_range_from_url(**options) # type: ignore
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
def _get_ranges_options( # type: ignore
@@ -1161,7 +1163,7 @@ def get_ranges( # type: ignore
**kwargs)
try:
ranges = self._client.file.get_range_list(**options)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
return [{'start': file_range.start, 'end': file_range.end} for file_range in ranges.ranges]
@@ -1204,7 +1206,7 @@ def get_ranges_diff( # type: ignore
**kwargs)
try:
ranges = self._client.file.get_range_list(**options)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
return get_file_ranges_result(ranges)
@@ -1252,11 +1254,12 @@ def clear_range( # type: ignore
timeout=timeout,
cls=return_response_headers,
content_length=0,
+ optionalbody=None,
file_range_write="clear",
range=content_range,
lease_access_conditions=access_conditions,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -1291,7 +1294,7 @@ def resize_file(self, size, **kwargs):
cls=return_response_headers,
timeout=timeout,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -1348,7 +1351,7 @@ def close_handle(self, handle, **kwargs):
'closed_handles_count': response.get('number_of_handles_closed', 0),
'failed_handles_count': response.get('number_of_handles_failed', 0)
}
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -1381,7 +1384,7 @@ def close_all_handles(self, **kwargs):
cls=return_response_headers,
**kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
continuation_token = response.get('marker')
try_close = bool(continuation_token)
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/__init__.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/__init__.py
index 22b5762b2752..34ce526ebfe1 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/__init__.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/__init__.py
@@ -1,18 +1,16 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from ._azure_file_storage import AzureFileStorage
__all__ = ['AzureFileStorage']
-from .version import VERSION
-
-__version__ = VERSION
-
+try:
+ from ._patch import patch_sdk # type: ignore
+ patch_sdk()
+except ImportError:
+ pass
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py
index 7a681889f122..3717742eccdd 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py
@@ -1,19 +1,21 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from typing import TYPE_CHECKING
+
from azure.core import PipelineClient
-from msrest import Serializer, Deserializer
+from msrest import Deserializer, Serializer
+
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any
from ._configuration import AzureFileStorageConfiguration
-from azure.core.exceptions import map_error
from .operations import ServiceOperations
from .operations import ShareOperations
from .operations import DirectoryOperations
@@ -22,35 +24,33 @@
class AzureFileStorage(object):
- """AzureFileStorage
+ """AzureFileStorage.
-
- :ivar service: Service operations
+ :ivar service: ServiceOperations operations
:vartype service: azure.storage.fileshare.operations.ServiceOperations
- :ivar share: Share operations
+ :ivar share: ShareOperations operations
:vartype share: azure.storage.fileshare.operations.ShareOperations
- :ivar directory: Directory operations
+ :ivar directory: DirectoryOperations operations
:vartype directory: azure.storage.fileshare.operations.DirectoryOperations
- :ivar file: File operations
+ :ivar file: FileOperations operations
:vartype file: azure.storage.fileshare.operations.FileOperations
-
- :param version: Specifies the version of the operation to use for this
- request.
- :type version: str
- :param url: The URL of the service account, share, directory or file that
- is the target of the desired operation.
+ :param url: The URL of the service account, share, directory or file that is the target of the desired operation.
:type url: str
"""
- def __init__(self, version, url, **kwargs):
-
+ def __init__(
+ self,
+ url, # type: str
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
base_url = '{url}'
- self._config = AzureFileStorageConfiguration(version, url, **kwargs)
+ self._config = AzureFileStorageConfiguration(url, **kwargs)
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
- self.api_version = '2020-04-08'
self._serialize = Serializer(client_models)
+ self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)
self.service = ServiceOperations(
@@ -63,9 +63,14 @@ def __init__(self, version, url, **kwargs):
self._client, self._config, self._serialize, self._deserialize)
def close(self):
+ # type: () -> None
self._client.close()
+
def __enter__(self):
+ # type: () -> AzureFileStorage
self._client.__enter__()
return self
+
def __exit__(self, *exc_details):
+ # type: (Any) -> None
self._client.__exit__(*exc_details)
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py
index d638b1e713bd..0fc4ad4cb117 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py
@@ -1,58 +1,59 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from typing import TYPE_CHECKING
+
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
-from .version import VERSION
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any
+VERSION = "unknown"
class AzureFileStorageConfiguration(Configuration):
- """Configuration for AzureFileStorage
+ """Configuration for AzureFileStorage.
+
Note that all parameters used to create this instance are saved as instance
attributes.
- :param version: Specifies the version of the operation to use for this
- request.
- :type version: str
- :param url: The URL of the service account, share, directory or file that
- is the target of the desired operation.
+ :param url: The URL of the service account, share, directory or file that is the target of the desired operation.
:type url: str
- :ivar file_range_write_from_url: Only update is supported: - Update:
- Writes the bytes downloaded from the source url into the specified range.
- :type file_range_write_from_url: str
"""
- def __init__(self, version, url, **kwargs):
-
- if version is None:
- raise ValueError("Parameter 'version' must not be None.")
+ def __init__(
+ self,
+ url, # type: str
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
if url is None:
raise ValueError("Parameter 'url' must not be None.")
-
super(AzureFileStorageConfiguration, self).__init__(**kwargs)
- self._configure(**kwargs)
-
- self.user_agent_policy.add_user_agent('azsdk-python-azurefilestorage/{}'.format(VERSION))
- self.generate_client_request_id = True
- self.version = version
self.url = url
+ self.version = "2020-04-08"
self.file_range_write_from_url = "update"
+ kwargs.setdefault('sdk_moniker', 'azurefilestorage/{}'.format(VERSION))
+ self._configure(**kwargs)
- def _configure(self, **kwargs):
+ def _configure(
+ self,
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
+ self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
+ self.authentication_policy = kwargs.get('authentication_policy')
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/__init__.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/__init__.py
index 942d3c5dd379..f306ba079795 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/__init__.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/__init__.py
@@ -1,13 +1,10 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from ._azure_file_storage_async import AzureFileStorage
+from ._azure_file_storage import AzureFileStorage
__all__ = ['AzureFileStorage']
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py
similarity index 53%
rename from sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage_async.py
rename to sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py
index 83264f1daebe..f3f1d7c7a761 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage_async.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py
@@ -1,57 +1,51 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from typing import Any
+
from azure.core import AsyncPipelineClient
-from msrest import Serializer, Deserializer
+from msrest import Deserializer, Serializer
-from ._configuration_async import AzureFileStorageConfiguration
-from azure.core.exceptions import map_error
-from .operations_async import ServiceOperations
-from .operations_async import ShareOperations
-from .operations_async import DirectoryOperations
-from .operations_async import FileOperations
+from ._configuration import AzureFileStorageConfiguration
+from .operations import ServiceOperations
+from .operations import ShareOperations
+from .operations import DirectoryOperations
+from .operations import FileOperations
from .. import models
class AzureFileStorage(object):
- """AzureFileStorage
-
-
- :ivar service: Service operations
- :vartype service: azure.storage.fileshare.aio.operations_async.ServiceOperations
- :ivar share: Share operations
- :vartype share: azure.storage.fileshare.aio.operations_async.ShareOperations
- :ivar directory: Directory operations
- :vartype directory: azure.storage.fileshare.aio.operations_async.DirectoryOperations
- :ivar file: File operations
- :vartype file: azure.storage.fileshare.aio.operations_async.FileOperations
+ """AzureFileStorage.
- :param version: Specifies the version of the operation to use for this
- request.
- :type version: str
- :param url: The URL of the service account, share, directory or file that
- is the target of the desired operation.
+ :ivar service: ServiceOperations operations
+ :vartype service: azure.storage.fileshare.aio.operations.ServiceOperations
+ :ivar share: ShareOperations operations
+ :vartype share: azure.storage.fileshare.aio.operations.ShareOperations
+ :ivar directory: DirectoryOperations operations
+ :vartype directory: azure.storage.fileshare.aio.operations.DirectoryOperations
+ :ivar file: FileOperations operations
+ :vartype file: azure.storage.fileshare.aio.operations.FileOperations
+ :param url: The URL of the service account, share, directory or file that is the target of the desired operation.
:type url: str
"""
def __init__(
- self, version, url, **kwargs):
-
+ self,
+ url: str,
+ **kwargs: Any
+ ) -> None:
base_url = '{url}'
- self._config = AzureFileStorageConfiguration(version, url, **kwargs)
+ self._config = AzureFileStorageConfiguration(url, **kwargs)
self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
- self.api_version = '2020-04-08'
self._serialize = Serializer(client_models)
+ self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)
self.service = ServiceOperations(
@@ -63,10 +57,12 @@ def __init__(
self.file = FileOperations(
self._client, self._config, self._serialize, self._deserialize)
- async def close(self):
+ async def close(self) -> None:
await self._client.close()
- async def __aenter__(self):
+
+ async def __aenter__(self) -> "AzureFileStorage":
await self._client.__aenter__()
return self
- async def __aexit__(self, *exc_details):
+
+ async def __aexit__(self, *exc_details) -> None:
await self._client.__aexit__(*exc_details)
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py
similarity index 65%
rename from sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration_async.py
rename to sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py
index 75c206e4fe8a..af7c6657dac8 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration_async.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py
@@ -1,59 +1,53 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from typing import Any
+
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
-from ..version import VERSION
-
+VERSION = "unknown"
class AzureFileStorageConfiguration(Configuration):
- """Configuration for AzureFileStorage
+ """Configuration for AzureFileStorage.
+
Note that all parameters used to create this instance are saved as instance
attributes.
- :param version: Specifies the version of the operation to use for this
- request.
- :type version: str
- :param url: The URL of the service account, share, directory or file that
- is the target of the desired operation.
+ :param url: The URL of the service account, share, directory or file that is the target of the desired operation.
:type url: str
- :ivar file_range_write_from_url: Only update is supported: - Update:
- Writes the bytes downloaded from the source url into the specified range.
- :type file_range_write_from_url: str
"""
- def __init__(self, version, url, **kwargs):
-
- if version is None:
- raise ValueError("Parameter 'version' must not be None.")
+ def __init__(
+ self,
+ url: str,
+ **kwargs: Any
+ ) -> None:
if url is None:
raise ValueError("Parameter 'url' must not be None.")
-
super(AzureFileStorageConfiguration, self).__init__(**kwargs)
- self._configure(**kwargs)
- self.user_agent_policy.add_user_agent('azsdk-python-azurefilestorage/{}'.format(VERSION))
- self.generate_client_request_id = True
- self.accept_language = None
-
- self.version = version
self.url = url
+ self.version = "2020-04-08"
self.file_range_write_from_url = "update"
+ kwargs.setdefault('sdk_moniker', 'azurefilestorage/{}'.format(VERSION))
+ self._configure(**kwargs)
- def _configure(self, **kwargs):
+ def _configure(
+ self,
+ **kwargs: Any
+ ) -> None:
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
+ self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
+ self.authentication_policy = kwargs.get('authentication_policy')
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/__init__.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/__init__.py
similarity index 65%
rename from sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/__init__.py
rename to sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/__init__.py
index 601c7099d157..ba8fb22157f4 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/__init__.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/__init__.py
@@ -1,18 +1,15 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from ._service_operations_async import ServiceOperations
-from ._share_operations_async import ShareOperations
-from ._directory_operations_async import DirectoryOperations
-from ._file_operations_async import FileOperations
+from ._service_operations import ServiceOperations
+from ._share_operations import ShareOperations
+from ._directory_operations import DirectoryOperations
+from ._file_operations import FileOperations
__all__ = [
'ServiceOperations',
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py
new file mode 100644
index 000000000000..02221cbcae1e
--- /dev/null
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py
@@ -0,0 +1,739 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from typing import Any, Callable, Dict, Generic, Optional, TypeVar
+import warnings
+
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
+
+from ... import models as _models
+
+T = TypeVar('T')
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+class DirectoryOperations:
+ """DirectoryOperations async operations.
+
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~azure.storage.fileshare.models
+ :param client: Client for service requests.
+ :param config: Configuration of service client.
+ :param serializer: An object model serializer.
+ :param deserializer: An object model deserializer.
+ """
+
+ models = _models
+
+ def __init__(self, client, config, serializer, deserializer) -> None:
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ async def create(
+ self,
+ timeout: Optional[int] = None,
+ metadata: Optional[str] = None,
+ file_permission: Optional[str] = "inherit",
+ file_permission_key: Optional[str] = None,
+ file_attributes: str = "none",
+ file_creation_time: str = "now",
+ file_last_write_time: str = "now",
+ **kwargs
+ ) -> None:
+ """Creates a new directory under the specified share or parent directory.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param metadata: A name-value pair to associate with a file storage object.
+ :type metadata: str
+ :param file_permission: If specified the permission (security descriptor) shall be set for the
+ directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-
+ permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it
+ must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-
+ permission-key should be specified.
+ :type file_permission: str
+ :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only
+ one of the x-ms-file-permission or x-ms-file-permission-key should be specified.
+ :type file_permission_key: str
+ :param file_attributes: If specified, the provided file attributes shall be set. Default value:
+ ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default.
+ :type file_attributes: str
+ :param file_creation_time: Creation time for the file/directory. Default value: Now.
+ :type file_creation_time: str
+ :param file_last_write_time: Last write time for the file/directory. Default value: Now.
+ :type file_last_write_time: str
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "directory"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.create.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ if metadata is not None:
+ header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if file_permission is not None:
+ header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str')
+ if file_permission_key is not None:
+ header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str')
+ header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str')
+ header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str')
+ header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [201]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+ response_headers['x-ms-file-attributes']=self._deserialize('str', response.headers.get('x-ms-file-attributes'))
+ response_headers['x-ms-file-creation-time']=self._deserialize('str', response.headers.get('x-ms-file-creation-time'))
+ response_headers['x-ms-file-last-write-time']=self._deserialize('str', response.headers.get('x-ms-file-last-write-time'))
+ response_headers['x-ms-file-change-time']=self._deserialize('str', response.headers.get('x-ms-file-change-time'))
+ response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id'))
+ response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ create.metadata = {'url': '/{shareName}/{directory}'} # type: ignore
+
+ async def get_properties(
+ self,
+ sharesnapshot: Optional[str] = None,
+ timeout: Optional[int] = None,
+ **kwargs
+ ) -> None:
+ """Returns all system properties for the specified directory, and can also be used to check the
+ existence of a directory. The data returned does not include the files in the directory or any
+ subdirectories.
+
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
+ :type sharesnapshot: str
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "directory"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.get_properties.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ if sharesnapshot is not None:
+ query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta'))
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-server-encrypted'))
+ response_headers['x-ms-file-attributes']=self._deserialize('str', response.headers.get('x-ms-file-attributes'))
+ response_headers['x-ms-file-creation-time']=self._deserialize('str', response.headers.get('x-ms-file-creation-time'))
+ response_headers['x-ms-file-last-write-time']=self._deserialize('str', response.headers.get('x-ms-file-last-write-time'))
+ response_headers['x-ms-file-change-time']=self._deserialize('str', response.headers.get('x-ms-file-change-time'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+ response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id'))
+ response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ get_properties.metadata = {'url': '/{shareName}/{directory}'} # type: ignore
+
+ async def delete(
+ self,
+ timeout: Optional[int] = None,
+ **kwargs
+ ) -> None:
+ """Removes the specified empty directory. Note that the directory must be empty before it can be
+ deleted.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "directory"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.delete.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.delete(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [202]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ delete.metadata = {'url': '/{shareName}/{directory}'} # type: ignore
+
+ async def set_properties(
+ self,
+ timeout: Optional[int] = None,
+ file_permission: Optional[str] = "inherit",
+ file_permission_key: Optional[str] = None,
+ file_attributes: str = "none",
+ file_creation_time: str = "now",
+ file_last_write_time: str = "now",
+ **kwargs
+ ) -> None:
+ """Sets properties on the directory.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param file_permission: If specified the permission (security descriptor) shall be set for the
+ directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-
+ permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it
+ must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-
+ permission-key should be specified.
+ :type file_permission: str
+ :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only
+ one of the x-ms-file-permission or x-ms-file-permission-key should be specified.
+ :type file_permission_key: str
+ :param file_attributes: If specified, the provided file attributes shall be set. Default value:
+ ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default.
+ :type file_attributes: str
+ :param file_creation_time: Creation time for the file/directory. Default value: Now.
+ :type file_creation_time: str
+ :param file_last_write_time: Last write time for the file/directory. Default value: Now.
+ :type file_last_write_time: str
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "directory"
+ comp = "properties"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.set_properties.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if file_permission is not None:
+ header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str')
+ if file_permission_key is not None:
+ header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str')
+ header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str')
+ header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str')
+ header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+ response_headers['x-ms-file-attributes']=self._deserialize('str', response.headers.get('x-ms-file-attributes'))
+ response_headers['x-ms-file-creation-time']=self._deserialize('str', response.headers.get('x-ms-file-creation-time'))
+ response_headers['x-ms-file-last-write-time']=self._deserialize('str', response.headers.get('x-ms-file-last-write-time'))
+ response_headers['x-ms-file-change-time']=self._deserialize('str', response.headers.get('x-ms-file-change-time'))
+ response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id'))
+ response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ set_properties.metadata = {'url': '/{shareName}/{directory}'} # type: ignore
+
+ async def set_metadata(
+ self,
+ timeout: Optional[int] = None,
+ metadata: Optional[str] = None,
+ **kwargs
+ ) -> None:
+ """Updates user defined metadata for the specified directory.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param metadata: A name-value pair to associate with a file storage object.
+ :type metadata: str
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "directory"
+ comp = "metadata"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.set_metadata.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ if metadata is not None:
+ header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ set_metadata.metadata = {'url': '/{shareName}/{directory}'} # type: ignore
+
+ async def list_files_and_directories_segment(
+ self,
+ prefix: Optional[str] = None,
+ sharesnapshot: Optional[str] = None,
+ marker: Optional[str] = None,
+ maxresults: Optional[int] = None,
+ timeout: Optional[int] = None,
+ **kwargs
+ ) -> "_models.ListFilesAndDirectoriesSegmentResponse":
+ """Returns a list of files or directories under the specified share or directory. It lists the
+ contents only for a single level of the directory hierarchy.
+
+ :param prefix: Filters the results to return only entries whose name begins with the specified
+ prefix.
+ :type prefix: str
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
+ :type sharesnapshot: str
+ :param marker: A string value that identifies the portion of the list to be returned with the
+ next list operation. The operation returns a marker value within the response body if the list
+ returned was not complete. The marker value may then be used in a subsequent call to request
+ the next set of list items. The marker value is opaque to the client.
+ :type marker: str
+ :param maxresults: Specifies the maximum number of entries to return. If the request does not
+ specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000
+ items.
+ :type maxresults: int
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ListFilesAndDirectoriesSegmentResponse, or the result of cls(response)
+ :rtype: ~azure.storage.fileshare.models.ListFilesAndDirectoriesSegmentResponse
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListFilesAndDirectoriesSegmentResponse"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "directory"
+ comp = "list"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.list_files_and_directories_segment.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if prefix is not None:
+ query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str')
+ if sharesnapshot is not None:
+ query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
+ if marker is not None:
+ query_parameters['marker'] = self._serialize.query("marker", marker, 'str')
+ if maxresults is not None:
+ query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1)
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('ListFilesAndDirectoriesSegmentResponse', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+ list_files_and_directories_segment.metadata = {'url': '/{shareName}/{directory}'} # type: ignore
+
+ async def list_handles(
+ self,
+ marker: Optional[str] = None,
+ maxresults: Optional[int] = None,
+ timeout: Optional[int] = None,
+ sharesnapshot: Optional[str] = None,
+ recursive: Optional[bool] = None,
+ **kwargs
+ ) -> "_models.ListHandlesResponse":
+ """Lists handles for directory.
+
+ :param marker: A string value that identifies the portion of the list to be returned with the
+ next list operation. The operation returns a marker value within the response body if the list
+ returned was not complete. The marker value may then be used in a subsequent call to request
+ the next set of list items. The marker value is opaque to the client.
+ :type marker: str
+ :param maxresults: Specifies the maximum number of entries to return. If the request does not
+ specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000
+ items.
+ :type maxresults: int
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
+ :type sharesnapshot: str
+ :param recursive: Specifies operation should apply to the directory specified in the URI, its
+ files, its subdirectories and their files.
+ :type recursive: bool
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ListHandlesResponse, or the result of cls(response)
+ :rtype: ~azure.storage.fileshare.models.ListHandlesResponse
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListHandlesResponse"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ comp = "listhandles"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.list_handles.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if marker is not None:
+ query_parameters['marker'] = self._serialize.query("marker", marker, 'str')
+ if maxresults is not None:
+ query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1)
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+ if sharesnapshot is not None:
+ query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ if recursive is not None:
+ header_parameters['x-ms-recursive'] = self._serialize.header("recursive", recursive, 'bool')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('ListHandlesResponse', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+ list_handles.metadata = {'url': '/{shareName}/{directory}'} # type: ignore
+
+ async def force_close_handles(
+ self,
+ handle_id: str,
+ timeout: Optional[int] = None,
+ marker: Optional[str] = None,
+ sharesnapshot: Optional[str] = None,
+ recursive: Optional[bool] = None,
+ **kwargs
+ ) -> None:
+ """Closes all handles open for given directory.
+
+ :param handle_id: Specifies handle ID opened on the file or directory to be closed. Asterisk
+ (‘*’) is a wildcard that specifies all handles.
+ :type handle_id: str
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param marker: A string value that identifies the portion of the list to be returned with the
+ next list operation. The operation returns a marker value within the response body if the list
+ returned was not complete. The marker value may then be used in a subsequent call to request
+ the next set of list items. The marker value is opaque to the client.
+ :type marker: str
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
+ :type sharesnapshot: str
+ :param recursive: Specifies operation should apply to the directory specified in the URI, its
+ files, its subdirectories and their files.
+ :type recursive: bool
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ comp = "forceclosehandles"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.force_close_handles.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+ if marker is not None:
+ query_parameters['marker'] = self._serialize.query("marker", marker, 'str')
+ if sharesnapshot is not None:
+ query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-handle-id'] = self._serialize.header("handle_id", handle_id, 'str')
+ if recursive is not None:
+ header_parameters['x-ms-recursive'] = self._serialize.header("recursive", recursive, 'bool')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-marker']=self._deserialize('str', response.headers.get('x-ms-marker'))
+ response_headers['x-ms-number-of-handles-closed']=self._deserialize('int', response.headers.get('x-ms-number-of-handles-closed'))
+ response_headers['x-ms-number-of-handles-failed']=self._deserialize('int', response.headers.get('x-ms-number-of-handles-failed'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ force_close_handles.metadata = {'url': '/{shareName}/{directory}'} # type: ignore
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py
new file mode 100644
index 000000000000..68bd184a9399
--- /dev/null
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py
@@ -0,0 +1,1770 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union
+import warnings
+
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
+
+from ... import models as _models
+
+T = TypeVar('T')
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+class FileOperations:
+ """FileOperations async operations.
+
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~azure.storage.fileshare.models
+ :param client: Client for service requests.
+ :param config: Configuration of service client.
+ :param serializer: An object model serializer.
+ :param deserializer: An object model deserializer.
+ """
+
+ models = _models
+
+ def __init__(self, client, config, serializer, deserializer) -> None:
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ async def create(
+ self,
+ file_content_length: int,
+ timeout: Optional[int] = None,
+ metadata: Optional[str] = None,
+ file_permission: Optional[str] = "inherit",
+ file_permission_key: Optional[str] = None,
+ file_attributes: str = "none",
+ file_creation_time: str = "now",
+ file_last_write_time: str = "now",
+ file_http_headers: Optional["_models.FileHTTPHeaders"] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> None:
+ """Creates a new file or replaces a file. Note it only initializes the file with no content.
+
+ :param file_content_length: Specifies the maximum size for the file, up to 4 TB.
+ :type file_content_length: long
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param metadata: A name-value pair to associate with a file storage object.
+ :type metadata: str
+ :param file_permission: If specified the permission (security descriptor) shall be set for the
+ directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-
+ permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it
+ must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-
+ permission-key should be specified.
+ :type file_permission: str
+ :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only
+ one of the x-ms-file-permission or x-ms-file-permission-key should be specified.
+ :type file_permission_key: str
+ :param file_attributes: If specified, the provided file attributes shall be set. Default value:
+ ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default.
+ :type file_attributes: str
+ :param file_creation_time: Creation time for the file/directory. Default value: Now.
+ :type file_creation_time: str
+ :param file_last_write_time: Last write time for the file/directory. Default value: Now.
+ :type file_last_write_time: str
+ :param file_http_headers: Parameter group.
+ :type file_http_headers: ~azure.storage.fileshare.models.FileHTTPHeaders
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _file_content_type = None
+ _file_content_encoding = None
+ _file_content_language = None
+ _file_cache_control = None
+ _file_content_md5 = None
+ _file_content_disposition = None
+ _lease_id = None
+ if file_http_headers is not None:
+ _file_content_type = file_http_headers.file_content_type
+ _file_content_encoding = file_http_headers.file_content_encoding
+ _file_content_language = file_http_headers.file_content_language
+ _file_cache_control = file_http_headers.file_cache_control
+ _file_content_md5 = file_http_headers.file_content_md5
+ _file_content_disposition = file_http_headers.file_content_disposition
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ file_type_constant = "file"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.create.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['x-ms-content-length'] = self._serialize.header("file_content_length", file_content_length, 'long')
+ header_parameters['x-ms-type'] = self._serialize.header("file_type_constant", file_type_constant, 'str')
+ if _file_content_type is not None:
+ header_parameters['x-ms-content-type'] = self._serialize.header("file_content_type", _file_content_type, 'str')
+ if _file_content_encoding is not None:
+ header_parameters['x-ms-content-encoding'] = self._serialize.header("file_content_encoding", _file_content_encoding, 'str')
+ if _file_content_language is not None:
+ header_parameters['x-ms-content-language'] = self._serialize.header("file_content_language", _file_content_language, 'str')
+ if _file_cache_control is not None:
+ header_parameters['x-ms-cache-control'] = self._serialize.header("file_cache_control", _file_cache_control, 'str')
+ if _file_content_md5 is not None:
+ header_parameters['x-ms-content-md5'] = self._serialize.header("file_content_md5", _file_content_md5, 'bytearray')
+ if _file_content_disposition is not None:
+ header_parameters['x-ms-content-disposition'] = self._serialize.header("file_content_disposition", _file_content_disposition, 'str')
+ if metadata is not None:
+ header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
+ if file_permission is not None:
+ header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str')
+ if file_permission_key is not None:
+ header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str')
+ header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str')
+ header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str')
+ header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [201]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+ response_headers['x-ms-file-attributes']=self._deserialize('str', response.headers.get('x-ms-file-attributes'))
+ response_headers['x-ms-file-creation-time']=self._deserialize('str', response.headers.get('x-ms-file-creation-time'))
+ response_headers['x-ms-file-last-write-time']=self._deserialize('str', response.headers.get('x-ms-file-last-write-time'))
+ response_headers['x-ms-file-change-time']=self._deserialize('str', response.headers.get('x-ms-file-change-time'))
+ response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id'))
+ response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ create.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ async def download(
+ self,
+ timeout: Optional[int] = None,
+ range: Optional[str] = None,
+ range_get_content_md5: Optional[bool] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> IO:
+ """Reads or downloads a file from the system, including its metadata and properties.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param range: Return file data only from the specified byte range.
+ :type range: str
+ :param range_get_content_md5: When this header is set to true and specified together with the
+ Range header, the service returns the MD5 hash for the range, as long as the range is less than
+ or equal to 4 MB in size.
+ :type range_get_content_md5: bool
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: IO, or the result of cls(response)
+ :rtype: IO
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[IO]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.download.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if range is not None:
+ header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str')
+ if range_get_content_md5 is not None:
+ header_parameters['x-ms-range-get-content-md5'] = self._serialize.header("range_get_content_md5", range_get_content_md5, 'bool')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 206]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta'))
+ response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length'))
+ response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type'))
+ response_headers['Content-Range']=self._deserialize('str', response.headers.get('Content-Range'))
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Content-MD5']=self._deserialize('bytearray', response.headers.get('Content-MD5'))
+ response_headers['Content-Encoding']=self._deserialize('str', response.headers.get('Content-Encoding'))
+ response_headers['Cache-Control']=self._deserialize('str', response.headers.get('Cache-Control'))
+ response_headers['Content-Disposition']=self._deserialize('str', response.headers.get('Content-Disposition'))
+ response_headers['Content-Language']=self._deserialize('str', response.headers.get('Content-Language'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Accept-Ranges']=self._deserialize('str', response.headers.get('Accept-Ranges'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-copy-completion-time']=self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time'))
+ response_headers['x-ms-copy-status-description']=self._deserialize('str', response.headers.get('x-ms-copy-status-description'))
+ response_headers['x-ms-copy-id']=self._deserialize('str', response.headers.get('x-ms-copy-id'))
+ response_headers['x-ms-copy-progress']=self._deserialize('str', response.headers.get('x-ms-copy-progress'))
+ response_headers['x-ms-copy-source']=self._deserialize('str', response.headers.get('x-ms-copy-source'))
+ response_headers['x-ms-copy-status']=self._deserialize('str', response.headers.get('x-ms-copy-status'))
+ response_headers['x-ms-content-md5']=self._deserialize('bytearray', response.headers.get('x-ms-content-md5'))
+ response_headers['x-ms-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-server-encrypted'))
+ response_headers['x-ms-file-attributes']=self._deserialize('str', response.headers.get('x-ms-file-attributes'))
+ response_headers['x-ms-file-creation-time']=self._deserialize('str', response.headers.get('x-ms-file-creation-time'))
+ response_headers['x-ms-file-last-write-time']=self._deserialize('str', response.headers.get('x-ms-file-last-write-time'))
+ response_headers['x-ms-file-change-time']=self._deserialize('str', response.headers.get('x-ms-file-change-time'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+ response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id'))
+ response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id'))
+ response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration'))
+ response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state'))
+ response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status'))
+ deserialized = response.stream_download(self._client._pipeline)
+
+ if response.status_code == 206:
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta'))
+ response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length'))
+ response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type'))
+ response_headers['Content-Range']=self._deserialize('str', response.headers.get('Content-Range'))
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Content-MD5']=self._deserialize('bytearray', response.headers.get('Content-MD5'))
+ response_headers['Content-Encoding']=self._deserialize('str', response.headers.get('Content-Encoding'))
+ response_headers['Cache-Control']=self._deserialize('str', response.headers.get('Cache-Control'))
+ response_headers['Content-Disposition']=self._deserialize('str', response.headers.get('Content-Disposition'))
+ response_headers['Content-Language']=self._deserialize('str', response.headers.get('Content-Language'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Accept-Ranges']=self._deserialize('str', response.headers.get('Accept-Ranges'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-copy-completion-time']=self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time'))
+ response_headers['x-ms-copy-status-description']=self._deserialize('str', response.headers.get('x-ms-copy-status-description'))
+ response_headers['x-ms-copy-id']=self._deserialize('str', response.headers.get('x-ms-copy-id'))
+ response_headers['x-ms-copy-progress']=self._deserialize('str', response.headers.get('x-ms-copy-progress'))
+ response_headers['x-ms-copy-source']=self._deserialize('str', response.headers.get('x-ms-copy-source'))
+ response_headers['x-ms-copy-status']=self._deserialize('str', response.headers.get('x-ms-copy-status'))
+ response_headers['x-ms-content-md5']=self._deserialize('bytearray', response.headers.get('x-ms-content-md5'))
+ response_headers['x-ms-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-server-encrypted'))
+ response_headers['x-ms-file-attributes']=self._deserialize('str', response.headers.get('x-ms-file-attributes'))
+ response_headers['x-ms-file-creation-time']=self._deserialize('str', response.headers.get('x-ms-file-creation-time'))
+ response_headers['x-ms-file-last-write-time']=self._deserialize('str', response.headers.get('x-ms-file-last-write-time'))
+ response_headers['x-ms-file-change-time']=self._deserialize('str', response.headers.get('x-ms-file-change-time'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+ response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id'))
+ response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id'))
+ response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration'))
+ response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state'))
+ response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status'))
+ deserialized = response.stream_download(self._client._pipeline)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+ download.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ async def get_properties(
+ self,
+ sharesnapshot: Optional[str] = None,
+ timeout: Optional[int] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> None:
+ """Returns all user-defined metadata, standard HTTP properties, and system properties for the
+ file. It does not return the content of the file.
+
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
+ :type sharesnapshot: str
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.get_properties.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ if sharesnapshot is not None:
+ query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.head(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta'))
+ response_headers['x-ms-type']=self._deserialize('str', response.headers.get('x-ms-type'))
+ response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length'))
+ response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type'))
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Content-MD5']=self._deserialize('bytearray', response.headers.get('Content-MD5'))
+ response_headers['Content-Encoding']=self._deserialize('str', response.headers.get('Content-Encoding'))
+ response_headers['Cache-Control']=self._deserialize('str', response.headers.get('Cache-Control'))
+ response_headers['Content-Disposition']=self._deserialize('str', response.headers.get('Content-Disposition'))
+ response_headers['Content-Language']=self._deserialize('str', response.headers.get('Content-Language'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-copy-completion-time']=self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time'))
+ response_headers['x-ms-copy-status-description']=self._deserialize('str', response.headers.get('x-ms-copy-status-description'))
+ response_headers['x-ms-copy-id']=self._deserialize('str', response.headers.get('x-ms-copy-id'))
+ response_headers['x-ms-copy-progress']=self._deserialize('str', response.headers.get('x-ms-copy-progress'))
+ response_headers['x-ms-copy-source']=self._deserialize('str', response.headers.get('x-ms-copy-source'))
+ response_headers['x-ms-copy-status']=self._deserialize('str', response.headers.get('x-ms-copy-status'))
+ response_headers['x-ms-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-server-encrypted'))
+ response_headers['x-ms-file-attributes']=self._deserialize('str', response.headers.get('x-ms-file-attributes'))
+ response_headers['x-ms-file-creation-time']=self._deserialize('str', response.headers.get('x-ms-file-creation-time'))
+ response_headers['x-ms-file-last-write-time']=self._deserialize('str', response.headers.get('x-ms-file-last-write-time'))
+ response_headers['x-ms-file-change-time']=self._deserialize('str', response.headers.get('x-ms-file-change-time'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+ response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id'))
+ response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id'))
+ response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration'))
+ response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state'))
+ response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ get_properties.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ async def delete(
+ self,
+ timeout: Optional[int] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> None:
+ """removes the file from the storage account.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.delete.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.delete(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [202]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ delete.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ async def set_http_headers(
+ self,
+ timeout: Optional[int] = None,
+ file_content_length: Optional[int] = None,
+ file_permission: Optional[str] = "inherit",
+ file_permission_key: Optional[str] = None,
+ file_attributes: str = "none",
+ file_creation_time: str = "now",
+ file_last_write_time: str = "now",
+ file_http_headers: Optional["_models.FileHTTPHeaders"] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> None:
+ """Sets HTTP headers on the file.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param file_content_length: Resizes a file to the specified size. If the specified byte value
+ is less than the current size of the file, then all ranges above the specified byte value are
+ cleared.
+ :type file_content_length: long
+ :param file_permission: If specified the permission (security descriptor) shall be set for the
+ directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-
+ permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it
+ must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-
+ permission-key should be specified.
+ :type file_permission: str
+ :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only
+ one of the x-ms-file-permission or x-ms-file-permission-key should be specified.
+ :type file_permission_key: str
+ :param file_attributes: If specified, the provided file attributes shall be set. Default value:
+ ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default.
+ :type file_attributes: str
+ :param file_creation_time: Creation time for the file/directory. Default value: Now.
+ :type file_creation_time: str
+ :param file_last_write_time: Last write time for the file/directory. Default value: Now.
+ :type file_last_write_time: str
+ :param file_http_headers: Parameter group.
+ :type file_http_headers: ~azure.storage.fileshare.models.FileHTTPHeaders
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _file_content_type = None
+ _file_content_encoding = None
+ _file_content_language = None
+ _file_cache_control = None
+ _file_content_md5 = None
+ _file_content_disposition = None
+ _lease_id = None
+ if file_http_headers is not None:
+ _file_content_type = file_http_headers.file_content_type
+ _file_content_encoding = file_http_headers.file_content_encoding
+ _file_content_language = file_http_headers.file_content_language
+ _file_cache_control = file_http_headers.file_cache_control
+ _file_content_md5 = file_http_headers.file_content_md5
+ _file_content_disposition = file_http_headers.file_content_disposition
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ comp = "properties"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.set_http_headers.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if file_content_length is not None:
+ header_parameters['x-ms-content-length'] = self._serialize.header("file_content_length", file_content_length, 'long')
+ if _file_content_type is not None:
+ header_parameters['x-ms-content-type'] = self._serialize.header("file_content_type", _file_content_type, 'str')
+ if _file_content_encoding is not None:
+ header_parameters['x-ms-content-encoding'] = self._serialize.header("file_content_encoding", _file_content_encoding, 'str')
+ if _file_content_language is not None:
+ header_parameters['x-ms-content-language'] = self._serialize.header("file_content_language", _file_content_language, 'str')
+ if _file_cache_control is not None:
+ header_parameters['x-ms-cache-control'] = self._serialize.header("file_cache_control", _file_cache_control, 'str')
+ if _file_content_md5 is not None:
+ header_parameters['x-ms-content-md5'] = self._serialize.header("file_content_md5", _file_content_md5, 'bytearray')
+ if _file_content_disposition is not None:
+ header_parameters['x-ms-content-disposition'] = self._serialize.header("file_content_disposition", _file_content_disposition, 'str')
+ if file_permission is not None:
+ header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str')
+ if file_permission_key is not None:
+ header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str')
+ header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str')
+ header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str')
+ header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+ response_headers['x-ms-file-attributes']=self._deserialize('str', response.headers.get('x-ms-file-attributes'))
+ response_headers['x-ms-file-creation-time']=self._deserialize('str', response.headers.get('x-ms-file-creation-time'))
+ response_headers['x-ms-file-last-write-time']=self._deserialize('str', response.headers.get('x-ms-file-last-write-time'))
+ response_headers['x-ms-file-change-time']=self._deserialize('str', response.headers.get('x-ms-file-change-time'))
+ response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id'))
+ response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ set_http_headers.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ async def set_metadata(
+ self,
+ timeout: Optional[int] = None,
+ metadata: Optional[str] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> None:
+ """Updates user-defined metadata for the specified file.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param metadata: A name-value pair to associate with a file storage object.
+ :type metadata: str
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ comp = "metadata"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.set_metadata.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ if metadata is not None:
+ header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ set_metadata.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ async def acquire_lease(
+ self,
+ timeout: Optional[int] = None,
+ duration: Optional[int] = None,
+ proposed_lease_id: Optional[str] = None,
+ request_id_parameter: Optional[str] = None,
+ **kwargs
+ ) -> None:
+ """[Update] The Lease File operation establishes and manages a lock on a file for write and delete
+ operations.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param duration: Specifies the duration of the lease, in seconds, or negative one (-1) for a
+ lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease
+ duration cannot be changed using renew or change.
+ :type duration: int
+ :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns
+ 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid
+ Constructor (String) for a list of valid GUID string formats.
+ :type proposed_lease_id: str
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ comp = "lease"
+ action = "acquire"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.acquire_lease.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
+ if duration is not None:
+ header_parameters['x-ms-lease-duration'] = self._serialize.header("duration", duration, 'int')
+ if proposed_lease_id is not None:
+ header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [201]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ acquire_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ async def release_lease(
+ self,
+ lease_id: str,
+ timeout: Optional[int] = None,
+ request_id_parameter: Optional[str] = None,
+ **kwargs
+ ) -> None:
+ """[Update] The Lease File operation establishes and manages a lock on a file for write and delete
+ operations.
+
+ :param lease_id: Specifies the current lease ID on the resource.
+ :type lease_id: str
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ comp = "lease"
+ action = "release"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.release_lease.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ release_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ async def change_lease(
+ self,
+ lease_id: str,
+ timeout: Optional[int] = None,
+ proposed_lease_id: Optional[str] = None,
+ request_id_parameter: Optional[str] = None,
+ **kwargs
+ ) -> None:
+ """[Update] The Lease File operation establishes and manages a lock on a file for write and delete
+ operations.
+
+ :param lease_id: Specifies the current lease ID on the resource.
+ :type lease_id: str
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns
+ 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid
+ Constructor (String) for a list of valid GUID string formats.
+ :type proposed_lease_id: str
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ comp = "lease"
+ action = "change"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.change_lease.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ if proposed_lease_id is not None:
+ header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ change_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ async def break_lease(
+ self,
+ timeout: Optional[int] = None,
+ request_id_parameter: Optional[str] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> None:
+ """[Update] The Lease File operation establishes and manages a lock on a file for write and delete
+ operations.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ comp = "lease"
+ action = "break"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.break_lease.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [202]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ break_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ async def upload_range(
+ self,
+ range: str,
+ content_length: int,
+ optionalbody: IO,
+ timeout: Optional[int] = None,
+ file_range_write: Union[str, "_models.FileRangeWriteType"] = "update",
+ content_md5: Optional[bytearray] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> None:
+ """Upload a range of bytes to a file.
+
+ :param range: Specifies the range of bytes to be written. Both the start and end of the range
+ must be specified. For an update operation, the range can be up to 4 MB in size. For a clear
+ operation, the range can be up to the value of the file's full size. The File service accepts
+ only a single byte range for the Range and 'x-ms-range' headers, and the byte range must be
+ specified in the following format: bytes=startByte-endByte.
+ :type range: str
+ :param content_length: Specifies the number of bytes being transmitted in the request body.
+ When the x-ms-write header is set to clear, the value of this header must be set to zero.
+ :type content_length: long
+ :param optionalbody: Initial data.
+ :type optionalbody: IO
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param file_range_write: Specify one of the following options: - Update: Writes the bytes
+ specified by the request body into the specified range. The Range and Content-Length headers
+ must match to perform the update. - Clear: Clears the specified range and releases the space
+ used in storage for that range. To clear a range, set the Content-Length header to zero, and
+ set the Range header to a value that indicates the range to clear, up to maximum file size.
+ :type file_range_write: str or ~azure.storage.fileshare.models.FileRangeWriteType
+ :param content_md5: An MD5 hash of the content. This hash is used to verify the integrity of
+ the data during transport. When the Content-MD5 header is specified, the File service compares
+ the hash of the content that has arrived with the header value that was sent. If the two hashes
+ do not match, the operation will fail with error code 400 (Bad Request).
+ :type content_md5: bytearray
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ comp = "range"
+ content_type = kwargs.pop("content_type", "application/octet-stream")
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.upload_range.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str')
+ header_parameters['x-ms-write'] = self._serialize.header("file_range_write", file_range_write, 'str')
+ header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long')
+ if content_md5 is not None:
+ header_parameters['Content-MD5'] = self._serialize.header("content_md5", content_md5, 'bytearray')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ body_content_kwargs = {} # type: Dict[str, Any]
+ body_content_kwargs['stream_content'] = optionalbody
+ request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [201]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['Content-MD5']=self._deserialize('bytearray', response.headers.get('Content-MD5'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ upload_range.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ async def upload_range_from_url(
+ self,
+ range: str,
+ copy_source: str,
+ content_length: int,
+ timeout: Optional[int] = None,
+ source_range: Optional[str] = None,
+ source_content_crc64: Optional[bytearray] = None,
+ source_modified_access_conditions: Optional["_models.SourceModifiedAccessConditions"] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> None:
+ """Upload a range of bytes to a file where the contents are read from a URL.
+
+ :param range: Writes data to the specified byte range in the file.
+ :type range: str
+ :param copy_source: Specifies the URL of the source file or blob, up to 2 KB in length. To copy
+ a file to another file within the same storage account, you may use Shared Key to authenticate
+ the source file. If you are copying a file from another storage account, or if you are copying
+ a blob from the same storage account or another storage account, then you must authenticate the
+ source file or blob using a shared access signature. If the source is a public blob, no
+ authentication is required to perform the copy operation. A file in a share snapshot can also
+ be specified as a copy source.
+ :type copy_source: str
+ :param content_length: Specifies the number of bytes being transmitted in the request body.
+ When the x-ms-write header is set to clear, the value of this header must be set to zero.
+ :type content_length: long
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param source_range: Bytes of source data in the specified range.
+ :type source_range: str
+ :param source_content_crc64: Specify the crc64 calculated for the range of bytes that must be
+ read from the copy source.
+ :type source_content_crc64: bytearray
+ :param source_modified_access_conditions: Parameter group.
+ :type source_modified_access_conditions: ~azure.storage.fileshare.models.SourceModifiedAccessConditions
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _source_if_match_crc64 = None
+ _source_if_none_match_crc64 = None
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ if source_modified_access_conditions is not None:
+ _source_if_match_crc64 = source_modified_access_conditions.source_if_match_crc64
+ _source_if_none_match_crc64 = source_modified_access_conditions.source_if_none_match_crc64
+ comp = "range"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.upload_range_from_url.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str')
+ header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str')
+ if source_range is not None:
+ header_parameters['x-ms-source-range'] = self._serialize.header("source_range", source_range, 'str')
+ header_parameters['x-ms-write'] = self._serialize.header("self._config.file_range_write_from_url", self._config.file_range_write_from_url, 'str')
+ header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long')
+ if source_content_crc64 is not None:
+ header_parameters['x-ms-source-content-crc64'] = self._serialize.header("source_content_crc64", source_content_crc64, 'bytearray')
+ if _source_if_match_crc64 is not None:
+ header_parameters['x-ms-source-if-match-crc64'] = self._serialize.header("source_if_match_crc64", _source_if_match_crc64, 'bytearray')
+ if _source_if_none_match_crc64 is not None:
+ header_parameters['x-ms-source-if-none-match-crc64'] = self._serialize.header("source_if_none_match_crc64", _source_if_none_match_crc64, 'bytearray')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [201]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-content-crc64']=self._deserialize('bytearray', response.headers.get('x-ms-content-crc64'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ upload_range_from_url.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ async def get_range_list(
+ self,
+ sharesnapshot: Optional[str] = None,
+ prevsharesnapshot: Optional[str] = None,
+ timeout: Optional[int] = None,
+ range: Optional[str] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> "_models.ShareFileRangeList":
+ """Returns the list of valid ranges for a file.
+
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
+ :type sharesnapshot: str
+ :param prevsharesnapshot: The previous snapshot parameter is an opaque DateTime value that,
+ when present, specifies the previous snapshot.
+ :type prevsharesnapshot: str
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param range: Specifies the range of bytes over which to list ranges, inclusively.
+ :type range: str
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ShareFileRangeList, or the result of cls(response)
+ :rtype: ~azure.storage.fileshare.models.ShareFileRangeList
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareFileRangeList"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ comp = "rangelist"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.get_range_list.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if sharesnapshot is not None:
+ query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
+ if prevsharesnapshot is not None:
+ query_parameters['prevsharesnapshot'] = self._serialize.query("prevsharesnapshot", prevsharesnapshot, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if range is not None:
+ header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['x-ms-content-length']=self._deserialize('long', response.headers.get('x-ms-content-length'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('ShareFileRangeList', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+ get_range_list.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ async def start_copy(
+ self,
+ copy_source: str,
+ timeout: Optional[int] = None,
+ metadata: Optional[str] = None,
+ file_permission: Optional[str] = "inherit",
+ file_permission_key: Optional[str] = None,
+ copy_file_smb_info: Optional["_models.CopyFileSmbInfo"] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> None:
+ """Copies a blob or file to a destination file within the storage account.
+
+ :param copy_source: Specifies the URL of the source file or blob, up to 2 KB in length. To copy
+ a file to another file within the same storage account, you may use Shared Key to authenticate
+ the source file. If you are copying a file from another storage account, or if you are copying
+ a blob from the same storage account or another storage account, then you must authenticate the
+ source file or blob using a shared access signature. If the source is a public blob, no
+ authentication is required to perform the copy operation. A file in a share snapshot can also
+ be specified as a copy source.
+ :type copy_source: str
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param metadata: A name-value pair to associate with a file storage object.
+ :type metadata: str
+ :param file_permission: If specified the permission (security descriptor) shall be set for the
+ directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-
+ permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it
+ must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-
+ permission-key should be specified.
+ :type file_permission: str
+ :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only
+ one of the x-ms-file-permission or x-ms-file-permission-key should be specified.
+ :type file_permission_key: str
+ :param copy_file_smb_info: Parameter group.
+ :type copy_file_smb_info: ~azure.storage.fileshare.models.CopyFileSmbInfo
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _file_permission_copy_mode = None
+ _ignore_read_only = None
+ _file_attributes = None
+ _file_creation_time = None
+ _file_last_write_time = None
+ _set_archive_attribute = None
+ _lease_id = None
+ if copy_file_smb_info is not None:
+ _file_permission_copy_mode = copy_file_smb_info.file_permission_copy_mode
+ _ignore_read_only = copy_file_smb_info.ignore_read_only
+ _file_attributes = copy_file_smb_info.file_attributes
+ _file_creation_time = copy_file_smb_info.file_creation_time
+ _file_last_write_time = copy_file_smb_info.file_last_write_time
+ _set_archive_attribute = copy_file_smb_info.set_archive_attribute
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.start_copy.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if metadata is not None:
+ header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
+ header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str')
+ if file_permission is not None:
+ header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str')
+ if file_permission_key is not None:
+ header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str')
+ if _file_permission_copy_mode is not None:
+ header_parameters['x-ms-file-permission-copy-mode'] = self._serialize.header("file_permission_copy_mode", _file_permission_copy_mode, 'str')
+ if _ignore_read_only is not None:
+ header_parameters['x-ms-file-copy-ignore-read-only'] = self._serialize.header("ignore_read_only", _ignore_read_only, 'bool')
+ if _file_attributes is not None:
+ header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", _file_attributes, 'str')
+ if _file_creation_time is not None:
+ header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", _file_creation_time, 'str')
+ if _file_last_write_time is not None:
+ header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", _file_last_write_time, 'str')
+ if _set_archive_attribute is not None:
+ header_parameters['x-ms-file-copy-set-archive'] = self._serialize.header("set_archive_attribute", _set_archive_attribute, 'bool')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [202]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-copy-id']=self._deserialize('str', response.headers.get('x-ms-copy-id'))
+ response_headers['x-ms-copy-status']=self._deserialize('str', response.headers.get('x-ms-copy-status'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ start_copy.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ async def abort_copy(
+ self,
+ copy_id: str,
+ timeout: Optional[int] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> None:
+ """Aborts a pending Copy File operation, and leaves a destination file with zero length and full
+ metadata.
+
+ :param copy_id: The copy identifier provided in the x-ms-copy-id header of the original Copy
+ File operation.
+ :type copy_id: str
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ comp = "copy"
+ copy_action_abort_constant = "abort"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.abort_copy.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ query_parameters['copyid'] = self._serialize.query("copy_id", copy_id, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-copy-action'] = self._serialize.header("copy_action_abort_constant", copy_action_abort_constant, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ abort_copy.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ async def list_handles(
+ self,
+ marker: Optional[str] = None,
+ maxresults: Optional[int] = None,
+ timeout: Optional[int] = None,
+ sharesnapshot: Optional[str] = None,
+ **kwargs
+ ) -> "_models.ListHandlesResponse":
+ """Lists handles for file.
+
+ :param marker: A string value that identifies the portion of the list to be returned with the
+ next list operation. The operation returns a marker value within the response body if the list
+ returned was not complete. The marker value may then be used in a subsequent call to request
+ the next set of list items. The marker value is opaque to the client.
+ :type marker: str
+ :param maxresults: Specifies the maximum number of entries to return. If the request does not
+ specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000
+ items.
+ :type maxresults: int
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
+ :type sharesnapshot: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ListHandlesResponse, or the result of cls(response)
+ :rtype: ~azure.storage.fileshare.models.ListHandlesResponse
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListHandlesResponse"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ comp = "listhandles"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.list_handles.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if marker is not None:
+ query_parameters['marker'] = self._serialize.query("marker", marker, 'str')
+ if maxresults is not None:
+ query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1)
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+ if sharesnapshot is not None:
+ query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('ListHandlesResponse', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+ list_handles.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ async def force_close_handles(
+ self,
+ handle_id: str,
+ timeout: Optional[int] = None,
+ marker: Optional[str] = None,
+ sharesnapshot: Optional[str] = None,
+ **kwargs
+ ) -> None:
+ """Closes all handles open for given file.
+
+ :param handle_id: Specifies handle ID opened on the file or directory to be closed. Asterisk
+ (‘*’) is a wildcard that specifies all handles.
+ :type handle_id: str
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param marker: A string value that identifies the portion of the list to be returned with the
+ next list operation. The operation returns a marker value within the response body if the list
+ returned was not complete. The marker value may then be used in a subsequent call to request
+ the next set of list items. The marker value is opaque to the client.
+ :type marker: str
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
+ :type sharesnapshot: str
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ comp = "forceclosehandles"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.force_close_handles.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+ if marker is not None:
+ query_parameters['marker'] = self._serialize.query("marker", marker, 'str')
+ if sharesnapshot is not None:
+ query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-handle-id'] = self._serialize.header("handle_id", handle_id, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-marker']=self._deserialize('str', response.headers.get('x-ms-marker'))
+ response_headers['x-ms-number-of-handles-closed']=self._deserialize('int', response.headers.get('x-ms-number-of-handles-closed'))
+ response_headers['x-ms-number-of-handles-failed']=self._deserialize('int', response.headers.get('x-ms-number-of-handles-failed'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ force_close_handles.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py
new file mode 100644
index 000000000000..7d5bf3084ba5
--- /dev/null
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py
@@ -0,0 +1,269 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union
+import warnings
+
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
+
+from ... import models as _models
+
+T = TypeVar('T')
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+class ServiceOperations:
+ """ServiceOperations async operations.
+
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~azure.storage.fileshare.models
+ :param client: Client for service requests.
+ :param config: Configuration of service client.
+ :param serializer: An object model serializer.
+ :param deserializer: An object model deserializer.
+ """
+
+ models = _models
+
+ def __init__(self, client, config, serializer, deserializer) -> None:
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ async def set_properties(
+ self,
+ storage_service_properties: "_models.StorageServiceProperties",
+ timeout: Optional[int] = None,
+ **kwargs
+ ) -> None:
+ """Sets properties for a storage account's File service endpoint, including properties for Storage
+ Analytics metrics and CORS (Cross-Origin Resource Sharing) rules.
+
+ :param storage_service_properties: The StorageService properties.
+ :type storage_service_properties: ~azure.storage.fileshare.models.StorageServiceProperties
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "service"
+ comp = "properties"
+ content_type = kwargs.pop("content_type", "application/xml")
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.set_properties.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ body_content_kwargs = {} # type: Dict[str, Any]
+ body_content = self._serialize.body(storage_service_properties, 'StorageServiceProperties', is_xml=True)
+ body_content_kwargs['content'] = body_content
+ request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [202]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ set_properties.metadata = {'url': '/'} # type: ignore
+
+ async def get_properties(
+ self,
+ timeout: Optional[int] = None,
+ **kwargs
+ ) -> "_models.StorageServiceProperties":
+ """Gets the properties of a storage account's File service, including properties for Storage
+ Analytics metrics and CORS (Cross-Origin Resource Sharing) rules.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: StorageServiceProperties, or the result of cls(response)
+ :rtype: ~azure.storage.fileshare.models.StorageServiceProperties
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageServiceProperties"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "service"
+ comp = "properties"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.get_properties.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ deserialized = self._deserialize('StorageServiceProperties', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+ get_properties.metadata = {'url': '/'} # type: ignore
+
+ async def list_shares_segment(
+ self,
+ prefix: Optional[str] = None,
+ marker: Optional[str] = None,
+ maxresults: Optional[int] = None,
+ include: Optional[List[Union[str, "_models.ListSharesIncludeType"]]] = None,
+ timeout: Optional[int] = None,
+ **kwargs
+ ) -> "_models.ListSharesResponse":
+ """The List Shares Segment operation returns a list of the shares and share snapshots under the
+ specified account.
+
+ :param prefix: Filters the results to return only entries whose name begins with the specified
+ prefix.
+ :type prefix: str
+ :param marker: A string value that identifies the portion of the list to be returned with the
+ next list operation. The operation returns a marker value within the response body if the list
+ returned was not complete. The marker value may then be used in a subsequent call to request
+ the next set of list items. The marker value is opaque to the client.
+ :type marker: str
+ :param maxresults: Specifies the maximum number of entries to return. If the request does not
+ specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000
+ items.
+ :type maxresults: int
+ :param include: Include this parameter to specify one or more datasets to include in the
+ response.
+ :type include: list[str or ~azure.storage.fileshare.models.ListSharesIncludeType]
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ListSharesResponse, or the result of cls(response)
+ :rtype: ~azure.storage.fileshare.models.ListSharesResponse
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListSharesResponse"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ comp = "list"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.list_shares_segment.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if prefix is not None:
+ query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str')
+ if marker is not None:
+ query_parameters['marker'] = self._serialize.query("marker", marker, 'str')
+ if maxresults is not None:
+ query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1)
+ if include is not None:
+ query_parameters['include'] = self._serialize.query("include", include, '[str]', div=',')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ deserialized = self._deserialize('ListSharesResponse', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+ list_shares_segment.metadata = {'url': '/'} # type: ignore
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py
new file mode 100644
index 000000000000..7dc9b8f2d06c
--- /dev/null
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py
@@ -0,0 +1,1485 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union
+import warnings
+
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
+
+from ... import models as _models
+
+T = TypeVar('T')
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+class ShareOperations:
+ """ShareOperations async operations.
+
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~azure.storage.fileshare.models
+ :param client: Client for service requests.
+ :param config: Configuration of service client.
+ :param serializer: An object model serializer.
+ :param deserializer: An object model deserializer.
+ """
+
+ models = _models
+
+ def __init__(self, client, config, serializer, deserializer) -> None:
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ async def create(
+ self,
+ timeout: Optional[int] = None,
+ metadata: Optional[str] = None,
+ quota: Optional[int] = None,
+ access_tier: Optional[Union[str, "_models.ShareAccessTier"]] = None,
+ enabled_protocols: Optional[str] = None,
+ root_squash: Optional[Union[str, "_models.ShareRootSquash"]] = None,
+ **kwargs
+ ) -> None:
+ """Creates a new share under the specified account. If the share with the same name already
+ exists, the operation fails.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param metadata: A name-value pair to associate with a file storage object.
+ :type metadata: str
+ :param quota: Specifies the maximum size of the share, in gigabytes.
+ :type quota: int
+ :param access_tier: Specifies the access tier of the share.
+ :type access_tier: str or ~azure.storage.fileshare.models.ShareAccessTier
+ :param enabled_protocols: Protocols to enable on the share.
+ :type enabled_protocols: str
+ :param root_squash: Root squash to set on the share. Only valid for NFS shares.
+ :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "share"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.create.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ if metadata is not None:
+ header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
+ if quota is not None:
+ header_parameters['x-ms-share-quota'] = self._serialize.header("quota", quota, 'int', minimum=1)
+ if access_tier is not None:
+ header_parameters['x-ms-access-tier'] = self._serialize.header("access_tier", access_tier, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if enabled_protocols is not None:
+ header_parameters['x-ms-enabled-protocols'] = self._serialize.header("enabled_protocols", enabled_protocols, 'str')
+ if root_squash is not None:
+ header_parameters['x-ms-root-squash'] = self._serialize.header("root_squash", root_squash, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [201]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ create.metadata = {'url': '/{shareName}'} # type: ignore
+
+ async def get_properties(
+ self,
+ sharesnapshot: Optional[str] = None,
+ timeout: Optional[int] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> None:
+ """Returns all user-defined metadata and system properties for the specified share or share
+ snapshot. The data returned does not include the share's list of files.
+
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
+ :type sharesnapshot: str
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ restype = "share"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.get_properties.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ if sharesnapshot is not None:
+ query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta'))
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-share-quota']=self._deserialize('int', response.headers.get('x-ms-share-quota'))
+ response_headers['x-ms-share-provisioned-iops']=self._deserialize('int', response.headers.get('x-ms-share-provisioned-iops'))
+ response_headers['x-ms-share-provisioned-ingress-mbps']=self._deserialize('int', response.headers.get('x-ms-share-provisioned-ingress-mbps'))
+ response_headers['x-ms-share-provisioned-egress-mbps']=self._deserialize('int', response.headers.get('x-ms-share-provisioned-egress-mbps'))
+ response_headers['x-ms-share-next-allowed-quota-downgrade-time']=self._deserialize('rfc-1123', response.headers.get('x-ms-share-next-allowed-quota-downgrade-time'))
+ response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration'))
+ response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state'))
+ response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status'))
+ response_headers['x-ms-access-tier']=self._deserialize('str', response.headers.get('x-ms-access-tier'))
+ response_headers['x-ms-access-tier-change-time']=self._deserialize('rfc-1123', response.headers.get('x-ms-access-tier-change-time'))
+ response_headers['x-ms-access-tier-transition-state']=self._deserialize('str', response.headers.get('x-ms-access-tier-transition-state'))
+ response_headers['x-ms-enabled-protocols']=self._deserialize('str', response.headers.get('x-ms-enabled-protocols'))
+ response_headers['x-ms-root-squash']=self._deserialize('str', response.headers.get('x-ms-root-squash'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ get_properties.metadata = {'url': '/{shareName}'} # type: ignore
+
+ async def delete(
+ self,
+ sharesnapshot: Optional[str] = None,
+ timeout: Optional[int] = None,
+ delete_snapshots: Optional[Union[str, "_models.DeleteSnapshotsOptionType"]] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> None:
+ """Operation marks the specified share or share snapshot for deletion. The share or share snapshot
+ and any files contained within it are later deleted during garbage collection.
+
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
+ :type sharesnapshot: str
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param delete_snapshots: Specifies the option include to delete the base share and all of its
+ snapshots.
+ :type delete_snapshots: str or ~azure.storage.fileshare.models.DeleteSnapshotsOptionType
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ restype = "share"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.delete.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ if sharesnapshot is not None:
+ query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if delete_snapshots is not None:
+ header_parameters['x-ms-delete-snapshots'] = self._serialize.header("delete_snapshots", delete_snapshots, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.delete(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [202]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ delete.metadata = {'url': '/{shareName}'} # type: ignore
+
+ async def acquire_lease(
+ self,
+ timeout: Optional[int] = None,
+ duration: Optional[int] = None,
+ proposed_lease_id: Optional[str] = None,
+ sharesnapshot: Optional[str] = None,
+ request_id_parameter: Optional[str] = None,
+ **kwargs
+ ) -> None:
+ """The Lease Share operation establishes and manages a lock on a share, or the specified snapshot
+ for set and delete share operations.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param duration: Specifies the duration of the lease, in seconds, or negative one (-1) for a
+ lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease
+ duration cannot be changed using renew or change.
+ :type duration: int
+ :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns
+ 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid
+ Constructor (String) for a list of valid GUID string formats.
+ :type proposed_lease_id: str
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
+ :type sharesnapshot: str
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ comp = "lease"
+ action = "acquire"
+ restype = "share"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.acquire_lease.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+ if sharesnapshot is not None:
+ query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
+ if duration is not None:
+ header_parameters['x-ms-lease-duration'] = self._serialize.header("duration", duration, 'int')
+ if proposed_lease_id is not None:
+ header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [201]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ acquire_lease.metadata = {'url': '/{shareName}'} # type: ignore
+
+ async def release_lease(
+ self,
+ lease_id: str,
+ timeout: Optional[int] = None,
+ sharesnapshot: Optional[str] = None,
+ request_id_parameter: Optional[str] = None,
+ **kwargs
+ ) -> None:
+ """The Lease Share operation establishes and manages a lock on a share, or the specified snapshot
+ for set and delete share operations.
+
+ :param lease_id: Specifies the current lease ID on the resource.
+ :type lease_id: str
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
+ :type sharesnapshot: str
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ comp = "lease"
+ action = "release"
+ restype = "share"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.release_lease.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+ if sharesnapshot is not None:
+ query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ release_lease.metadata = {'url': '/{shareName}'} # type: ignore
+
+ async def change_lease(
+ self,
+ lease_id: str,
+ timeout: Optional[int] = None,
+ proposed_lease_id: Optional[str] = None,
+ sharesnapshot: Optional[str] = None,
+ request_id_parameter: Optional[str] = None,
+ **kwargs
+ ) -> None:
+ """The Lease Share operation establishes and manages a lock on a share, or the specified snapshot
+ for set and delete share operations.
+
+ :param lease_id: Specifies the current lease ID on the resource.
+ :type lease_id: str
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns
+ 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid
+ Constructor (String) for a list of valid GUID string formats.
+ :type proposed_lease_id: str
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
+ :type sharesnapshot: str
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ comp = "lease"
+ action = "change"
+ restype = "share"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.change_lease.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+ if sharesnapshot is not None:
+ query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ if proposed_lease_id is not None:
+ header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ change_lease.metadata = {'url': '/{shareName}'} # type: ignore
+
+ async def renew_lease(
+ self,
+ lease_id: str,
+ timeout: Optional[int] = None,
+ sharesnapshot: Optional[str] = None,
+ request_id_parameter: Optional[str] = None,
+ **kwargs
+ ) -> None:
+ """The Lease Share operation establishes and manages a lock on a share, or the specified snapshot
+ for set and delete share operations.
+
+ :param lease_id: Specifies the current lease ID on the resource.
+ :type lease_id: str
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
+ :type sharesnapshot: str
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ comp = "lease"
+ action = "renew"
+ restype = "share"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.renew_lease.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+ if sharesnapshot is not None:
+ query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ renew_lease.metadata = {'url': '/{shareName}'} # type: ignore
+
+ async def break_lease(
+ self,
+ timeout: Optional[int] = None,
+ break_period: Optional[int] = None,
+ request_id_parameter: Optional[str] = None,
+ sharesnapshot: Optional[str] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> None:
+ """The Lease Share operation establishes and manages a lock on a share, or the specified snapshot
+ for set and delete share operations.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param break_period: For a break operation, proposed duration the lease should continue before
+ it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter
+ than the time remaining on the lease. If longer, the time remaining on the lease is used. A new
+ lease will not be available before the break period has expired, but the lease may be held for
+ longer than the break period. If this header does not appear with a break operation, a fixed-
+ duration lease breaks after the remaining lease period elapses, and an infinite lease breaks
+ immediately.
+ :type break_period: int
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
+ :type sharesnapshot: str
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ comp = "lease"
+ action = "break"
+ restype = "share"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.break_lease.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+ if sharesnapshot is not None:
+ query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
+ if break_period is not None:
+ header_parameters['x-ms-lease-break-period'] = self._serialize.header("break_period", break_period, 'int')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [202]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-lease-time']=self._deserialize('int', response.headers.get('x-ms-lease-time'))
+ response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ break_lease.metadata = {'url': '/{shareName}'} # type: ignore
+
+ async def create_snapshot(
+ self,
+ timeout: Optional[int] = None,
+ metadata: Optional[str] = None,
+ **kwargs
+ ) -> None:
+ """Creates a read-only snapshot of a share.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param metadata: A name-value pair to associate with a file storage object.
+ :type metadata: str
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "share"
+ comp = "snapshot"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.create_snapshot.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ if metadata is not None:
+ header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [201]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-snapshot']=self._deserialize('str', response.headers.get('x-ms-snapshot'))
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ create_snapshot.metadata = {'url': '/{shareName}'} # type: ignore
+
+ async def create_permission(
+ self,
+ share_permission: "_models.SharePermission",
+ timeout: Optional[int] = None,
+ **kwargs
+ ) -> None:
+ """Create a permission (a security descriptor).
+
+ :param share_permission: A permission (a security descriptor) at the share level.
+ :type share_permission: ~azure.storage.fileshare.models.SharePermission
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "share"
+ comp = "filepermission"
+ content_type = kwargs.pop("content_type", "application/json")
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.create_permission.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ body_content_kwargs = {} # type: Dict[str, Any]
+ body_content = self._serialize.body(share_permission, 'SharePermission')
+ body_content_kwargs['content'] = body_content
+ request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [201]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ create_permission.metadata = {'url': '/{shareName}'} # type: ignore
+
+ async def get_permission(
+ self,
+ file_permission_key: str,
+ timeout: Optional[int] = None,
+ **kwargs
+ ) -> "_models.SharePermission":
+ """Returns the permission (security descriptor) for a given key.
+
+ :param file_permission_key: Key of the permission to be set for the directory/file.
+ :type file_permission_key: str
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: SharePermission, or the result of cls(response)
+ :rtype: ~azure.storage.fileshare.models.SharePermission
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharePermission"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "share"
+ comp = "filepermission"
+ accept = "application/json"
+
+ # Construct URL
+ url = self.get_permission.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('SharePermission', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+ get_permission.metadata = {'url': '/{shareName}'} # type: ignore
+
+ async def set_properties(
+ self,
+ timeout: Optional[int] = None,
+ quota: Optional[int] = None,
+ access_tier: Optional[Union[str, "_models.ShareAccessTier"]] = None,
+ root_squash: Optional[Union[str, "_models.ShareRootSquash"]] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> None:
+ """Sets properties for the specified share.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param quota: Specifies the maximum size of the share, in gigabytes.
+ :type quota: int
+ :param access_tier: Specifies the access tier of the share.
+ :type access_tier: str or ~azure.storage.fileshare.models.ShareAccessTier
+ :param root_squash: Root squash to set on the share. Only valid for NFS shares.
+ :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ restype = "share"
+ comp = "properties"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.set_properties.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if quota is not None:
+ header_parameters['x-ms-share-quota'] = self._serialize.header("quota", quota, 'int', minimum=1)
+ if access_tier is not None:
+ header_parameters['x-ms-access-tier'] = self._serialize.header("access_tier", access_tier, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ if root_squash is not None:
+ header_parameters['x-ms-root-squash'] = self._serialize.header("root_squash", root_squash, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ set_properties.metadata = {'url': '/{shareName}'} # type: ignore
+
+ async def set_metadata(
+ self,
+ timeout: Optional[int] = None,
+ metadata: Optional[str] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> None:
+ """Sets one or more user-defined name-value pairs for the specified share.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param metadata: A name-value pair to associate with a file storage object.
+ :type metadata: str
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ restype = "share"
+ comp = "metadata"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.set_metadata.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ if metadata is not None:
+ header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ set_metadata.metadata = {'url': '/{shareName}'} # type: ignore
+
+ async def get_access_policy(
+ self,
+ timeout: Optional[int] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> List["_models.SignedIdentifier"]:
+ """Returns information about stored access policies specified on the share.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: list of SignedIdentifier, or the result of cls(response)
+ :rtype: list[~azure.storage.fileshare.models.SignedIdentifier]
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[List["_models.SignedIdentifier"]]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ restype = "share"
+ comp = "acl"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.get_access_policy.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('[SignedIdentifier]', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+ get_access_policy.metadata = {'url': '/{shareName}'} # type: ignore
+
+ async def set_access_policy(
+ self,
+ timeout: Optional[int] = None,
+ share_acl: Optional[List["_models.SignedIdentifier"]] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> None:
+ """Sets a stored access policy for use with shared access signatures.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param share_acl: The ACL for the share.
+ :type share_acl: list[~azure.storage.fileshare.models.SignedIdentifier]
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ restype = "share"
+ comp = "acl"
+ content_type = kwargs.pop("content_type", "application/xml")
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.set_access_policy.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ body_content_kwargs = {} # type: Dict[str, Any]
+ serialization_ctxt = {'xml': {'name': 'SignedIdentifiers', 'wrapped': True}}
+ if share_acl is not None:
+ body_content = self._serialize.body(share_acl, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt)
+ else:
+ body_content = None
+ body_content_kwargs['content'] = body_content
+ request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ set_access_policy.metadata = {'url': '/{shareName}'} # type: ignore
+
+ async def get_statistics(
+ self,
+ timeout: Optional[int] = None,
+ lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
+ **kwargs
+ ) -> "_models.ShareStats":
+ """Retrieves statistics related to the share.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ShareStats, or the result of cls(response)
+ :rtype: ~azure.storage.fileshare.models.ShareStats
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareStats"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
+ if lease_access_conditions is not None:
+ _lease_id = lease_access_conditions.lease_id
+ restype = "share"
+ comp = "stats"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.get_statistics.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('ShareStats', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+ get_statistics.metadata = {'url': '/{shareName}'} # type: ignore
+
+ async def restore(
+ self,
+ timeout: Optional[int] = None,
+ request_id_parameter: Optional[str] = None,
+ deleted_share_name: Optional[str] = None,
+ deleted_share_version: Optional[str] = None,
+ **kwargs
+ ) -> None:
+ """Restores a previously deleted Share.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
+ :type timeout: int
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :param deleted_share_name: Specifies the name of the preivously-deleted share.
+ :type deleted_share_name: str
+ :param deleted_share_version: Specifies the version of the preivously-deleted share.
+ :type deleted_share_version: str
+ :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
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "share"
+ comp = "undelete"
+ accept = "application/xml"
+
+ # Construct URL
+ url = self.restore.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ if deleted_share_name is not None:
+ header_parameters['x-ms-deleted-share-name'] = self._serialize.header("deleted_share_name", deleted_share_name, 'str')
+ if deleted_share_version is not None:
+ header_parameters['x-ms-deleted-share-version'] = self._serialize.header("deleted_share_version", deleted_share_version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [201]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+
+ restore.metadata = {'url': '/{shareName}'} # type: ignore
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/_directory_operations_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/_directory_operations_async.py
deleted file mode 100644
index 26a962f8df72..000000000000
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/_directory_operations_async.py
+++ /dev/null
@@ -1,672 +0,0 @@
-# coding=utf-8
-# --------------------------------------------------------------------------
-# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
-# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
-# --------------------------------------------------------------------------
-
-from azure.core.exceptions import map_error
-
-from ... import models
-
-
-class DirectoryOperations:
- """DirectoryOperations async operations.
-
- You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
-
- :param client: Client for service requests.
- :param config: Configuration of service client.
- :param serializer: An object model serializer.
- :param deserializer: An object model deserializer.
- :ivar restype: . Constant value: "directory".
- """
-
- models = models
-
- def __init__(self, client, config, serializer, deserializer) -> None:
-
- self._client = client
- self._serialize = serializer
- self._deserialize = deserializer
-
- self._config = config
- self.restype = "directory"
-
- async def create(self, file_attributes="none", file_creation_time="now", file_last_write_time="now", timeout=None, metadata=None, file_permission="inherit", file_permission_key=None, *, cls=None, **kwargs):
- """Creates a new directory under the specified share or parent directory.
-
- :param file_attributes: If specified, the provided file attributes
- shall be set. Default value: ‘Archive’ for file and ‘Directory’ for
- directory. ‘None’ can also be specified as default.
- :type file_attributes: str
- :param file_creation_time: Creation time for the file/directory.
- Default value: Now.
- :type file_creation_time: str
- :param file_last_write_time: Last write time for the file/directory.
- Default value: Now.
- :type file_last_write_time: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param metadata: A name-value pair to associate with a file storage
- object.
- :type metadata: str
- :param file_permission: If specified the permission (security
- descriptor) shall be set for the directory/file. This header can be
- used if Permission size is <= 8KB, else x-ms-file-permission-key
- header shall be used. Default value: Inherit. If SDDL is specified as
- input, it must have owner, group and dacl. Note: Only one of the
- x-ms-file-permission or x-ms-file-permission-key should be specified.
- :type file_permission: str
- :param file_permission_key: Key of the permission to be set for the
- directory/file. Note: Only one of the x-ms-file-permission or
- x-ms-file-permission-key should be specified.
- :type file_permission_key: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- # Construct URL
- url = self.create.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
-
- # Construct headers
- header_parameters = {}
- if metadata is not None:
- header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if file_permission is not None:
- header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str')
- if file_permission_key is not None:
- header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str')
- header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str')
- header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str')
- header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [201]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-file-attributes': self._deserialize('str', response.headers.get('x-ms-file-attributes')),
- 'x-ms-file-creation-time': self._deserialize('str', response.headers.get('x-ms-file-creation-time')),
- 'x-ms-file-last-write-time': self._deserialize('str', response.headers.get('x-ms-file-last-write-time')),
- 'x-ms-file-change-time': self._deserialize('str', response.headers.get('x-ms-file-change-time')),
- 'x-ms-file-id': self._deserialize('str', response.headers.get('x-ms-file-id')),
- 'x-ms-file-parent-id': self._deserialize('str', response.headers.get('x-ms-file-parent-id')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- create.metadata = {'url': '/{shareName}/{directory}'}
-
- async def get_properties(self, sharesnapshot=None, timeout=None, *, cls=None, **kwargs):
- """Returns all system properties for the specified directory, and can also
- be used to check the existence of a directory. The data returned does
- not include the files in the directory or any subdirectories.
-
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
- :type sharesnapshot: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- # Construct URL
- url = self.get_properties.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if sharesnapshot is not None:
- query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
-
- # Construct and send request
- request = self._client.get(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')),
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-server-encrypted')),
- 'x-ms-file-attributes': self._deserialize('str', response.headers.get('x-ms-file-attributes')),
- 'x-ms-file-creation-time': self._deserialize('str', response.headers.get('x-ms-file-creation-time')),
- 'x-ms-file-last-write-time': self._deserialize('str', response.headers.get('x-ms-file-last-write-time')),
- 'x-ms-file-change-time': self._deserialize('str', response.headers.get('x-ms-file-change-time')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-file-id': self._deserialize('str', response.headers.get('x-ms-file-id')),
- 'x-ms-file-parent-id': self._deserialize('str', response.headers.get('x-ms-file-parent-id')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- get_properties.metadata = {'url': '/{shareName}/{directory}'}
-
- async def delete(self, timeout=None, *, cls=None, **kwargs):
- """Removes the specified empty directory. Note that the directory must be
- empty before it can be deleted.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- # Construct URL
- url = self.delete.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
-
- # Construct and send request
- request = self._client.delete(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [202]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- delete.metadata = {'url': '/{shareName}/{directory}'}
-
- async def set_properties(self, file_attributes="none", file_creation_time="now", file_last_write_time="now", timeout=None, file_permission="inherit", file_permission_key=None, *, cls=None, **kwargs):
- """Sets properties on the directory.
-
- :param file_attributes: If specified, the provided file attributes
- shall be set. Default value: ‘Archive’ for file and ‘Directory’ for
- directory. ‘None’ can also be specified as default.
- :type file_attributes: str
- :param file_creation_time: Creation time for the file/directory.
- Default value: Now.
- :type file_creation_time: str
- :param file_last_write_time: Last write time for the file/directory.
- Default value: Now.
- :type file_last_write_time: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param file_permission: If specified the permission (security
- descriptor) shall be set for the directory/file. This header can be
- used if Permission size is <= 8KB, else x-ms-file-permission-key
- header shall be used. Default value: Inherit. If SDDL is specified as
- input, it must have owner, group and dacl. Note: Only one of the
- x-ms-file-permission or x-ms-file-permission-key should be specified.
- :type file_permission: str
- :param file_permission_key: Key of the permission to be set for the
- directory/file. Note: Only one of the x-ms-file-permission or
- x-ms-file-permission-key should be specified.
- :type file_permission_key: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "properties"
-
- # Construct URL
- url = self.set_properties.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if file_permission is not None:
- header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str')
- if file_permission_key is not None:
- header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str')
- header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str')
- header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str')
- header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-file-attributes': self._deserialize('str', response.headers.get('x-ms-file-attributes')),
- 'x-ms-file-creation-time': self._deserialize('str', response.headers.get('x-ms-file-creation-time')),
- 'x-ms-file-last-write-time': self._deserialize('str', response.headers.get('x-ms-file-last-write-time')),
- 'x-ms-file-change-time': self._deserialize('str', response.headers.get('x-ms-file-change-time')),
- 'x-ms-file-id': self._deserialize('str', response.headers.get('x-ms-file-id')),
- 'x-ms-file-parent-id': self._deserialize('str', response.headers.get('x-ms-file-parent-id')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_properties.metadata = {'url': '/{shareName}/{directory}'}
-
- async def set_metadata(self, timeout=None, metadata=None, *, cls=None, **kwargs):
- """Updates user defined metadata for the specified directory.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param metadata: A name-value pair to associate with a file storage
- object.
- :type metadata: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "metadata"
-
- # Construct URL
- url = self.set_metadata.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- if metadata is not None:
- header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_metadata.metadata = {'url': '/{shareName}/{directory}'}
-
- async def list_files_and_directories_segment(self, prefix=None, sharesnapshot=None, marker=None, maxresults=None, timeout=None, *, cls=None, **kwargs):
- """Returns a list of files or directories under the specified share or
- directory. It lists the contents only for a single level of the
- directory hierarchy.
-
- :param prefix: Filters the results to return only entries whose name
- begins with the specified prefix.
- :type prefix: str
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
- :type sharesnapshot: str
- :param marker: A string value that identifies the portion of the list
- to be returned with the next list operation. The operation returns a
- marker value within the response body if the list returned was not
- complete. The marker value may then be used in a subsequent call to
- request the next set of list items. The marker value is opaque to the
- client.
- :type marker: str
- :param maxresults: Specifies the maximum number of entries to return.
- If the request does not specify maxresults, or specifies a value
- greater than 5,000, the server will return up to 5,000 items.
- :type maxresults: int
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: ListFilesAndDirectoriesSegmentResponse or the result of
- cls(response)
- :rtype:
- ~azure.storage.fileshare.models.ListFilesAndDirectoriesSegmentResponse
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "list"
-
- # Construct URL
- url = self.list_files_and_directories_segment.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if prefix is not None:
- query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str')
- if sharesnapshot is not None:
- query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- if marker is not None:
- query_parameters['marker'] = self._serialize.query("marker", marker, 'str')
- if maxresults is not None:
- query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1)
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
-
- # Construct and send request
- request = self._client.get(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('ListFilesAndDirectoriesSegmentResponse', response)
- header_dict = {
- 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
-
- if cls:
- return cls(response, deserialized, header_dict)
-
- return deserialized
- list_files_and_directories_segment.metadata = {'url': '/{shareName}/{directory}'}
-
- async def list_handles(self, marker=None, maxresults=None, timeout=None, sharesnapshot=None, recursive=None, *, cls=None, **kwargs):
- """Lists handles for directory.
-
- :param marker: A string value that identifies the portion of the list
- to be returned with the next list operation. The operation returns a
- marker value within the response body if the list returned was not
- complete. The marker value may then be used in a subsequent call to
- request the next set of list items. The marker value is opaque to the
- client.
- :type marker: str
- :param maxresults: Specifies the maximum number of entries to return.
- If the request does not specify maxresults, or specifies a value
- greater than 5,000, the server will return up to 5,000 items.
- :type maxresults: int
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
- :type sharesnapshot: str
- :param recursive: Specifies operation should apply to the directory
- specified in the URI, its files, its subdirectories and their files.
- :type recursive: bool
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: ListHandlesResponse or the result of cls(response)
- :rtype: ~azure.storage.fileshare.models.ListHandlesResponse
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "listhandles"
-
- # Construct URL
- url = self.list_handles.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if marker is not None:
- query_parameters['marker'] = self._serialize.query("marker", marker, 'str')
- if maxresults is not None:
- query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1)
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- if sharesnapshot is not None:
- query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
- if recursive is not None:
- header_parameters['x-ms-recursive'] = self._serialize.header("recursive", recursive, 'bool')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
-
- # Construct and send request
- request = self._client.get(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('ListHandlesResponse', response)
- header_dict = {
- 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
-
- if cls:
- return cls(response, deserialized, header_dict)
-
- return deserialized
- list_handles.metadata = {'url': '/{shareName}/{directory}'}
-
- async def force_close_handles(self, handle_id, timeout=None, marker=None, sharesnapshot=None, recursive=None, *, cls=None, **kwargs):
- """Closes all handles open for given directory.
-
- :param handle_id: Specifies handle ID opened on the file or directory
- to be closed. Asterisk (‘*’) is a wildcard that specifies all handles.
- :type handle_id: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param marker: A string value that identifies the portion of the list
- to be returned with the next list operation. The operation returns a
- marker value within the response body if the list returned was not
- complete. The marker value may then be used in a subsequent call to
- request the next set of list items. The marker value is opaque to the
- client.
- :type marker: str
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
- :type sharesnapshot: str
- :param recursive: Specifies operation should apply to the directory
- specified in the URI, its files, its subdirectories and their files.
- :type recursive: bool
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "forceclosehandles"
-
- # Construct URL
- url = self.force_close_handles.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- if marker is not None:
- query_parameters['marker'] = self._serialize.query("marker", marker, 'str')
- if sharesnapshot is not None:
- query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-handle-id'] = self._serialize.header("handle_id", handle_id, 'str')
- if recursive is not None:
- header_parameters['x-ms-recursive'] = self._serialize.header("recursive", recursive, 'bool')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-marker': self._deserialize('str', response.headers.get('x-ms-marker')),
- 'x-ms-number-of-handles-closed': self._deserialize('int', response.headers.get('x-ms-number-of-handles-closed')),
- 'x-ms-number-of-handles-failed': self._deserialize('int', response.headers.get('x-ms-number-of-handles-failed')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- force_close_handles.metadata = {'url': '/{shareName}/{directory}'}
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/_file_operations_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/_file_operations_async.py
deleted file mode 100644
index 51d76143b334..000000000000
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/_file_operations_async.py
+++ /dev/null
@@ -1,1671 +0,0 @@
-# coding=utf-8
-# --------------------------------------------------------------------------
-# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
-# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
-# --------------------------------------------------------------------------
-
-from azure.core.exceptions import map_error
-
-from ... import models
-
-
-class FileOperations:
- """FileOperations async operations.
-
- You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
-
- :param client: Client for service requests.
- :param config: Configuration of service client.
- :param serializer: An object model serializer.
- :param deserializer: An object model deserializer.
- :ivar x_ms_type: Dummy constant parameter, file type can only be file. Constant value: "file".
- :ivar x_ms_copy_action: . Constant value: "abort".
- """
-
- models = models
-
- def __init__(self, client, config, serializer, deserializer) -> None:
-
- self._client = client
- self._serialize = serializer
- self._deserialize = deserializer
-
- self._config = config
- self.x_ms_type = "file"
- self.x_ms_copy_action = "abort"
-
- async def create(self, file_content_length, file_attributes="none", file_creation_time="now", file_last_write_time="now", timeout=None, metadata=None, file_permission="inherit", file_permission_key=None, file_http_headers=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Creates a new file or replaces a file. Note it only initializes the
- file with no content.
-
- :param file_content_length: Specifies the maximum size for the file,
- up to 4 TB.
- :type file_content_length: long
- :param file_attributes: If specified, the provided file attributes
- shall be set. Default value: ‘Archive’ for file and ‘Directory’ for
- directory. ‘None’ can also be specified as default.
- :type file_attributes: str
- :param file_creation_time: Creation time for the file/directory.
- Default value: Now.
- :type file_creation_time: str
- :param file_last_write_time: Last write time for the file/directory.
- Default value: Now.
- :type file_last_write_time: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param metadata: A name-value pair to associate with a file storage
- object.
- :type metadata: str
- :param file_permission: If specified the permission (security
- descriptor) shall be set for the directory/file. This header can be
- used if Permission size is <= 8KB, else x-ms-file-permission-key
- header shall be used. Default value: Inherit. If SDDL is specified as
- input, it must have owner, group and dacl. Note: Only one of the
- x-ms-file-permission or x-ms-file-permission-key should be specified.
- :type file_permission: str
- :param file_permission_key: Key of the permission to be set for the
- directory/file. Note: Only one of the x-ms-file-permission or
- x-ms-file-permission-key should be specified.
- :type file_permission_key: str
- :param file_http_headers: Additional parameters for the operation
- :type file_http_headers:
- ~azure.storage.fileshare.models.FileHTTPHeaders
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- file_content_type = None
- if file_http_headers is not None:
- file_content_type = file_http_headers.file_content_type
- file_content_encoding = None
- if file_http_headers is not None:
- file_content_encoding = file_http_headers.file_content_encoding
- file_content_language = None
- if file_http_headers is not None:
- file_content_language = file_http_headers.file_content_language
- file_cache_control = None
- if file_http_headers is not None:
- file_cache_control = file_http_headers.file_cache_control
- file_content_md5 = None
- if file_http_headers is not None:
- file_content_md5 = file_http_headers.file_content_md5
- file_content_disposition = None
- if file_http_headers is not None:
- file_content_disposition = file_http_headers.file_content_disposition
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- # Construct URL
- url = self.create.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- header_parameters['x-ms-content-length'] = self._serialize.header("file_content_length", file_content_length, 'long')
- header_parameters['x-ms-type'] = self._serialize.header("self.x_ms_type", self.x_ms_type, 'str')
- if metadata is not None:
- header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
- if file_permission is not None:
- header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str')
- if file_permission_key is not None:
- header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str')
- header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str')
- header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str')
- header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str')
- if file_content_type is not None:
- header_parameters['x-ms-content-type'] = self._serialize.header("file_content_type", file_content_type, 'str')
- if file_content_encoding is not None:
- header_parameters['x-ms-content-encoding'] = self._serialize.header("file_content_encoding", file_content_encoding, 'str')
- if file_content_language is not None:
- header_parameters['x-ms-content-language'] = self._serialize.header("file_content_language", file_content_language, 'str')
- if file_cache_control is not None:
- header_parameters['x-ms-cache-control'] = self._serialize.header("file_cache_control", file_cache_control, 'str')
- if file_content_md5 is not None:
- header_parameters['x-ms-content-md5'] = self._serialize.header("file_content_md5", file_content_md5, 'bytearray')
- if file_content_disposition is not None:
- header_parameters['x-ms-content-disposition'] = self._serialize.header("file_content_disposition", file_content_disposition, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [201]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-file-attributes': self._deserialize('str', response.headers.get('x-ms-file-attributes')),
- 'x-ms-file-creation-time': self._deserialize('str', response.headers.get('x-ms-file-creation-time')),
- 'x-ms-file-last-write-time': self._deserialize('str', response.headers.get('x-ms-file-last-write-time')),
- 'x-ms-file-change-time': self._deserialize('str', response.headers.get('x-ms-file-change-time')),
- 'x-ms-file-id': self._deserialize('str', response.headers.get('x-ms-file-id')),
- 'x-ms-file-parent-id': self._deserialize('str', response.headers.get('x-ms-file-parent-id')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- create.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- async def download(self, timeout=None, range=None, range_get_content_md5=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Reads or downloads a file from the system, including its metadata and
- properties.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param range: Return file data only from the specified byte range.
- :type range: str
- :param range_get_content_md5: When this header is set to true and
- specified together with the Range header, the service returns the MD5
- hash for the range, as long as the range is less than or equal to 4 MB
- in size.
- :type range_get_content_md5: bool
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: object or the result of cls(response)
- :rtype: Generator
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- # Construct URL
- url = self.download.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
-
- # Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if range is not None:
- header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str')
- if range_get_content_md5 is not None:
- header_parameters['x-ms-range-get-content-md5'] = self._serialize.header("range_get_content_md5", range_get_content_md5, 'bool')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.get(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200, 206]:
- await response.load_body()
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
- header_dict = {
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')),
- 'Content-Length': self._deserialize('long', response.headers.get('Content-Length')),
- 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')),
- 'Content-Range': self._deserialize('str', response.headers.get('Content-Range')),
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')),
- 'Content-Encoding': self._deserialize('str', response.headers.get('Content-Encoding')),
- 'Cache-Control': self._deserialize('str', response.headers.get('Cache-Control')),
- 'Content-Disposition': self._deserialize('str', response.headers.get('Content-Disposition')),
- 'Content-Language': self._deserialize('str', response.headers.get('Content-Language')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Accept-Ranges': self._deserialize('str', response.headers.get('Accept-Ranges')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-copy-completion-time': self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time')),
- 'x-ms-copy-status-description': self._deserialize('str', response.headers.get('x-ms-copy-status-description')),
- 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')),
- 'x-ms-copy-progress': self._deserialize('str', response.headers.get('x-ms-copy-progress')),
- 'x-ms-copy-source': self._deserialize('str', response.headers.get('x-ms-copy-source')),
- 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')),
- 'x-ms-content-md5': self._deserialize('bytearray', response.headers.get('x-ms-content-md5')),
- 'x-ms-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-server-encrypted')),
- 'x-ms-file-attributes': self._deserialize('str', response.headers.get('x-ms-file-attributes')),
- 'x-ms-file-creation-time': self._deserialize('str', response.headers.get('x-ms-file-creation-time')),
- 'x-ms-file-last-write-time': self._deserialize('str', response.headers.get('x-ms-file-last-write-time')),
- 'x-ms-file-change-time': self._deserialize('str', response.headers.get('x-ms-file-change-time')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-file-id': self._deserialize('str', response.headers.get('x-ms-file-id')),
- 'x-ms-file-parent-id': self._deserialize('str', response.headers.get('x-ms-file-parent-id')),
- 'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')),
- 'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')),
- 'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- if response.status_code == 206:
- deserialized = response.stream_download(self._client._pipeline)
- header_dict = {
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')),
- 'Content-Length': self._deserialize('long', response.headers.get('Content-Length')),
- 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')),
- 'Content-Range': self._deserialize('str', response.headers.get('Content-Range')),
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')),
- 'Content-Encoding': self._deserialize('str', response.headers.get('Content-Encoding')),
- 'Cache-Control': self._deserialize('str', response.headers.get('Cache-Control')),
- 'Content-Disposition': self._deserialize('str', response.headers.get('Content-Disposition')),
- 'Content-Language': self._deserialize('str', response.headers.get('Content-Language')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Accept-Ranges': self._deserialize('str', response.headers.get('Accept-Ranges')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-copy-completion-time': self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time')),
- 'x-ms-copy-status-description': self._deserialize('str', response.headers.get('x-ms-copy-status-description')),
- 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')),
- 'x-ms-copy-progress': self._deserialize('str', response.headers.get('x-ms-copy-progress')),
- 'x-ms-copy-source': self._deserialize('str', response.headers.get('x-ms-copy-source')),
- 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')),
- 'x-ms-content-md5': self._deserialize('bytearray', response.headers.get('x-ms-content-md5')),
- 'x-ms-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-server-encrypted')),
- 'x-ms-file-attributes': self._deserialize('str', response.headers.get('x-ms-file-attributes')),
- 'x-ms-file-creation-time': self._deserialize('str', response.headers.get('x-ms-file-creation-time')),
- 'x-ms-file-last-write-time': self._deserialize('str', response.headers.get('x-ms-file-last-write-time')),
- 'x-ms-file-change-time': self._deserialize('str', response.headers.get('x-ms-file-change-time')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-file-id': self._deserialize('str', response.headers.get('x-ms-file-id')),
- 'x-ms-file-parent-id': self._deserialize('str', response.headers.get('x-ms-file-parent-id')),
- 'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')),
- 'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')),
- 'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
-
- if cls:
- return cls(response, deserialized, header_dict)
-
- return deserialized
- download.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- async def get_properties(self, sharesnapshot=None, timeout=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Returns all user-defined metadata, standard HTTP properties, and system
- properties for the file. It does not return the content of the file.
-
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
- :type sharesnapshot: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- # Construct URL
- url = self.get_properties.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if sharesnapshot is not None:
- query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.head(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')),
- 'x-ms-type': self._deserialize('str', response.headers.get('x-ms-type')),
- 'Content-Length': self._deserialize('long', response.headers.get('Content-Length')),
- 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')),
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')),
- 'Content-Encoding': self._deserialize('str', response.headers.get('Content-Encoding')),
- 'Cache-Control': self._deserialize('str', response.headers.get('Cache-Control')),
- 'Content-Disposition': self._deserialize('str', response.headers.get('Content-Disposition')),
- 'Content-Language': self._deserialize('str', response.headers.get('Content-Language')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-copy-completion-time': self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time')),
- 'x-ms-copy-status-description': self._deserialize('str', response.headers.get('x-ms-copy-status-description')),
- 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')),
- 'x-ms-copy-progress': self._deserialize('str', response.headers.get('x-ms-copy-progress')),
- 'x-ms-copy-source': self._deserialize('str', response.headers.get('x-ms-copy-source')),
- 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')),
- 'x-ms-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-server-encrypted')),
- 'x-ms-file-attributes': self._deserialize('str', response.headers.get('x-ms-file-attributes')),
- 'x-ms-file-creation-time': self._deserialize('str', response.headers.get('x-ms-file-creation-time')),
- 'x-ms-file-last-write-time': self._deserialize('str', response.headers.get('x-ms-file-last-write-time')),
- 'x-ms-file-change-time': self._deserialize('str', response.headers.get('x-ms-file-change-time')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-file-id': self._deserialize('str', response.headers.get('x-ms-file-id')),
- 'x-ms-file-parent-id': self._deserialize('str', response.headers.get('x-ms-file-parent-id')),
- 'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')),
- 'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')),
- 'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- get_properties.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- async def delete(self, timeout=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """removes the file from the storage account.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- # Construct URL
- url = self.delete.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.delete(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [202]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- delete.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- async def set_http_headers(self, file_attributes="none", file_creation_time="now", file_last_write_time="now", timeout=None, file_content_length=None, file_permission="inherit", file_permission_key=None, file_http_headers=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Sets HTTP headers on the file.
-
- :param file_attributes: If specified, the provided file attributes
- shall be set. Default value: ‘Archive’ for file and ‘Directory’ for
- directory. ‘None’ can also be specified as default.
- :type file_attributes: str
- :param file_creation_time: Creation time for the file/directory.
- Default value: Now.
- :type file_creation_time: str
- :param file_last_write_time: Last write time for the file/directory.
- Default value: Now.
- :type file_last_write_time: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param file_content_length: Resizes a file to the specified size. If
- the specified byte value is less than the current size of the file,
- then all ranges above the specified byte value are cleared.
- :type file_content_length: long
- :param file_permission: If specified the permission (security
- descriptor) shall be set for the directory/file. This header can be
- used if Permission size is <= 8KB, else x-ms-file-permission-key
- header shall be used. Default value: Inherit. If SDDL is specified as
- input, it must have owner, group and dacl. Note: Only one of the
- x-ms-file-permission or x-ms-file-permission-key should be specified.
- :type file_permission: str
- :param file_permission_key: Key of the permission to be set for the
- directory/file. Note: Only one of the x-ms-file-permission or
- x-ms-file-permission-key should be specified.
- :type file_permission_key: str
- :param file_http_headers: Additional parameters for the operation
- :type file_http_headers:
- ~azure.storage.fileshare.models.FileHTTPHeaders
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- file_content_type = None
- if file_http_headers is not None:
- file_content_type = file_http_headers.file_content_type
- file_content_encoding = None
- if file_http_headers is not None:
- file_content_encoding = file_http_headers.file_content_encoding
- file_content_language = None
- if file_http_headers is not None:
- file_content_language = file_http_headers.file_content_language
- file_cache_control = None
- if file_http_headers is not None:
- file_cache_control = file_http_headers.file_cache_control
- file_content_md5 = None
- if file_http_headers is not None:
- file_content_md5 = file_http_headers.file_content_md5
- file_content_disposition = None
- if file_http_headers is not None:
- file_content_disposition = file_http_headers.file_content_disposition
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- comp = "properties"
-
- # Construct URL
- url = self.set_http_headers.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if file_content_length is not None:
- header_parameters['x-ms-content-length'] = self._serialize.header("file_content_length", file_content_length, 'long')
- if file_permission is not None:
- header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str')
- if file_permission_key is not None:
- header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str')
- header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str')
- header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str')
- header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str')
- if file_content_type is not None:
- header_parameters['x-ms-content-type'] = self._serialize.header("file_content_type", file_content_type, 'str')
- if file_content_encoding is not None:
- header_parameters['x-ms-content-encoding'] = self._serialize.header("file_content_encoding", file_content_encoding, 'str')
- if file_content_language is not None:
- header_parameters['x-ms-content-language'] = self._serialize.header("file_content_language", file_content_language, 'str')
- if file_cache_control is not None:
- header_parameters['x-ms-cache-control'] = self._serialize.header("file_cache_control", file_cache_control, 'str')
- if file_content_md5 is not None:
- header_parameters['x-ms-content-md5'] = self._serialize.header("file_content_md5", file_content_md5, 'bytearray')
- if file_content_disposition is not None:
- header_parameters['x-ms-content-disposition'] = self._serialize.header("file_content_disposition", file_content_disposition, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-file-attributes': self._deserialize('str', response.headers.get('x-ms-file-attributes')),
- 'x-ms-file-creation-time': self._deserialize('str', response.headers.get('x-ms-file-creation-time')),
- 'x-ms-file-last-write-time': self._deserialize('str', response.headers.get('x-ms-file-last-write-time')),
- 'x-ms-file-change-time': self._deserialize('str', response.headers.get('x-ms-file-change-time')),
- 'x-ms-file-id': self._deserialize('str', response.headers.get('x-ms-file-id')),
- 'x-ms-file-parent-id': self._deserialize('str', response.headers.get('x-ms-file-parent-id')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_http_headers.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- async def set_metadata(self, timeout=None, metadata=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Updates user-defined metadata for the specified file.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param metadata: A name-value pair to associate with a file storage
- object.
- :type metadata: str
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- comp = "metadata"
-
- # Construct URL
- url = self.set_metadata.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- if metadata is not None:
- header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_metadata.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- async def acquire_lease(self, timeout=None, duration=None, proposed_lease_id=None, request_id=None, *, cls=None, **kwargs):
- """[Update] The Lease File operation establishes and manages a lock on a
- file for write and delete operations.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param duration: Specifies the duration of the lease, in seconds, or
- negative one (-1) for a lease that never expires. A non-infinite lease
- can be between 15 and 60 seconds. A lease duration cannot be changed
- using renew or change.
- :type duration: int
- :param proposed_lease_id: Proposed lease ID, in a GUID string format.
- The File service returns 400 (Invalid request) if the proposed lease
- ID is not in the correct format. See Guid Constructor (String) for a
- list of valid GUID string formats.
- :type proposed_lease_id: str
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "lease"
- action = "acquire"
-
- # Construct URL
- url = self.acquire_lease.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- if duration is not None:
- header_parameters['x-ms-lease-duration'] = self._serialize.header("duration", duration, 'int')
- if proposed_lease_id is not None:
- header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [201]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- acquire_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- async def release_lease(self, lease_id, timeout=None, request_id=None, *, cls=None, **kwargs):
- """[Update] The Lease File operation establishes and manages a lock on a
- file for write and delete operations.
-
- :param lease_id: Specifies the current lease ID on the resource.
- :type lease_id: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "lease"
- action = "release"
-
- # Construct URL
- url = self.release_lease.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- release_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- async def change_lease(self, lease_id, timeout=None, proposed_lease_id=None, request_id=None, *, cls=None, **kwargs):
- """[Update] The Lease File operation establishes and manages a lock on a
- file for write and delete operations.
-
- :param lease_id: Specifies the current lease ID on the resource.
- :type lease_id: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param proposed_lease_id: Proposed lease ID, in a GUID string format.
- The File service returns 400 (Invalid request) if the proposed lease
- ID is not in the correct format. See Guid Constructor (String) for a
- list of valid GUID string formats.
- :type proposed_lease_id: str
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "lease"
- action = "change"
-
- # Construct URL
- url = self.change_lease.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
- if proposed_lease_id is not None:
- header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- change_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- async def break_lease(self, timeout=None, request_id=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """[Update] The Lease File operation establishes and manages a lock on a
- file for write and delete operations.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- comp = "lease"
- action = "break"
-
- # Construct URL
- url = self.break_lease.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [202]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- break_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- async def upload_range(self, range, content_length, file_range_write="update", optionalbody=None, timeout=None, content_md5=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Upload a range of bytes to a file.
-
- :param range: Specifies the range of bytes to be written. Both the
- start and end of the range must be specified. For an update operation,
- the range can be up to 4 MB in size. For a clear operation, the range
- can be up to the value of the file's full size. The File service
- accepts only a single byte range for the Range and 'x-ms-range'
- headers, and the byte range must be specified in the following format:
- bytes=startByte-endByte.
- :type range: str
- :param file_range_write: Specify one of the following options: -
- Update: Writes the bytes specified by the request body into the
- specified range. The Range and Content-Length headers must match to
- perform the update. - Clear: Clears the specified range and releases
- the space used in storage for that range. To clear a range, set the
- Content-Length header to zero, and set the Range header to a value
- that indicates the range to clear, up to maximum file size. Possible
- values include: 'update', 'clear'
- :type file_range_write: str or
- ~azure.storage.fileshare.models.FileRangeWriteType
- :param content_length: Specifies the number of bytes being transmitted
- in the request body. When the x-ms-write header is set to clear, the
- value of this header must be set to zero.
- :type content_length: long
- :param optionalbody: Initial data.
- :type optionalbody: Generator
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param content_md5: An MD5 hash of the content. This hash is used to
- verify the integrity of the data during transport. When the
- Content-MD5 header is specified, the File service compares the hash of
- the content that has arrived with the header value that was sent. If
- the two hashes do not match, the operation will fail with error code
- 400 (Bad Request).
- :type content_md5: bytearray
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- comp = "range"
-
- # Construct URL
- url = self.upload_range.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['Content-Type'] = 'application/octet-stream'
- header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str')
- header_parameters['x-ms-write'] = self._serialize.header("file_range_write", file_range_write, 'FileRangeWriteType')
- header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long')
- if content_md5 is not None:
- header_parameters['Content-MD5'] = self._serialize.header("content_md5", content_md5, 'bytearray')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct body
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters, stream_content=optionalbody)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [201]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- upload_range.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- async def upload_range_from_url(self, range, copy_source, content_length, timeout=None, source_range=None, source_content_crc64=None, source_modified_access_conditions=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Upload a range of bytes to a file where the contents are read from a
- URL.
-
- :param range: Writes data to the specified byte range in the file.
- :type range: str
- :param copy_source: Specifies the URL of the source file or blob, up
- to 2 KB in length. To copy a file to another file within the same
- storage account, you may use Shared Key to authenticate the source
- file. If you are copying a file from another storage account, or if
- you are copying a blob from the same storage account or another
- storage account, then you must authenticate the source file or blob
- using a shared access signature. If the source is a public blob, no
- authentication is required to perform the copy operation. A file in a
- share snapshot can also be specified as a copy source.
- :type copy_source: str
- :param content_length: Specifies the number of bytes being transmitted
- in the request body. When the x-ms-write header is set to clear, the
- value of this header must be set to zero.
- :type content_length: long
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param source_range: Bytes of source data in the specified range.
- :type source_range: str
- :param source_content_crc64: Specify the crc64 calculated for the
- range of bytes that must be read from the copy source.
- :type source_content_crc64: bytearray
- :param source_modified_access_conditions: Additional parameters for
- the operation
- :type source_modified_access_conditions:
- ~azure.storage.fileshare.models.SourceModifiedAccessConditions
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- source_if_match_crc64 = None
- if source_modified_access_conditions is not None:
- source_if_match_crc64 = source_modified_access_conditions.source_if_match_crc64
- source_if_none_match_crc64 = None
- if source_modified_access_conditions is not None:
- source_if_none_match_crc64 = source_modified_access_conditions.source_if_none_match_crc64
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- comp = "range"
-
- # Construct URL
- url = self.upload_range_from_url.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str')
- header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str')
- if source_range is not None:
- header_parameters['x-ms-source-range'] = self._serialize.header("source_range", source_range, 'str')
- header_parameters['x-ms-write'] = self._serialize.header("self._config.file_range_write_from_url", self._config.file_range_write_from_url, 'str')
- header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long')
- if source_content_crc64 is not None:
- header_parameters['x-ms-source-content-crc64'] = self._serialize.header("source_content_crc64", source_content_crc64, 'bytearray')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if source_if_match_crc64 is not None:
- header_parameters['x-ms-source-if-match-crc64'] = self._serialize.header("source_if_match_crc64", source_if_match_crc64, 'bytearray')
- if source_if_none_match_crc64 is not None:
- header_parameters['x-ms-source-if-none-match-crc64'] = self._serialize.header("source_if_none_match_crc64", source_if_none_match_crc64, 'bytearray')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [201]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-content-crc64': self._deserialize('bytearray', response.headers.get('x-ms-content-crc64')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- upload_range_from_url.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- async def get_range_list(self, sharesnapshot=None, prevsharesnapshot=None, timeout=None, range=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Returns the list of valid ranges for a file.
-
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
- :type sharesnapshot: str
- :param prevsharesnapshot: The previous snapshot parameter is an opaque
- DateTime value that, when present, specifies the previous snapshot.
- :type prevsharesnapshot: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param range: Specifies the range of bytes over which to list ranges,
- inclusively.
- :type range: str
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: ShareFileRangeList or the result of cls(response)
- :rtype: ~azure.storage.fileshare.models.ShareFileRangeList
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- comp = "rangelist"
-
- # Construct URL
- url = self.get_range_list.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if sharesnapshot is not None:
- query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- if prevsharesnapshot is not None:
- query_parameters['prevsharesnapshot'] = self._serialize.query("prevsharesnapshot", prevsharesnapshot, 'str')
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if range is not None:
- header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.get(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('ShareFileRangeList', response)
- header_dict = {
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'x-ms-content-length': self._deserialize('long', response.headers.get('x-ms-content-length')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
-
- if cls:
- return cls(response, deserialized, header_dict)
-
- return deserialized
- get_range_list.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- async def start_copy(self, copy_source, timeout=None, metadata=None, file_permission="inherit", file_permission_key=None, copy_file_smb_info=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Copies a blob or file to a destination file within the storage account.
-
- :param copy_source: Specifies the URL of the source file or blob, up
- to 2 KB in length. To copy a file to another file within the same
- storage account, you may use Shared Key to authenticate the source
- file. If you are copying a file from another storage account, or if
- you are copying a blob from the same storage account or another
- storage account, then you must authenticate the source file or blob
- using a shared access signature. If the source is a public blob, no
- authentication is required to perform the copy operation. A file in a
- share snapshot can also be specified as a copy source.
- :type copy_source: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param metadata: A name-value pair to associate with a file storage
- object.
- :type metadata: str
- :param file_permission: If specified the permission (security
- descriptor) shall be set for the directory/file. This header can be
- used if Permission size is <= 8KB, else x-ms-file-permission-key
- header shall be used. Default value: Inherit. If SDDL is specified as
- input, it must have owner, group and dacl. Note: Only one of the
- x-ms-file-permission or x-ms-file-permission-key should be specified.
- :type file_permission: str
- :param file_permission_key: Key of the permission to be set for the
- directory/file. Note: Only one of the x-ms-file-permission or
- x-ms-file-permission-key should be specified.
- :type file_permission_key: str
- :param copy_file_smb_info: Additional parameters for the operation
- :type copy_file_smb_info:
- ~azure.storage.fileshare.models.CopyFileSmbInfo
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- file_permission_copy_mode = None
- if copy_file_smb_info is not None:
- file_permission_copy_mode = copy_file_smb_info.file_permission_copy_mode
- ignore_read_only = None
- if copy_file_smb_info is not None:
- ignore_read_only = copy_file_smb_info.ignore_read_only
- file_attributes = None
- if copy_file_smb_info is not None:
- file_attributes = copy_file_smb_info.file_attributes
- file_creation_time = None
- if copy_file_smb_info is not None:
- file_creation_time = copy_file_smb_info.file_creation_time
- file_last_write_time = None
- if copy_file_smb_info is not None:
- file_last_write_time = copy_file_smb_info.file_last_write_time
- set_archive_attribute = None
- if copy_file_smb_info is not None:
- set_archive_attribute = copy_file_smb_info.set_archive_attribute
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- # Construct URL
- url = self.start_copy.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if metadata is not None:
- header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
- header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str')
- if file_permission is not None:
- header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str')
- if file_permission_key is not None:
- header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str')
- if file_permission_copy_mode is not None:
- header_parameters['x-ms-file-permission-copy-mode'] = self._serialize.header("file_permission_copy_mode", file_permission_copy_mode, 'PermissionCopyModeType')
- if ignore_read_only is not None:
- header_parameters['x-ms-file-copy-ignore-read-only'] = self._serialize.header("ignore_read_only", ignore_read_only, 'bool')
- if file_attributes is not None:
- header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str')
- if file_creation_time is not None:
- header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str')
- if file_last_write_time is not None:
- header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str')
- if set_archive_attribute is not None:
- header_parameters['x-ms-file-copy-set-archive'] = self._serialize.header("set_archive_attribute", set_archive_attribute, 'bool')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [202]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')),
- 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- start_copy.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- async def abort_copy(self, copy_id, timeout=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Aborts a pending Copy File operation, and leaves a destination file
- with zero length and full metadata.
-
- :param copy_id: The copy identifier provided in the x-ms-copy-id
- header of the original Copy File operation.
- :type copy_id: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- comp = "copy"
-
- # Construct URL
- url = self.abort_copy.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- query_parameters['copyid'] = self._serialize.query("copy_id", copy_id, 'str')
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-copy-action'] = self._serialize.header("self.x_ms_copy_action", self.x_ms_copy_action, 'str')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [204]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- abort_copy.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- async def list_handles(self, marker=None, maxresults=None, timeout=None, sharesnapshot=None, *, cls=None, **kwargs):
- """Lists handles for file.
-
- :param marker: A string value that identifies the portion of the list
- to be returned with the next list operation. The operation returns a
- marker value within the response body if the list returned was not
- complete. The marker value may then be used in a subsequent call to
- request the next set of list items. The marker value is opaque to the
- client.
- :type marker: str
- :param maxresults: Specifies the maximum number of entries to return.
- If the request does not specify maxresults, or specifies a value
- greater than 5,000, the server will return up to 5,000 items.
- :type maxresults: int
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
- :type sharesnapshot: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: ListHandlesResponse or the result of cls(response)
- :rtype: ~azure.storage.fileshare.models.ListHandlesResponse
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "listhandles"
-
- # Construct URL
- url = self.list_handles.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if marker is not None:
- query_parameters['marker'] = self._serialize.query("marker", marker, 'str')
- if maxresults is not None:
- query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1)
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- if sharesnapshot is not None:
- query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
-
- # Construct and send request
- request = self._client.get(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('ListHandlesResponse', response)
- header_dict = {
- 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
-
- if cls:
- return cls(response, deserialized, header_dict)
-
- return deserialized
- list_handles.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- async def force_close_handles(self, handle_id, timeout=None, marker=None, sharesnapshot=None, *, cls=None, **kwargs):
- """Closes all handles open for given file.
-
- :param handle_id: Specifies handle ID opened on the file or directory
- to be closed. Asterisk (‘*’) is a wildcard that specifies all handles.
- :type handle_id: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param marker: A string value that identifies the portion of the list
- to be returned with the next list operation. The operation returns a
- marker value within the response body if the list returned was not
- complete. The marker value may then be used in a subsequent call to
- request the next set of list items. The marker value is opaque to the
- client.
- :type marker: str
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
- :type sharesnapshot: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "forceclosehandles"
-
- # Construct URL
- url = self.force_close_handles.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- if marker is not None:
- query_parameters['marker'] = self._serialize.query("marker", marker, 'str')
- if sharesnapshot is not None:
- query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-handle-id'] = self._serialize.header("handle_id", handle_id, 'str')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-marker': self._deserialize('str', response.headers.get('x-ms-marker')),
- 'x-ms-number-of-handles-closed': self._deserialize('int', response.headers.get('x-ms-number-of-handles-closed')),
- 'x-ms-number-of-handles-failed': self._deserialize('int', response.headers.get('x-ms-number-of-handles-failed')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- force_close_handles.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/_service_operations_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/_service_operations_async.py
deleted file mode 100644
index c4e40f1e4ddd..000000000000
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/_service_operations_async.py
+++ /dev/null
@@ -1,253 +0,0 @@
-# coding=utf-8
-# --------------------------------------------------------------------------
-# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
-# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
-# --------------------------------------------------------------------------
-
-from azure.core.exceptions import map_error
-
-from ... import models
-
-
-class ServiceOperations:
- """ServiceOperations async operations.
-
- You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
-
- :param client: Client for service requests.
- :param config: Configuration of service client.
- :param serializer: An object model serializer.
- :param deserializer: An object model deserializer.
- :ivar restype: . Constant value: "service".
- """
-
- models = models
-
- def __init__(self, client, config, serializer, deserializer) -> None:
-
- self._client = client
- self._serialize = serializer
- self._deserialize = deserializer
-
- self._config = config
- self.restype = "service"
-
- async def set_properties(self, storage_service_properties, timeout=None, *, cls=None, **kwargs):
- """Sets properties for a storage account's File service endpoint,
- including properties for Storage Analytics metrics and CORS
- (Cross-Origin Resource Sharing) rules.
-
- :param storage_service_properties: The StorageService properties.
- :type storage_service_properties:
- ~azure.storage.fileshare.models.StorageServiceProperties
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "properties"
-
- # Construct URL
- url = self.set_properties.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['Content-Type'] = 'application/xml; charset=utf-8'
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
-
- # Construct body
- body_content = self._serialize.body(storage_service_properties, 'StorageServiceProperties')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters, body_content)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [202]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_properties.metadata = {'url': '/'}
-
- async def get_properties(self, timeout=None, *, cls=None, **kwargs):
- """Gets the properties of a storage account's File service, including
- properties for Storage Analytics metrics and CORS (Cross-Origin
- Resource Sharing) rules.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: StorageServiceProperties or the result of cls(response)
- :rtype: ~azure.storage.fileshare.models.StorageServiceProperties
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "properties"
-
- # Construct URL
- url = self.get_properties.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
-
- # Construct and send request
- request = self._client.get(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('StorageServiceProperties', response)
- header_dict = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
-
- if cls:
- return cls(response, deserialized, header_dict)
-
- return deserialized
- get_properties.metadata = {'url': '/'}
-
- async def list_shares_segment(self, prefix=None, marker=None, maxresults=None, include=None, timeout=None, *, cls=None, **kwargs):
- """The List Shares Segment operation returns a list of the shares and
- share snapshots under the specified account.
-
- :param prefix: Filters the results to return only entries whose name
- begins with the specified prefix.
- :type prefix: str
- :param marker: A string value that identifies the portion of the list
- to be returned with the next list operation. The operation returns a
- marker value within the response body if the list returned was not
- complete. The marker value may then be used in a subsequent call to
- request the next set of list items. The marker value is opaque to the
- client.
- :type marker: str
- :param maxresults: Specifies the maximum number of entries to return.
- If the request does not specify maxresults, or specifies a value
- greater than 5,000, the server will return up to 5,000 items.
- :type maxresults: int
- :param include: Include this parameter to specify one or more datasets
- to include in the response.
- :type include: list[str or
- ~azure.storage.fileshare.models.ListSharesIncludeType]
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: ListSharesResponse or the result of cls(response)
- :rtype: ~azure.storage.fileshare.models.ListSharesResponse
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "list"
-
- # Construct URL
- url = self.list_shares_segment.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if prefix is not None:
- query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str')
- if marker is not None:
- query_parameters['marker'] = self._serialize.query("marker", marker, 'str')
- if maxresults is not None:
- query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1)
- if include is not None:
- query_parameters['include'] = self._serialize.query("include", include, '[ListSharesIncludeType]', div=',')
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
-
- # Construct and send request
- request = self._client.get(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('ListSharesResponse', response)
- header_dict = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
-
- if cls:
- return cls(response, deserialized, header_dict)
-
- return deserialized
- list_shares_segment.metadata = {'url': '/'}
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/_share_operations_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/_share_operations_async.py
deleted file mode 100644
index 8e0bf2e4473c..000000000000
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/_share_operations_async.py
+++ /dev/null
@@ -1,1350 +0,0 @@
-# coding=utf-8
-# --------------------------------------------------------------------------
-# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
-# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
-# --------------------------------------------------------------------------
-
-from azure.core.exceptions import map_error
-
-from ... import models
-
-
-class ShareOperations:
- """ShareOperations async operations.
-
- You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
-
- :param client: Client for service requests.
- :param config: Configuration of service client.
- :param serializer: An object model serializer.
- :param deserializer: An object model deserializer.
- :ivar restype: . Constant value: "share".
- """
-
- models = models
-
- def __init__(self, client, config, serializer, deserializer) -> None:
-
- self._client = client
- self._serialize = serializer
- self._deserialize = deserializer
-
- self._config = config
- self.restype = "share"
-
- async def create(self, timeout=None, metadata=None, quota=None, access_tier=None, enabled_protocols=None, root_squash=None, *, cls=None, **kwargs):
- """Creates a new share under the specified account. If the share with the
- same name already exists, the operation fails.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param metadata: A name-value pair to associate with a file storage
- object.
- :type metadata: str
- :param quota: Specifies the maximum size of the share, in gigabytes.
- :type quota: int
- :param access_tier: Specifies the access tier of the share. Possible
- values include: 'TransactionOptimized', 'Hot', 'Cool'
- :type access_tier: str or
- ~azure.storage.fileshare.models.ShareAccessTier
- :param enabled_protocols: Protocols to enable on the share.
- :type enabled_protocols: str
- :param root_squash: Root squash to set on the share. Only valid for
- NFS shares. Possible values include: 'NoRootSquash', 'RootSquash',
- 'AllSquash'
- :type root_squash: str or
- ~azure.storage.fileshare.models.ShareRootSquash
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- # Construct URL
- url = self.create.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
-
- # Construct headers
- header_parameters = {}
- if metadata is not None:
- header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
- if quota is not None:
- header_parameters['x-ms-share-quota'] = self._serialize.header("quota", quota, 'int', minimum=1)
- if access_tier is not None:
- header_parameters['x-ms-access-tier'] = self._serialize.header("access_tier", access_tier, 'str')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if enabled_protocols is not None:
- header_parameters['x-ms-enabled-protocols'] = self._serialize.header("enabled_protocols", enabled_protocols, 'str')
- if root_squash is not None:
- header_parameters['x-ms-root-squash'] = self._serialize.header("root_squash", root_squash, 'ShareRootSquash')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [201]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- create.metadata = {'url': '/{shareName}'}
-
- async def get_properties(self, sharesnapshot=None, timeout=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Returns all user-defined metadata and system properties for the
- specified share or share snapshot. The data returned does not include
- the share's list of files.
-
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
- :type sharesnapshot: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- # Construct URL
- url = self.get_properties.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if sharesnapshot is not None:
- query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.get(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')),
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-share-quota': self._deserialize('int', response.headers.get('x-ms-share-quota')),
- 'x-ms-share-provisioned-iops': self._deserialize('int', response.headers.get('x-ms-share-provisioned-iops')),
- 'x-ms-share-provisioned-ingress-mbps': self._deserialize('int', response.headers.get('x-ms-share-provisioned-ingress-mbps')),
- 'x-ms-share-provisioned-egress-mbps': self._deserialize('int', response.headers.get('x-ms-share-provisioned-egress-mbps')),
- 'x-ms-share-next-allowed-quota-downgrade-time': self._deserialize('rfc-1123', response.headers.get('x-ms-share-next-allowed-quota-downgrade-time')),
- 'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')),
- 'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')),
- 'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')),
- 'x-ms-access-tier': self._deserialize('str', response.headers.get('x-ms-access-tier')),
- 'x-ms-access-tier-change-time': self._deserialize('rfc-1123', response.headers.get('x-ms-access-tier-change-time')),
- 'x-ms-access-tier-transition-state': self._deserialize('str', response.headers.get('x-ms-access-tier-transition-state')),
- 'x-ms-enabled-protocols': self._deserialize('str', response.headers.get('x-ms-enabled-protocols')),
- 'x-ms-root-squash': self._deserialize(models.ShareRootSquash, response.headers.get('x-ms-root-squash')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- get_properties.metadata = {'url': '/{shareName}'}
-
- async def delete(self, sharesnapshot=None, timeout=None, delete_snapshots=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Operation marks the specified share or share snapshot for deletion. The
- share or share snapshot and any files contained within it are later
- deleted during garbage collection.
-
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
- :type sharesnapshot: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param delete_snapshots: Specifies the option include to delete the
- base share and all of its snapshots. Possible values include:
- 'include', 'include-leased'
- :type delete_snapshots: str or
- ~azure.storage.fileshare.models.DeleteSnapshotsOptionType
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- # Construct URL
- url = self.delete.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if sharesnapshot is not None:
- query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if delete_snapshots is not None:
- header_parameters['x-ms-delete-snapshots'] = self._serialize.header("delete_snapshots", delete_snapshots, 'DeleteSnapshotsOptionType')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.delete(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [202]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- delete.metadata = {'url': '/{shareName}'}
-
- async def acquire_lease(self, timeout=None, duration=None, proposed_lease_id=None, sharesnapshot=None, request_id=None, *, cls=None, **kwargs):
- """The Lease Share operation establishes and manages a lock on a share, or
- the specified snapshot for set and delete share operations.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param duration: Specifies the duration of the lease, in seconds, or
- negative one (-1) for a lease that never expires. A non-infinite lease
- can be between 15 and 60 seconds. A lease duration cannot be changed
- using renew or change.
- :type duration: int
- :param proposed_lease_id: Proposed lease ID, in a GUID string format.
- The File service returns 400 (Invalid request) if the proposed lease
- ID is not in the correct format. See Guid Constructor (String) for a
- list of valid GUID string formats.
- :type proposed_lease_id: str
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
- :type sharesnapshot: str
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "lease"
- action = "acquire"
-
- # Construct URL
- url = self.acquire_lease.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- if sharesnapshot is not None:
- query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
-
- # Construct headers
- header_parameters = {}
- if duration is not None:
- header_parameters['x-ms-lease-duration'] = self._serialize.header("duration", duration, 'int')
- if proposed_lease_id is not None:
- header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [201]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- acquire_lease.metadata = {'url': '/{shareName}'}
-
- async def release_lease(self, lease_id, timeout=None, sharesnapshot=None, request_id=None, *, cls=None, **kwargs):
- """The Lease Share operation establishes and manages a lock on a share, or
- the specified snapshot for set and delete share operations.
-
- :param lease_id: Specifies the current lease ID on the resource.
- :type lease_id: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
- :type sharesnapshot: str
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "lease"
- action = "release"
-
- # Construct URL
- url = self.release_lease.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- if sharesnapshot is not None:
- query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- release_lease.metadata = {'url': '/{shareName}'}
-
- async def change_lease(self, lease_id, timeout=None, proposed_lease_id=None, sharesnapshot=None, request_id=None, *, cls=None, **kwargs):
- """The Lease Share operation establishes and manages a lock on a share, or
- the specified snapshot for set and delete share operations.
-
- :param lease_id: Specifies the current lease ID on the resource.
- :type lease_id: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param proposed_lease_id: Proposed lease ID, in a GUID string format.
- The File service returns 400 (Invalid request) if the proposed lease
- ID is not in the correct format. See Guid Constructor (String) for a
- list of valid GUID string formats.
- :type proposed_lease_id: str
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
- :type sharesnapshot: str
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "lease"
- action = "change"
-
- # Construct URL
- url = self.change_lease.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- if sharesnapshot is not None:
- query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
- if proposed_lease_id is not None:
- header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- change_lease.metadata = {'url': '/{shareName}'}
-
- async def renew_lease(self, lease_id, timeout=None, sharesnapshot=None, request_id=None, *, cls=None, **kwargs):
- """The Lease Share operation establishes and manages a lock on a share, or
- the specified snapshot for set and delete share operations.
-
- :param lease_id: Specifies the current lease ID on the resource.
- :type lease_id: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
- :type sharesnapshot: str
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "lease"
- action = "renew"
-
- # Construct URL
- url = self.renew_lease.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- if sharesnapshot is not None:
- query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- renew_lease.metadata = {'url': '/{shareName}'}
-
- async def break_lease(self, timeout=None, break_period=None, request_id=None, sharesnapshot=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """The Lease Share operation establishes and manages a lock on a share, or
- the specified snapshot for set and delete share operations.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param break_period: For a break operation, proposed duration the
- lease should continue before it is broken, in seconds, between 0 and
- 60. This break period is only used if it is shorter than the time
- remaining on the lease. If longer, the time remaining on the lease is
- used. A new lease will not be available before the break period has
- expired, but the lease may be held for longer than the break period.
- If this header does not appear with a break operation, a
- fixed-duration lease breaks after the remaining lease period elapses,
- and an infinite lease breaks immediately.
- :type break_period: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
- :type sharesnapshot: str
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- comp = "lease"
- action = "break"
-
- # Construct URL
- url = self.break_lease.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- if sharesnapshot is not None:
- query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
-
- # Construct headers
- header_parameters = {}
- if break_period is not None:
- header_parameters['x-ms-lease-break-period'] = self._serialize.header("break_period", break_period, 'int')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [202]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-lease-time': self._deserialize('int', response.headers.get('x-ms-lease-time')),
- 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- break_lease.metadata = {'url': '/{shareName}'}
-
- async def create_snapshot(self, timeout=None, metadata=None, *, cls=None, **kwargs):
- """Creates a read-only snapshot of a share.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param metadata: A name-value pair to associate with a file storage
- object.
- :type metadata: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "snapshot"
-
- # Construct URL
- url = self.create_snapshot.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- if metadata is not None:
- header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [201]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'x-ms-snapshot': self._deserialize('str', response.headers.get('x-ms-snapshot')),
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- create_snapshot.metadata = {'url': '/{shareName}'}
-
- async def create_permission(self, share_permission, timeout=None, *, cls=None, **kwargs):
- """Create a permission (a security descriptor).
-
- :param share_permission: A permission (a security descriptor) at the
- share level.
- :type share_permission:
- ~azure.storage.fileshare.models.SharePermission
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "filepermission"
-
- # Construct URL
- url = self.create_permission.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['Content-Type'] = 'application/json; charset=utf-8'
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
-
- # Construct body
- body_content = self._serialize.body(share_permission, 'SharePermission', is_xml=False)
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters, body_content)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [201]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- create_permission.metadata = {'url': '/{shareName}'}
-
- async def get_permission(self, file_permission_key, timeout=None, *, cls=None, **kwargs):
- """Returns the permission (security descriptor) for a given key.
-
- :param file_permission_key: Key of the permission to be set for the
- directory/file.
- :type file_permission_key: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: SharePermission or the result of cls(response)
- :rtype: ~azure.storage.fileshare.models.SharePermission
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "filepermission"
-
- # Construct URL
- url = self.get_permission.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/json'
- header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
-
- # Construct and send request
- request = self._client.get(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('SharePermission', response)
- header_dict = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
-
- if cls:
- return cls(response, deserialized, header_dict)
-
- return deserialized
- get_permission.metadata = {'url': '/{shareName}'}
-
- async def set_properties(self, timeout=None, quota=None, access_tier=None, root_squash=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Sets properties for the specified share.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param quota: Specifies the maximum size of the share, in gigabytes.
- :type quota: int
- :param access_tier: Specifies the access tier of the share. Possible
- values include: 'TransactionOptimized', 'Hot', 'Cool'
- :type access_tier: str or
- ~azure.storage.fileshare.models.ShareAccessTier
- :param root_squash: Root squash to set on the share. Only valid for
- NFS shares. Possible values include: 'NoRootSquash', 'RootSquash',
- 'AllSquash'
- :type root_squash: str or
- ~azure.storage.fileshare.models.ShareRootSquash
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- comp = "properties"
-
- # Construct URL
- url = self.set_properties.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if quota is not None:
- header_parameters['x-ms-share-quota'] = self._serialize.header("quota", quota, 'int', minimum=1)
- if access_tier is not None:
- header_parameters['x-ms-access-tier'] = self._serialize.header("access_tier", access_tier, 'str')
- if root_squash is not None:
- header_parameters['x-ms-root-squash'] = self._serialize.header("root_squash", root_squash, 'ShareRootSquash')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_properties.metadata = {'url': '/{shareName}'}
-
- async def set_metadata(self, timeout=None, metadata=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Sets one or more user-defined name-value pairs for the specified share.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param metadata: A name-value pair to associate with a file storage
- object.
- :type metadata: str
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- comp = "metadata"
-
- # Construct URL
- url = self.set_metadata.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- if metadata is not None:
- header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_metadata.metadata = {'url': '/{shareName}'}
-
- async def get_access_policy(self, timeout=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Returns information about stored access policies specified on the
- share.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: list or the result of cls(response)
- :rtype: list[~azure.storage.fileshare.models.SignedIdentifier]
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- comp = "acl"
-
- # Construct URL
- url = self.get_access_policy.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.get(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('[SignedIdentifier]', response)
- header_dict = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
-
- if cls:
- return cls(response, deserialized, header_dict)
-
- return deserialized
- get_access_policy.metadata = {'url': '/{shareName}'}
-
- async def set_access_policy(self, share_acl=None, timeout=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Sets a stored access policy for use with shared access signatures.
-
- :param share_acl: The ACL for the share.
- :type share_acl:
- list[~azure.storage.fileshare.models.SignedIdentifier]
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- comp = "acl"
-
- # Construct URL
- url = self.set_access_policy.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['Content-Type'] = 'application/xml; charset=utf-8'
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct body
- serialization_ctxt = {'xml': {'name': 'SignedIdentifiers', 'itemsName': 'SignedIdentifier', 'wrapped': True}}
- if share_acl is not None:
- body_content = self._serialize.body(share_acl, '[SignedIdentifier]', serialization_ctxt=serialization_ctxt)
- else:
- body_content = None
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters, body_content)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_access_policy.metadata = {'url': '/{shareName}'}
-
- async def get_statistics(self, timeout=None, lease_access_conditions=None, *, cls=None, **kwargs):
- """Retrieves statistics related to the share.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: ShareStats or the result of cls(response)
- :rtype: ~azure.storage.fileshare.models.ShareStats
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- lease_id = None
- if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
- comp = "stats"
-
- # Construct URL
- url = self.get_statistics.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
- request = self._client.get(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [200]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('ShareStats', response)
- header_dict = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
-
- if cls:
- return cls(response, deserialized, header_dict)
-
- return deserialized
- get_statistics.metadata = {'url': '/{shareName}'}
-
- async def restore(self, timeout=None, request_id=None, deleted_share_name=None, deleted_share_version=None, *, cls=None, **kwargs):
- """Restores a previously deleted Share.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
- :type timeout: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param deleted_share_name: Specifies the name of the
- preivously-deleted share.
- :type deleted_share_name: str
- :param deleted_share_version: Specifies the version of the
- preivously-deleted share.
- :type deleted_share_version: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
- :rtype: None
- :raises:
- :class:`StorageErrorException`
- """
- error_map = kwargs.pop('error_map', None)
- comp = "undelete"
-
- # Construct URL
- url = self.restore.metadata['url']
- path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
- }
- url = self._client.format_url(url, **path_format_arguments)
-
- # Construct parameters
- query_parameters = {}
- if timeout is not None:
- query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
-
- # Construct headers
- header_parameters = {}
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- if deleted_share_name is not None:
- header_parameters['x-ms-deleted-share-name'] = self._serialize.header("deleted_share_name", deleted_share_name, 'str')
- if deleted_share_version is not None:
- header_parameters['x-ms-deleted-share-version'] = self._serialize.header("deleted_share_version", deleted_share_version, 'str')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters)
- pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
- response = pipeline_response.http_response
-
- if response.status_code not in [201]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- restore.metadata = {'url': '/{shareName}'}
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/__init__.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/__init__.py
index 2919e8ad0418..8a030e591a11 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/__init__.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/__init__.py
@@ -1,12 +1,9 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
try:
@@ -37,38 +34,39 @@
from ._models_py3 import SignedIdentifier
from ._models_py3 import SmbMultichannel
from ._models_py3 import SourceModifiedAccessConditions
- from ._models_py3 import StorageError, StorageErrorException
+ from ._models_py3 import StorageError
from ._models_py3 import StorageServiceProperties
except (SyntaxError, ImportError):
- from ._models import AccessPolicy
- from ._models import ClearRange
- from ._models import CopyFileSmbInfo
- from ._models import CorsRule
- from ._models import DirectoryItem
- from ._models import FileHTTPHeaders
- from ._models import FileItem
- from ._models import FileProperty
- from ._models import FileRange
- from ._models import FilesAndDirectoriesListSegment
- from ._models import HandleItem
- from ._models import LeaseAccessConditions
- from ._models import ListFilesAndDirectoriesSegmentResponse
- from ._models import ListHandlesResponse
- from ._models import ListSharesResponse
- from ._models import Metrics
- from ._models import RetentionPolicy
- from ._models import ShareFileRangeList
- from ._models import ShareItemInternal
- from ._models import SharePermission
- from ._models import SharePropertiesInternal
- from ._models import ShareProtocolSettings
- from ._models import ShareSmbSettings
- from ._models import ShareStats
- from ._models import SignedIdentifier
- from ._models import SmbMultichannel
- from ._models import SourceModifiedAccessConditions
- from ._models import StorageError, StorageErrorException
- from ._models import StorageServiceProperties
+ from ._models import AccessPolicy # type: ignore
+ from ._models import ClearRange # type: ignore
+ from ._models import CopyFileSmbInfo # type: ignore
+ from ._models import CorsRule # type: ignore
+ from ._models import DirectoryItem # type: ignore
+ from ._models import FileHTTPHeaders # type: ignore
+ from ._models import FileItem # type: ignore
+ from ._models import FileProperty # type: ignore
+ from ._models import FileRange # type: ignore
+ from ._models import FilesAndDirectoriesListSegment # type: ignore
+ from ._models import HandleItem # type: ignore
+ from ._models import LeaseAccessConditions # type: ignore
+ from ._models import ListFilesAndDirectoriesSegmentResponse # type: ignore
+ from ._models import ListHandlesResponse # type: ignore
+ from ._models import ListSharesResponse # type: ignore
+ from ._models import Metrics # type: ignore
+ from ._models import RetentionPolicy # type: ignore
+ from ._models import ShareFileRangeList # type: ignore
+ from ._models import ShareItemInternal # type: ignore
+ from ._models import SharePermission # type: ignore
+ from ._models import SharePropertiesInternal # type: ignore
+ from ._models import ShareProtocolSettings # type: ignore
+ from ._models import ShareSmbSettings # type: ignore
+ from ._models import ShareStats # type: ignore
+ from ._models import SignedIdentifier # type: ignore
+ from ._models import SmbMultichannel # type: ignore
+ from ._models import SourceModifiedAccessConditions # type: ignore
+ from ._models import StorageError # type: ignore
+ from ._models import StorageServiceProperties # type: ignore
+
from ._azure_file_storage_enums import (
CopyStatusType,
DeleteSnapshotsOptionType,
@@ -111,17 +109,17 @@
'SignedIdentifier',
'SmbMultichannel',
'SourceModifiedAccessConditions',
- 'StorageError', 'StorageErrorException',
+ 'StorageError',
'StorageServiceProperties',
- 'StorageErrorCode',
+ 'CopyStatusType',
+ 'DeleteSnapshotsOptionType',
+ 'FileRangeWriteType',
'LeaseDurationType',
'LeaseStateType',
'LeaseStatusType',
- 'ShareRootSquash',
- 'ShareAccessTier',
- 'PermissionCopyModeType',
- 'DeleteSnapshotsOptionType',
'ListSharesIncludeType',
- 'CopyStatusType',
- 'FileRangeWriteType',
+ 'PermissionCopyModeType',
+ 'ShareAccessTier',
+ 'ShareRootSquash',
+ 'StorageErrorCode',
]
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py
index fb1c252f022e..19c0e2af840b 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py
@@ -1,150 +1,162 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from enum import Enum
-
-
-class StorageErrorCode(str, Enum):
-
- account_already_exists = "AccountAlreadyExists"
- account_being_created = "AccountBeingCreated"
- account_is_disabled = "AccountIsDisabled"
- authentication_failed = "AuthenticationFailed"
- authorization_failure = "AuthorizationFailure"
- condition_headers_not_supported = "ConditionHeadersNotSupported"
- condition_not_met = "ConditionNotMet"
- empty_metadata_key = "EmptyMetadataKey"
- insufficient_account_permissions = "InsufficientAccountPermissions"
- internal_error = "InternalError"
- invalid_authentication_info = "InvalidAuthenticationInfo"
- invalid_header_value = "InvalidHeaderValue"
- invalid_http_verb = "InvalidHttpVerb"
- invalid_input = "InvalidInput"
- invalid_md5 = "InvalidMd5"
- invalid_metadata = "InvalidMetadata"
- invalid_query_parameter_value = "InvalidQueryParameterValue"
- invalid_range = "InvalidRange"
- invalid_resource_name = "InvalidResourceName"
- invalid_uri = "InvalidUri"
- invalid_xml_document = "InvalidXmlDocument"
- invalid_xml_node_value = "InvalidXmlNodeValue"
- md5_mismatch = "Md5Mismatch"
- metadata_too_large = "MetadataTooLarge"
- missing_content_length_header = "MissingContentLengthHeader"
- missing_required_query_parameter = "MissingRequiredQueryParameter"
- missing_required_header = "MissingRequiredHeader"
- missing_required_xml_node = "MissingRequiredXmlNode"
- multiple_condition_headers_not_supported = "MultipleConditionHeadersNotSupported"
- operation_timed_out = "OperationTimedOut"
- out_of_range_input = "OutOfRangeInput"
- out_of_range_query_parameter_value = "OutOfRangeQueryParameterValue"
- request_body_too_large = "RequestBodyTooLarge"
- resource_type_mismatch = "ResourceTypeMismatch"
- request_url_failed_to_parse = "RequestUrlFailedToParse"
- resource_already_exists = "ResourceAlreadyExists"
- resource_not_found = "ResourceNotFound"
- server_busy = "ServerBusy"
- unsupported_header = "UnsupportedHeader"
- unsupported_xml_node = "UnsupportedXmlNode"
- unsupported_query_parameter = "UnsupportedQueryParameter"
- unsupported_http_verb = "UnsupportedHttpVerb"
- cannot_delete_file_or_directory = "CannotDeleteFileOrDirectory"
- client_cache_flush_delay = "ClientCacheFlushDelay"
- delete_pending = "DeletePending"
- directory_not_empty = "DirectoryNotEmpty"
- file_lock_conflict = "FileLockConflict"
- invalid_file_or_directory_path_name = "InvalidFileOrDirectoryPathName"
- parent_not_found = "ParentNotFound"
- read_only_attribute = "ReadOnlyAttribute"
- share_already_exists = "ShareAlreadyExists"
- share_being_deleted = "ShareBeingDeleted"
- share_disabled = "ShareDisabled"
- share_not_found = "ShareNotFound"
- sharing_violation = "SharingViolation"
- share_snapshot_in_progress = "ShareSnapshotInProgress"
- share_snapshot_count_exceeded = "ShareSnapshotCountExceeded"
- share_snapshot_operation_not_supported = "ShareSnapshotOperationNotSupported"
- share_has_snapshots = "ShareHasSnapshots"
- container_quota_downgrade_not_allowed = "ContainerQuotaDowngradeNotAllowed"
- authorization_source_ip_mismatch = "AuthorizationSourceIPMismatch"
- authorization_protocol_mismatch = "AuthorizationProtocolMismatch"
- authorization_permission_mismatch = "AuthorizationPermissionMismatch"
- authorization_service_mismatch = "AuthorizationServiceMismatch"
- authorization_resource_type_mismatch = "AuthorizationResourceTypeMismatch"
- feature_version_mismatch = "FeatureVersionMismatch"
-
-
-class LeaseDurationType(str, Enum):
-
- infinite = "infinite"
- fixed = "fixed"
-
-
-class LeaseStateType(str, Enum):
-
- available = "available"
- leased = "leased"
- expired = "expired"
- breaking = "breaking"
- broken = "broken"
-
-
-class LeaseStatusType(str, Enum):
-
- locked = "locked"
- unlocked = "unlocked"
-
-
-class ShareRootSquash(str, Enum):
-
- no_root_squash = "NoRootSquash"
- root_squash = "RootSquash"
- all_squash = "AllSquash"
-
-
-class ShareAccessTier(str, Enum):
-
- transaction_optimized = "TransactionOptimized"
- hot = "Hot"
- cool = "Cool"
-
-
-class PermissionCopyModeType(str, Enum):
-
- source = "source"
- override = "override"
-
-
-class DeleteSnapshotsOptionType(str, Enum):
-
- include = "include"
- include_leased = "include-leased"
+from enum import Enum, EnumMeta
+from six import with_metaclass
-
-class ListSharesIncludeType(str, Enum):
-
- snapshots = "snapshots"
- metadata = "metadata"
- deleted = "deleted"
-
-
-class CopyStatusType(str, Enum):
-
- pending = "pending"
- success = "success"
- aborted = "aborted"
- failed = "failed"
-
-
-class FileRangeWriteType(str, Enum):
-
- update = "update"
- clear = "clear"
+class _CaseInsensitiveEnumMeta(EnumMeta):
+ def __getitem__(self, name):
+ return super().__getitem__(name.upper())
+
+ def __getattr__(cls, name):
+ """Return the enum member matching `name`
+ We use __getattr__ instead of descriptors or inserting into the enum
+ class' __dict__ in order to support `name` and `value` being both
+ properties for enum members (which live in the class' __dict__) and
+ enum members themselves.
+ """
+ try:
+ return cls._member_map_[name.upper()]
+ except KeyError:
+ raise AttributeError(name)
+
+
+class CopyStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
+
+ PENDING = "pending"
+ SUCCESS = "success"
+ ABORTED = "aborted"
+ FAILED = "failed"
+
+class DeleteSnapshotsOptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
+
+ INCLUDE = "include"
+ INCLUDE_LEASED = "include-leased"
+
+class FileRangeWriteType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
+
+ UPDATE = "update"
+ CLEAR = "clear"
+
+class LeaseDurationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
+ """When a share is leased, specifies whether the lease is of infinite or fixed duration.
+ """
+
+ INFINITE = "infinite"
+ FIXED = "fixed"
+
+class LeaseStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
+ """Lease state of the share.
+ """
+
+ AVAILABLE = "available"
+ LEASED = "leased"
+ EXPIRED = "expired"
+ BREAKING = "breaking"
+ BROKEN = "broken"
+
+class LeaseStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
+ """The current lease status of the share.
+ """
+
+ LOCKED = "locked"
+ UNLOCKED = "unlocked"
+
+class ListSharesIncludeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
+
+ SNAPSHOTS = "snapshots"
+ METADATA = "metadata"
+ DELETED = "deleted"
+
+class PermissionCopyModeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
+
+ SOURCE = "source"
+ OVERRIDE = "override"
+
+class ShareAccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
+
+ TRANSACTION_OPTIMIZED = "TransactionOptimized"
+ HOT = "Hot"
+ COOL = "Cool"
+
+class ShareRootSquash(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
+
+ NO_ROOT_SQUASH = "NoRootSquash"
+ ROOT_SQUASH = "RootSquash"
+ ALL_SQUASH = "AllSquash"
+
+class StorageErrorCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
+ """Error codes returned by the service
+ """
+
+ ACCOUNT_ALREADY_EXISTS = "AccountAlreadyExists"
+ ACCOUNT_BEING_CREATED = "AccountBeingCreated"
+ ACCOUNT_IS_DISABLED = "AccountIsDisabled"
+ AUTHENTICATION_FAILED = "AuthenticationFailed"
+ AUTHORIZATION_FAILURE = "AuthorizationFailure"
+ CONDITION_HEADERS_NOT_SUPPORTED = "ConditionHeadersNotSupported"
+ CONDITION_NOT_MET = "ConditionNotMet"
+ EMPTY_METADATA_KEY = "EmptyMetadataKey"
+ INSUFFICIENT_ACCOUNT_PERMISSIONS = "InsufficientAccountPermissions"
+ INTERNAL_ERROR = "InternalError"
+ INVALID_AUTHENTICATION_INFO = "InvalidAuthenticationInfo"
+ INVALID_HEADER_VALUE = "InvalidHeaderValue"
+ INVALID_HTTP_VERB = "InvalidHttpVerb"
+ INVALID_INPUT = "InvalidInput"
+ INVALID_MD5 = "InvalidMd5"
+ INVALID_METADATA = "InvalidMetadata"
+ INVALID_QUERY_PARAMETER_VALUE = "InvalidQueryParameterValue"
+ INVALID_RANGE = "InvalidRange"
+ INVALID_RESOURCE_NAME = "InvalidResourceName"
+ INVALID_URI = "InvalidUri"
+ INVALID_XML_DOCUMENT = "InvalidXmlDocument"
+ INVALID_XML_NODE_VALUE = "InvalidXmlNodeValue"
+ MD5_MISMATCH = "Md5Mismatch"
+ METADATA_TOO_LARGE = "MetadataTooLarge"
+ MISSING_CONTENT_LENGTH_HEADER = "MissingContentLengthHeader"
+ MISSING_REQUIRED_QUERY_PARAMETER = "MissingRequiredQueryParameter"
+ MISSING_REQUIRED_HEADER = "MissingRequiredHeader"
+ MISSING_REQUIRED_XML_NODE = "MissingRequiredXmlNode"
+ MULTIPLE_CONDITION_HEADERS_NOT_SUPPORTED = "MultipleConditionHeadersNotSupported"
+ OPERATION_TIMED_OUT = "OperationTimedOut"
+ OUT_OF_RANGE_INPUT = "OutOfRangeInput"
+ OUT_OF_RANGE_QUERY_PARAMETER_VALUE = "OutOfRangeQueryParameterValue"
+ REQUEST_BODY_TOO_LARGE = "RequestBodyTooLarge"
+ RESOURCE_TYPE_MISMATCH = "ResourceTypeMismatch"
+ REQUEST_URL_FAILED_TO_PARSE = "RequestUrlFailedToParse"
+ RESOURCE_ALREADY_EXISTS = "ResourceAlreadyExists"
+ RESOURCE_NOT_FOUND = "ResourceNotFound"
+ SERVER_BUSY = "ServerBusy"
+ UNSUPPORTED_HEADER = "UnsupportedHeader"
+ UNSUPPORTED_XML_NODE = "UnsupportedXmlNode"
+ UNSUPPORTED_QUERY_PARAMETER = "UnsupportedQueryParameter"
+ UNSUPPORTED_HTTP_VERB = "UnsupportedHttpVerb"
+ CANNOT_DELETE_FILE_OR_DIRECTORY = "CannotDeleteFileOrDirectory"
+ CLIENT_CACHE_FLUSH_DELAY = "ClientCacheFlushDelay"
+ DELETE_PENDING = "DeletePending"
+ DIRECTORY_NOT_EMPTY = "DirectoryNotEmpty"
+ FILE_LOCK_CONFLICT = "FileLockConflict"
+ INVALID_FILE_OR_DIRECTORY_PATH_NAME = "InvalidFileOrDirectoryPathName"
+ PARENT_NOT_FOUND = "ParentNotFound"
+ READ_ONLY_ATTRIBUTE = "ReadOnlyAttribute"
+ SHARE_ALREADY_EXISTS = "ShareAlreadyExists"
+ SHARE_BEING_DELETED = "ShareBeingDeleted"
+ SHARE_DISABLED = "ShareDisabled"
+ SHARE_NOT_FOUND = "ShareNotFound"
+ SHARING_VIOLATION = "SharingViolation"
+ SHARE_SNAPSHOT_IN_PROGRESS = "ShareSnapshotInProgress"
+ SHARE_SNAPSHOT_COUNT_EXCEEDED = "ShareSnapshotCountExceeded"
+ SHARE_SNAPSHOT_OPERATION_NOT_SUPPORTED = "ShareSnapshotOperationNotSupported"
+ SHARE_HAS_SNAPSHOTS = "ShareHasSnapshots"
+ CONTAINER_QUOTA_DOWNGRADE_NOT_ALLOWED = "ContainerQuotaDowngradeNotAllowed"
+ AUTHORIZATION_SOURCE_IP_MISMATCH = "AuthorizationSourceIPMismatch"
+ AUTHORIZATION_PROTOCOL_MISMATCH = "AuthorizationProtocolMismatch"
+ AUTHORIZATION_PERMISSION_MISMATCH = "AuthorizationPermissionMismatch"
+ AUTHORIZATION_SERVICE_MISMATCH = "AuthorizationServiceMismatch"
+ AUTHORIZATION_RESOURCE_TYPE_MISMATCH = "AuthorizationResourceTypeMismatch"
+ FEATURE_VERSION_MISMATCH = "FeatureVersionMismatch"
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models.py
index 08b2bf6c74e4..665c309331b3 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models.py
@@ -1,19 +1,16 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from msrest.serialization import Model
from azure.core.exceptions import HttpResponseError
+import msrest.serialization
-class AccessPolicy(Model):
+class AccessPolicy(msrest.serialization.Model):
"""An Access policy.
:param start: The date-time the policy is active.
@@ -25,21 +22,22 @@ class AccessPolicy(Model):
"""
_attribute_map = {
- 'start': {'key': 'Start', 'type': 'str', 'xml': {'name': 'Start'}},
- 'expiry': {'key': 'Expiry', 'type': 'str', 'xml': {'name': 'Expiry'}},
- 'permission': {'key': 'Permission', 'type': 'str', 'xml': {'name': 'Permission'}},
- }
- _xml_map = {
+ 'start': {'key': 'Start', 'type': 'str'},
+ 'expiry': {'key': 'Expiry', 'type': 'str'},
+ 'permission': {'key': 'Permission', 'type': 'str'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(AccessPolicy, self).__init__(**kwargs)
self.start = kwargs.get('start', None)
self.expiry = kwargs.get('expiry', None)
self.permission = kwargs.get('permission', None)
-class ClearRange(Model):
+class ClearRange(msrest.serialization.Model):
"""ClearRange.
All required parameters must be populated in order to send to Azure.
@@ -63,54 +61,55 @@ class ClearRange(Model):
'name': 'ClearRange'
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(ClearRange, self).__init__(**kwargs)
- self.start = kwargs.get('start', None)
- self.end = kwargs.get('end', None)
+ self.start = kwargs['start']
+ self.end = kwargs['end']
-class CopyFileSmbInfo(Model):
- """Additional parameters for start_copy operation.
+class CopyFileSmbInfo(msrest.serialization.Model):
+ """Parameter group.
- :param file_permission_copy_mode: Specifies the option to copy file
- security descriptor from source file or to set it using the value which is
- defined by the header value of x-ms-file-permission or
- x-ms-file-permission-key. Possible values include: 'source', 'override'
- :type file_permission_copy_mode: str or
- ~azure.storage.fileshare.models.PermissionCopyModeType
- :param ignore_read_only: Specifies the option to overwrite the target file
- if it already exists and has read-only attribute set.
+ :param file_permission_copy_mode: Specifies the option to copy file security descriptor from
+ source file or to set it using the value which is defined by the header value of x-ms-file-
+ permission or x-ms-file-permission-key. Possible values include: "source", "override".
+ :type file_permission_copy_mode: str or ~azure.storage.fileshare.models.PermissionCopyModeType
+ :param ignore_read_only: Specifies the option to overwrite the target file if it already exists
+ and has read-only attribute set.
:type ignore_read_only: bool
- :param file_attributes: Specifies either the option to copy file
- attributes from a source file(source) to a target file or a list of
- attributes to set on a target file.
+ :param file_attributes: Specifies either the option to copy file attributes from a source
+ file(source) to a target file or a list of attributes to set on a target file.
:type file_attributes: str
- :param file_creation_time: Specifies either the option to copy file
- creation time from a source file(source) to a target file or a time value
- in ISO 8601 format to set as creation time on a target file.
+ :param file_creation_time: Specifies either the option to copy file creation time from a source
+ file(source) to a target file or a time value in ISO 8601 format to set as creation time on a
+ target file.
:type file_creation_time: str
- :param file_last_write_time: Specifies either the option to copy file last
- write time from a source file(source) to a target file or a time value in
- ISO 8601 format to set as last write time on a target file.
+ :param file_last_write_time: Specifies either the option to copy file last write time from a
+ source file(source) to a target file or a time value in ISO 8601 format to set as last write
+ time on a target file.
:type file_last_write_time: str
- :param set_archive_attribute: Specifies the option to set archive
- attribute on a target file. True means archive attribute will be set on a
- target file despite attribute overrides or a source file state.
+ :param set_archive_attribute: Specifies the option to set archive attribute on a target file.
+ True means archive attribute will be set on a target file despite attribute overrides or a
+ source file state.
:type set_archive_attribute: bool
"""
_attribute_map = {
- 'file_permission_copy_mode': {'key': '', 'type': 'PermissionCopyModeType', 'xml': {'name': 'file_permission_copy_mode'}},
- 'ignore_read_only': {'key': '', 'type': 'bool', 'xml': {'name': 'ignore_read_only'}},
- 'file_attributes': {'key': '', 'type': 'str', 'xml': {'name': 'file_attributes'}},
- 'file_creation_time': {'key': '', 'type': 'str', 'xml': {'name': 'file_creation_time'}},
- 'file_last_write_time': {'key': '', 'type': 'str', 'xml': {'name': 'file_last_write_time'}},
- 'set_archive_attribute': {'key': '', 'type': 'bool', 'xml': {'name': 'set_archive_attribute'}},
- }
- _xml_map = {
- }
-
- def __init__(self, **kwargs):
+ 'file_permission_copy_mode': {'key': 'filePermissionCopyMode', 'type': 'str'},
+ 'ignore_read_only': {'key': 'ignoreReadOnly', 'type': 'bool'},
+ 'file_attributes': {'key': 'fileAttributes', 'type': 'str'},
+ 'file_creation_time': {'key': 'fileCreationTime', 'type': 'str'},
+ 'file_last_write_time': {'key': 'fileLastWriteTime', 'type': 'str'},
+ 'set_archive_attribute': {'key': 'setArchiveAttribute', 'type': 'bool'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
super(CopyFileSmbInfo, self).__init__(**kwargs)
self.file_permission_copy_mode = kwargs.get('file_permission_copy_mode', None)
self.ignore_read_only = kwargs.get('ignore_read_only', None)
@@ -120,34 +119,28 @@ def __init__(self, **kwargs):
self.set_archive_attribute = kwargs.get('set_archive_attribute', None)
-class CorsRule(Model):
- """CORS is an HTTP feature that enables a web application running under one
- domain to access resources in another domain. Web browsers implement a
- security restriction known as same-origin policy that prevents a web page
- from calling APIs in a different domain; CORS provides a secure way to
- allow one domain (the origin domain) to call APIs in another domain.
+class CorsRule(msrest.serialization.Model):
+ """CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain.
All required parameters must be populated in order to send to Azure.
- :param allowed_origins: Required. The origin domains that are permitted to
- make a request against the storage service via CORS. The origin domain is
- the domain from which the request originates. Note that the origin must be
- an exact case-sensitive match with the origin that the user age sends to
- the service. You can also use the wildcard character '*' to allow all
- origin domains to make requests via CORS.
+ :param allowed_origins: Required. The origin domains that are permitted to make a request
+ against the storage service via CORS. The origin domain is the domain from which the request
+ originates. Note that the origin must be an exact case-sensitive match with the origin that the
+ user age sends to the service. You can also use the wildcard character '*' to allow all origin
+ domains to make requests via CORS.
:type allowed_origins: str
- :param allowed_methods: Required. The methods (HTTP request verbs) that
- the origin domain may use for a CORS request. (comma separated)
+ :param allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may
+ use for a CORS request. (comma separated).
:type allowed_methods: str
- :param allowed_headers: Required. The request headers that the origin
- domain may specify on the CORS request.
+ :param allowed_headers: Required. The request headers that the origin domain may specify on the
+ CORS request.
:type allowed_headers: str
- :param exposed_headers: Required. The response headers that may be sent in
- the response to the CORS request and exposed by the browser to the request
- issuer.
+ :param exposed_headers: Required. The response headers that may be sent in the response to the
+ CORS request and exposed by the browser to the request issuer.
:type exposed_headers: str
- :param max_age_in_seconds: Required. The maximum amount time that a
- browser should cache the preflight OPTIONS request.
+ :param max_age_in_seconds: Required. The maximum amount time that a browser should cache the
+ preflight OPTIONS request.
:type max_age_in_seconds: int
"""
@@ -160,25 +153,26 @@ class CorsRule(Model):
}
_attribute_map = {
- 'allowed_origins': {'key': 'AllowedOrigins', 'type': 'str', 'xml': {'name': 'AllowedOrigins'}},
- 'allowed_methods': {'key': 'AllowedMethods', 'type': 'str', 'xml': {'name': 'AllowedMethods'}},
- 'allowed_headers': {'key': 'AllowedHeaders', 'type': 'str', 'xml': {'name': 'AllowedHeaders'}},
- 'exposed_headers': {'key': 'ExposedHeaders', 'type': 'str', 'xml': {'name': 'ExposedHeaders'}},
- 'max_age_in_seconds': {'key': 'MaxAgeInSeconds', 'type': 'int', 'xml': {'name': 'MaxAgeInSeconds'}},
- }
- _xml_map = {
+ 'allowed_origins': {'key': 'AllowedOrigins', 'type': 'str'},
+ 'allowed_methods': {'key': 'AllowedMethods', 'type': 'str'},
+ 'allowed_headers': {'key': 'AllowedHeaders', 'type': 'str'},
+ 'exposed_headers': {'key': 'ExposedHeaders', 'type': 'str'},
+ 'max_age_in_seconds': {'key': 'MaxAgeInSeconds', 'type': 'int'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(CorsRule, self).__init__(**kwargs)
- self.allowed_origins = kwargs.get('allowed_origins', None)
- self.allowed_methods = kwargs.get('allowed_methods', None)
- self.allowed_headers = kwargs.get('allowed_headers', None)
- self.exposed_headers = kwargs.get('exposed_headers', None)
- self.max_age_in_seconds = kwargs.get('max_age_in_seconds', None)
+ self.allowed_origins = kwargs['allowed_origins']
+ self.allowed_methods = kwargs['allowed_methods']
+ self.allowed_headers = kwargs['allowed_headers']
+ self.exposed_headers = kwargs['exposed_headers']
+ self.max_age_in_seconds = kwargs['max_age_in_seconds']
-class DirectoryItem(Model):
+class DirectoryItem(msrest.serialization.Model):
"""A listed directory item.
All required parameters must be populated in order to send to Azure.
@@ -192,52 +186,52 @@ class DirectoryItem(Model):
}
_attribute_map = {
- 'name': {'key': 'Name', 'type': 'str', 'xml': {'name': 'Name'}},
+ 'name': {'key': 'Name', 'type': 'str'},
}
_xml_map = {
'name': 'Directory'
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(DirectoryItem, self).__init__(**kwargs)
- self.name = kwargs.get('name', None)
+ self.name = kwargs['name']
-class FileHTTPHeaders(Model):
- """Additional parameters for a set of operations, such as: File_create,
- File_set_http_headers.
+class FileHTTPHeaders(msrest.serialization.Model):
+ """Parameter group.
- :param file_content_type: Sets the MIME content type of the file. The
- default type is 'application/octet-stream'.
+ :param file_content_type: Sets the MIME content type of the file. The default type is
+ 'application/octet-stream'.
:type file_content_type: str
- :param file_content_encoding: Specifies which content encodings have been
- applied to the file.
+ :param file_content_encoding: Specifies which content encodings have been applied to the file.
:type file_content_encoding: str
- :param file_content_language: Specifies the natural languages used by this
- resource.
+ :param file_content_language: Specifies the natural languages used by this resource.
:type file_content_language: str
- :param file_cache_control: Sets the file's cache control. The File service
- stores this value but does not use or modify it.
+ :param file_cache_control: Sets the file's cache control. The File service stores this value
+ but does not use or modify it.
:type file_cache_control: str
:param file_content_md5: Sets the file's MD5 hash.
:type file_content_md5: bytearray
- :param file_content_disposition: Sets the file's Content-Disposition
- header.
+ :param file_content_disposition: Sets the file's Content-Disposition header.
:type file_content_disposition: str
"""
_attribute_map = {
- 'file_content_type': {'key': '', 'type': 'str', 'xml': {'name': 'file_content_type'}},
- 'file_content_encoding': {'key': '', 'type': 'str', 'xml': {'name': 'file_content_encoding'}},
- 'file_content_language': {'key': '', 'type': 'str', 'xml': {'name': 'file_content_language'}},
- 'file_cache_control': {'key': '', 'type': 'str', 'xml': {'name': 'file_cache_control'}},
- 'file_content_md5': {'key': '', 'type': 'bytearray', 'xml': {'name': 'file_content_md5'}},
- 'file_content_disposition': {'key': '', 'type': 'str', 'xml': {'name': 'file_content_disposition'}},
- }
- _xml_map = {
- }
-
- def __init__(self, **kwargs):
+ 'file_content_type': {'key': 'fileContentType', 'type': 'str'},
+ 'file_content_encoding': {'key': 'fileContentEncoding', 'type': 'str'},
+ 'file_content_language': {'key': 'fileContentLanguage', 'type': 'str'},
+ 'file_cache_control': {'key': 'fileCacheControl', 'type': 'str'},
+ 'file_content_md5': {'key': 'fileContentMD5', 'type': 'bytearray'},
+ 'file_content_disposition': {'key': 'fileContentDisposition', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
super(FileHTTPHeaders, self).__init__(**kwargs)
self.file_content_type = kwargs.get('file_content_type', None)
self.file_content_encoding = kwargs.get('file_content_encoding', None)
@@ -247,14 +241,14 @@ def __init__(self, **kwargs):
self.file_content_disposition = kwargs.get('file_content_disposition', None)
-class FileItem(Model):
+class FileItem(msrest.serialization.Model):
"""A listed file item.
All required parameters must be populated in order to send to Azure.
:param name: Required.
:type name: str
- :param properties: Required.
+ :param properties: Required. File properties.
:type properties: ~azure.storage.fileshare.models.FileProperty
"""
@@ -264,29 +258,31 @@ class FileItem(Model):
}
_attribute_map = {
- 'name': {'key': 'Name', 'type': 'str', 'xml': {'name': 'Name'}},
- 'properties': {'key': 'Properties', 'type': 'FileProperty', 'xml': {'name': 'Properties'}},
+ 'name': {'key': 'Name', 'type': 'str'},
+ 'properties': {'key': 'Properties', 'type': 'FileProperty'},
}
_xml_map = {
'name': 'File'
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(FileItem, self).__init__(**kwargs)
- self.name = kwargs.get('name', None)
- self.properties = kwargs.get('properties', None)
+ self.name = kwargs['name']
+ self.properties = kwargs['properties']
-class FileProperty(Model):
+class FileProperty(msrest.serialization.Model):
"""File properties.
All required parameters must be populated in order to send to Azure.
- :param content_length: Required. Content length of the file. This value
- may not be up-to-date since an SMB client may have modified the file
- locally. The value of Content-Length may not reflect that fact until the
- handle is closed or the op-lock is broken. To retrieve current property
- values, call Get File Properties.
+ :param content_length: Required. Content length of the file. This value may not be up-to-date
+ since an SMB client may have modified the file locally. The value of Content-Length may not
+ reflect that fact until the handle is closed or the op-lock is broken. To retrieve current
+ property values, call Get File Properties.
:type content_length: long
"""
@@ -295,17 +291,18 @@ class FileProperty(Model):
}
_attribute_map = {
- 'content_length': {'key': 'Content-Length', 'type': 'long', 'xml': {'name': 'Content-Length'}},
- }
- _xml_map = {
+ 'content_length': {'key': 'Content-Length', 'type': 'long'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(FileProperty, self).__init__(**kwargs)
- self.content_length = kwargs.get('content_length', None)
+ self.content_length = kwargs['content_length']
-class FileRange(Model):
+class FileRange(msrest.serialization.Model):
"""An Azure Storage file range.
All required parameters must be populated in order to send to Azure.
@@ -322,20 +319,23 @@ class FileRange(Model):
}
_attribute_map = {
- 'start': {'key': 'Start', 'type': 'long', 'xml': {'name': 'Start'}},
- 'end': {'key': 'End', 'type': 'long', 'xml': {'name': 'End'}},
+ 'start': {'key': 'Start', 'type': 'long'},
+ 'end': {'key': 'End', 'type': 'long'},
}
_xml_map = {
'name': 'Range'
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(FileRange, self).__init__(**kwargs)
- self.start = kwargs.get('start', None)
- self.end = kwargs.get('end', None)
+ self.start = kwargs['start']
+ self.end = kwargs['end']
-class FilesAndDirectoriesListSegment(Model):
+class FilesAndDirectoriesListSegment(msrest.serialization.Model):
"""Abstract for entries that can be listed from Directory.
All required parameters must be populated in order to send to Azure.
@@ -352,45 +352,44 @@ class FilesAndDirectoriesListSegment(Model):
}
_attribute_map = {
- 'directory_items': {'key': 'DirectoryItems', 'type': '[DirectoryItem]', 'xml': {'name': 'DirectoryItems', 'itemsName': 'Directory'}},
- 'file_items': {'key': 'FileItems', 'type': '[FileItem]', 'xml': {'name': 'FileItems', 'itemsName': 'File'}},
+ 'directory_items': {'key': 'DirectoryItems', 'type': '[DirectoryItem]'},
+ 'file_items': {'key': 'FileItems', 'type': '[FileItem]'},
}
_xml_map = {
'name': 'Entries'
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(FilesAndDirectoriesListSegment, self).__init__(**kwargs)
- self.directory_items = kwargs.get('directory_items', None)
- self.file_items = kwargs.get('file_items', None)
+ self.directory_items = kwargs['directory_items']
+ self.file_items = kwargs['file_items']
-class HandleItem(Model):
+class HandleItem(msrest.serialization.Model):
"""A listed Azure Storage handle item.
All required parameters must be populated in order to send to Azure.
- :param handle_id: Required. XSMB service handle ID
+ :param handle_id: Required. XSMB service handle ID.
:type handle_id: str
- :param path: Required. File or directory name including full path starting
- from share root
+ :param path: Required. File or directory name including full path starting from share root.
:type path: str
- :param file_id: Required. FileId uniquely identifies the file or
- directory.
+ :param file_id: Required. FileId uniquely identifies the file or directory.
:type file_id: str
- :param parent_id: ParentId uniquely identifies the parent directory of the
- object.
+ :param parent_id: ParentId uniquely identifies the parent directory of the object.
:type parent_id: str
- :param session_id: Required. SMB session ID in context of which the file
- handle was opened
+ :param session_id: Required. SMB session ID in context of which the file handle was opened.
:type session_id: str
- :param client_ip: Required. Client IP that opened the handle
+ :param client_ip: Required. Client IP that opened the handle.
:type client_ip: str
- :param open_time: Required. Time when the session that previously opened
- the handle has last been reconnected. (UTC)
- :type open_time: datetime
- :param last_reconnect_time: Time handle was last connected to (UTC)
- :type last_reconnect_time: datetime
+ :param open_time: Required. Time when the session that previously opened the handle has last
+ been reconnected. (UTC).
+ :type open_time: ~datetime.datetime
+ :param last_reconnect_time: Time handle was last connected to (UTC).
+ :type last_reconnect_time: ~datetime.datetime
"""
_validation = {
@@ -403,51 +402,55 @@ class HandleItem(Model):
}
_attribute_map = {
- 'handle_id': {'key': 'HandleId', 'type': 'str', 'xml': {'name': 'HandleId'}},
- 'path': {'key': 'Path', 'type': 'str', 'xml': {'name': 'Path'}},
- 'file_id': {'key': 'FileId', 'type': 'str', 'xml': {'name': 'FileId'}},
- 'parent_id': {'key': 'ParentId', 'type': 'str', 'xml': {'name': 'ParentId'}},
- 'session_id': {'key': 'SessionId', 'type': 'str', 'xml': {'name': 'SessionId'}},
- 'client_ip': {'key': 'ClientIp', 'type': 'str', 'xml': {'name': 'ClientIp'}},
- 'open_time': {'key': 'OpenTime', 'type': 'rfc-1123', 'xml': {'name': 'OpenTime'}},
- 'last_reconnect_time': {'key': 'LastReconnectTime', 'type': 'rfc-1123', 'xml': {'name': 'LastReconnectTime'}},
+ 'handle_id': {'key': 'HandleId', 'type': 'str'},
+ 'path': {'key': 'Path', 'type': 'str'},
+ 'file_id': {'key': 'FileId', 'type': 'str'},
+ 'parent_id': {'key': 'ParentId', 'type': 'str'},
+ 'session_id': {'key': 'SessionId', 'type': 'str'},
+ 'client_ip': {'key': 'ClientIp', 'type': 'str'},
+ 'open_time': {'key': 'OpenTime', 'type': 'rfc-1123'},
+ 'last_reconnect_time': {'key': 'LastReconnectTime', 'type': 'rfc-1123'},
}
_xml_map = {
'name': 'Handle'
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(HandleItem, self).__init__(**kwargs)
- self.handle_id = kwargs.get('handle_id', None)
- self.path = kwargs.get('path', None)
- self.file_id = kwargs.get('file_id', None)
+ self.handle_id = kwargs['handle_id']
+ self.path = kwargs['path']
+ self.file_id = kwargs['file_id']
self.parent_id = kwargs.get('parent_id', None)
- self.session_id = kwargs.get('session_id', None)
- self.client_ip = kwargs.get('client_ip', None)
- self.open_time = kwargs.get('open_time', None)
+ self.session_id = kwargs['session_id']
+ self.client_ip = kwargs['client_ip']
+ self.open_time = kwargs['open_time']
self.last_reconnect_time = kwargs.get('last_reconnect_time', None)
-class LeaseAccessConditions(Model):
- """Additional parameters for a set of operations.
+class LeaseAccessConditions(msrest.serialization.Model):
+ """Parameter group.
- :param lease_id: If specified, the operation only succeeds if the
- resource's lease is active and matches this ID.
+ :param lease_id: If specified, the operation only succeeds if the resource's lease is active
+ and matches this ID.
:type lease_id: str
"""
_attribute_map = {
- 'lease_id': {'key': '', 'type': 'str', 'xml': {'name': 'lease_id'}},
- }
- _xml_map = {
+ 'lease_id': {'key': 'leaseId', 'type': 'str'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(LeaseAccessConditions, self).__init__(**kwargs)
self.lease_id = kwargs.get('lease_id', None)
-class ListFilesAndDirectoriesSegmentResponse(Model):
+class ListFilesAndDirectoriesSegmentResponse(msrest.serialization.Model):
"""An enumeration of directories and files.
All required parameters must be populated in order to send to Azure.
@@ -466,9 +469,8 @@ class ListFilesAndDirectoriesSegmentResponse(Model):
:type marker: str
:param max_results:
:type max_results: int
- :param segment: Required.
- :type segment:
- ~azure.storage.fileshare.models.FilesAndDirectoriesListSegment
+ :param segment: Required. Abstract for entries that can be listed from Directory.
+ :type segment: ~azure.storage.fileshare.models.FilesAndDirectoriesListSegment
:param next_marker: Required.
:type next_marker: str
"""
@@ -483,34 +485,37 @@ class ListFilesAndDirectoriesSegmentResponse(Model):
}
_attribute_map = {
- 'service_endpoint': {'key': 'ServiceEndpoint', 'type': 'str', 'xml': {'name': 'ServiceEndpoint', 'attr': True}},
- 'share_name': {'key': 'ShareName', 'type': 'str', 'xml': {'name': 'ShareName', 'attr': True}},
- 'share_snapshot': {'key': 'ShareSnapshot', 'type': 'str', 'xml': {'name': 'ShareSnapshot', 'attr': True}},
- 'directory_path': {'key': 'DirectoryPath', 'type': 'str', 'xml': {'name': 'DirectoryPath', 'attr': True}},
- 'prefix': {'key': 'Prefix', 'type': 'str', 'xml': {'name': 'Prefix'}},
- 'marker': {'key': 'Marker', 'type': 'str', 'xml': {'name': 'Marker'}},
- 'max_results': {'key': 'MaxResults', 'type': 'int', 'xml': {'name': 'MaxResults'}},
- 'segment': {'key': 'Segment', 'type': 'FilesAndDirectoriesListSegment', 'xml': {'name': 'Segment'}},
- 'next_marker': {'key': 'NextMarker', 'type': 'str', 'xml': {'name': 'NextMarker'}},
+ 'service_endpoint': {'key': 'ServiceEndpoint', 'type': 'str', 'xml': {'attr': True}},
+ 'share_name': {'key': 'ShareName', 'type': 'str', 'xml': {'attr': True}},
+ 'share_snapshot': {'key': 'ShareSnapshot', 'type': 'str', 'xml': {'attr': True}},
+ 'directory_path': {'key': 'DirectoryPath', 'type': 'str', 'xml': {'attr': True}},
+ 'prefix': {'key': 'Prefix', 'type': 'str'},
+ 'marker': {'key': 'Marker', 'type': 'str'},
+ 'max_results': {'key': 'MaxResults', 'type': 'int'},
+ 'segment': {'key': 'Segment', 'type': 'FilesAndDirectoriesListSegment'},
+ 'next_marker': {'key': 'NextMarker', 'type': 'str'},
}
_xml_map = {
'name': 'EnumerationResults'
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(ListFilesAndDirectoriesSegmentResponse, self).__init__(**kwargs)
- self.service_endpoint = kwargs.get('service_endpoint', None)
- self.share_name = kwargs.get('share_name', None)
+ self.service_endpoint = kwargs['service_endpoint']
+ self.share_name = kwargs['share_name']
self.share_snapshot = kwargs.get('share_snapshot', None)
- self.directory_path = kwargs.get('directory_path', None)
- self.prefix = kwargs.get('prefix', None)
+ self.directory_path = kwargs['directory_path']
+ self.prefix = kwargs['prefix']
self.marker = kwargs.get('marker', None)
self.max_results = kwargs.get('max_results', None)
- self.segment = kwargs.get('segment', None)
- self.next_marker = kwargs.get('next_marker', None)
+ self.segment = kwargs['segment']
+ self.next_marker = kwargs['next_marker']
-class ListHandlesResponse(Model):
+class ListHandlesResponse(msrest.serialization.Model):
"""An enumeration of handles.
All required parameters must be populated in order to send to Azure.
@@ -526,20 +531,23 @@ class ListHandlesResponse(Model):
}
_attribute_map = {
- 'handle_list': {'key': 'HandleList', 'type': '[HandleItem]', 'xml': {'name': 'Entries', 'itemsName': 'Entries', 'wrapped': True}},
- 'next_marker': {'key': 'NextMarker', 'type': 'str', 'xml': {'name': 'NextMarker'}},
+ 'handle_list': {'key': 'HandleList', 'type': '[HandleItem]', 'xml': {'name': 'Entries', 'wrapped': True, 'itemsName': 'Handle'}},
+ 'next_marker': {'key': 'NextMarker', 'type': 'str'},
}
_xml_map = {
'name': 'EnumerationResults'
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(ListHandlesResponse, self).__init__(**kwargs)
self.handle_list = kwargs.get('handle_list', None)
- self.next_marker = kwargs.get('next_marker', None)
+ self.next_marker = kwargs['next_marker']
-class ListSharesResponse(Model):
+class ListSharesResponse(msrest.serialization.Model):
"""An enumeration of shares.
All required parameters must be populated in order to send to Azure.
@@ -564,41 +572,43 @@ class ListSharesResponse(Model):
}
_attribute_map = {
- 'service_endpoint': {'key': 'ServiceEndpoint', 'type': 'str', 'xml': {'name': 'ServiceEndpoint', 'attr': True}},
- 'prefix': {'key': 'Prefix', 'type': 'str', 'xml': {'name': 'Prefix'}},
- 'marker': {'key': 'Marker', 'type': 'str', 'xml': {'name': 'Marker'}},
- 'max_results': {'key': 'MaxResults', 'type': 'int', 'xml': {'name': 'MaxResults'}},
- 'share_items': {'key': 'ShareItems', 'type': '[ShareItemInternal]', 'xml': {'name': 'Shares', 'itemsName': 'Shares', 'wrapped': True}},
- 'next_marker': {'key': 'NextMarker', 'type': 'str', 'xml': {'name': 'NextMarker'}},
+ 'service_endpoint': {'key': 'ServiceEndpoint', 'type': 'str', 'xml': {'attr': True}},
+ 'prefix': {'key': 'Prefix', 'type': 'str'},
+ 'marker': {'key': 'Marker', 'type': 'str'},
+ 'max_results': {'key': 'MaxResults', 'type': 'int'},
+ 'share_items': {'key': 'ShareItems', 'type': '[ShareItemInternal]', 'xml': {'name': 'Shares', 'wrapped': True, 'itemsName': 'Share'}},
+ 'next_marker': {'key': 'NextMarker', 'type': 'str'},
}
_xml_map = {
'name': 'EnumerationResults'
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(ListSharesResponse, self).__init__(**kwargs)
- self.service_endpoint = kwargs.get('service_endpoint', None)
+ self.service_endpoint = kwargs['service_endpoint']
self.prefix = kwargs.get('prefix', None)
self.marker = kwargs.get('marker', None)
self.max_results = kwargs.get('max_results', None)
self.share_items = kwargs.get('share_items', None)
- self.next_marker = kwargs.get('next_marker', None)
+ self.next_marker = kwargs['next_marker']
-class Metrics(Model):
+class Metrics(msrest.serialization.Model):
"""Storage Analytics metrics for file service.
All required parameters must be populated in order to send to Azure.
:param version: Required. The version of Storage Analytics to configure.
:type version: str
- :param enabled: Required. Indicates whether metrics are enabled for the
- File service.
+ :param enabled: Required. Indicates whether metrics are enabled for the File service.
:type enabled: bool
- :param include_apis: Indicates whether metrics should generate summary
- statistics for called API operations.
+ :param include_apis: Indicates whether metrics should generate summary statistics for called
+ API operations.
:type include_apis: bool
- :param retention_policy:
+ :param retention_policy: The retention policy.
:type retention_policy: ~azure.storage.fileshare.models.RetentionPolicy
"""
@@ -608,34 +618,34 @@ class Metrics(Model):
}
_attribute_map = {
- 'version': {'key': 'Version', 'type': 'str', 'xml': {'name': 'Version'}},
- 'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}},
- 'include_apis': {'key': 'IncludeAPIs', 'type': 'bool', 'xml': {'name': 'IncludeAPIs'}},
- 'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy', 'xml': {'name': 'RetentionPolicy'}},
- }
- _xml_map = {
+ 'version': {'key': 'Version', 'type': 'str'},
+ 'enabled': {'key': 'Enabled', 'type': 'bool'},
+ 'include_apis': {'key': 'IncludeAPIs', 'type': 'bool'},
+ 'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(Metrics, self).__init__(**kwargs)
- self.version = kwargs.get('version', None)
- self.enabled = kwargs.get('enabled', None)
+ self.version = kwargs['version']
+ self.enabled = kwargs['enabled']
self.include_apis = kwargs.get('include_apis', None)
self.retention_policy = kwargs.get('retention_policy', None)
-class RetentionPolicy(Model):
+class RetentionPolicy(msrest.serialization.Model):
"""The retention policy.
All required parameters must be populated in order to send to Azure.
- :param enabled: Required. Indicates whether a retention policy is enabled
- for the File service. If false, metrics data is retained, and the user is
- responsible for deleting it.
+ :param enabled: Required. Indicates whether a retention policy is enabled for the File service.
+ If false, metrics data is retained, and the user is responsible for deleting it.
:type enabled: bool
- :param days: Indicates the number of days that metrics data should be
- retained. All data older than this value will be deleted. Metrics data is
- deleted on a best-effort basis after the retention period expires.
+ :param days: Indicates the number of days that metrics data should be retained. All data older
+ than this value will be deleted. Metrics data is deleted on a best-effort basis after the
+ retention period expires.
:type days: int
"""
@@ -645,19 +655,20 @@ class RetentionPolicy(Model):
}
_attribute_map = {
- 'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}},
- 'days': {'key': 'Days', 'type': 'int', 'xml': {'name': 'Days'}},
- }
- _xml_map = {
+ 'enabled': {'key': 'Enabled', 'type': 'bool'},
+ 'days': {'key': 'Days', 'type': 'int'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(RetentionPolicy, self).__init__(**kwargs)
- self.enabled = kwargs.get('enabled', None)
+ self.enabled = kwargs['enabled']
self.days = kwargs.get('days', None)
-class ShareFileRangeList(Model):
+class ShareFileRangeList(msrest.serialization.Model):
"""The list of file ranges.
:param ranges:
@@ -667,19 +678,20 @@ class ShareFileRangeList(Model):
"""
_attribute_map = {
- 'ranges': {'key': 'Ranges', 'type': '[FileRange]', 'xml': {'name': 'Ranges', 'itemsName': 'Range'}},
- 'clear_ranges': {'key': 'ClearRanges', 'type': '[ClearRange]', 'xml': {'name': 'ClearRanges', 'itemsName': 'ClearRange'}},
- }
- _xml_map = {
+ 'ranges': {'key': 'Ranges', 'type': '[FileRange]'},
+ 'clear_ranges': {'key': 'ClearRanges', 'type': '[ClearRange]'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(ShareFileRangeList, self).__init__(**kwargs)
self.ranges = kwargs.get('ranges', None)
self.clear_ranges = kwargs.get('clear_ranges', None)
-class ShareItemInternal(Model):
+class ShareItemInternal(msrest.serialization.Model):
"""A listed Azure Storage share item.
All required parameters must be populated in order to send to Azure.
@@ -692,9 +704,9 @@ class ShareItemInternal(Model):
:type deleted: bool
:param version:
:type version: str
- :param properties: Required.
+ :param properties: Required. Properties of a share.
:type properties: ~azure.storage.fileshare.models.SharePropertiesInternal
- :param metadata:
+ :param metadata: Dictionary of :code:``.
:type metadata: dict[str, str]
"""
@@ -704,34 +716,37 @@ class ShareItemInternal(Model):
}
_attribute_map = {
- 'name': {'key': 'Name', 'type': 'str', 'xml': {'name': 'Name'}},
- 'snapshot': {'key': 'Snapshot', 'type': 'str', 'xml': {'name': 'Snapshot'}},
- 'deleted': {'key': 'Deleted', 'type': 'bool', 'xml': {'name': 'Deleted'}},
- 'version': {'key': 'Version', 'type': 'str', 'xml': {'name': 'Version'}},
- 'properties': {'key': 'Properties', 'type': 'SharePropertiesInternal', 'xml': {'name': 'Properties'}},
- 'metadata': {'key': 'Metadata', 'type': '{str}', 'xml': {'name': 'Metadata'}},
+ 'name': {'key': 'Name', 'type': 'str'},
+ 'snapshot': {'key': 'Snapshot', 'type': 'str'},
+ 'deleted': {'key': 'Deleted', 'type': 'bool'},
+ 'version': {'key': 'Version', 'type': 'str'},
+ 'properties': {'key': 'Properties', 'type': 'SharePropertiesInternal'},
+ 'metadata': {'key': 'Metadata', 'type': '{str}'},
}
_xml_map = {
'name': 'Share'
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(ShareItemInternal, self).__init__(**kwargs)
- self.name = kwargs.get('name', None)
+ self.name = kwargs['name']
self.snapshot = kwargs.get('snapshot', None)
self.deleted = kwargs.get('deleted', None)
self.version = kwargs.get('version', None)
- self.properties = kwargs.get('properties', None)
+ self.properties = kwargs['properties']
self.metadata = kwargs.get('metadata', None)
-class SharePermission(Model):
+class SharePermission(msrest.serialization.Model):
"""A permission (a security descriptor) at the share level.
All required parameters must be populated in order to send to Azure.
- :param permission: Required. The permission in the Security Descriptor
- Definition Language (SDDL).
+ :param permission: Required. The permission in the Security Descriptor Definition Language
+ (SDDL).
:type permission: str
"""
@@ -740,57 +755,58 @@ class SharePermission(Model):
}
_attribute_map = {
- 'permission': {'key': 'permission', 'type': 'str', 'xml': {'name': 'permission'}},
- }
- _xml_map = {
+ 'permission': {'key': 'permission', 'type': 'str'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(SharePermission, self).__init__(**kwargs)
- self.permission = kwargs.get('permission', None)
+ self.permission = kwargs['permission']
-class SharePropertiesInternal(Model):
+class SharePropertiesInternal(msrest.serialization.Model):
"""Properties of a share.
All required parameters must be populated in order to send to Azure.
:param last_modified: Required.
- :type last_modified: datetime
+ :type last_modified: ~datetime.datetime
:param etag: Required.
:type etag: str
:param quota: Required.
:type quota: int
:param provisioned_iops:
:type provisioned_iops: int
- :param provisioned_ingress_mbps:
- :type provisioned_ingress_mbps: int
- :param provisioned_egress_mbps:
- :type provisioned_egress_mbps: int
+ :param provisioned_ingress_m_bps:
+ :type provisioned_ingress_m_bps: int
+ :param provisioned_egress_m_bps:
+ :type provisioned_egress_m_bps: int
:param next_allowed_quota_downgrade_time:
- :type next_allowed_quota_downgrade_time: datetime
+ :type next_allowed_quota_downgrade_time: ~datetime.datetime
:param deleted_time:
- :type deleted_time: datetime
+ :type deleted_time: ~datetime.datetime
:param remaining_retention_days:
:type remaining_retention_days: int
:param access_tier:
:type access_tier: str
:param access_tier_change_time:
- :type access_tier_change_time: datetime
+ :type access_tier_change_time: ~datetime.datetime
:param access_tier_transition_state:
:type access_tier_transition_state: str
- :param lease_status: Possible values include: 'locked', 'unlocked'
+ :param lease_status: The current lease status of the share. Possible values include: "locked",
+ "unlocked".
:type lease_status: str or ~azure.storage.fileshare.models.LeaseStatusType
- :param lease_state: Possible values include: 'available', 'leased',
- 'expired', 'breaking', 'broken'
+ :param lease_state: Lease state of the share. Possible values include: "available", "leased",
+ "expired", "breaking", "broken".
:type lease_state: str or ~azure.storage.fileshare.models.LeaseStateType
- :param lease_duration: Possible values include: 'infinite', 'fixed'
- :type lease_duration: str or
- ~azure.storage.fileshare.models.LeaseDurationType
+ :param lease_duration: When a share is leased, specifies whether the lease is of infinite or
+ fixed duration. Possible values include: "infinite", "fixed".
+ :type lease_duration: str or ~azure.storage.fileshare.models.LeaseDurationType
:param enabled_protocols:
:type enabled_protocols: str
- :param root_squash: Possible values include: 'NoRootSquash', 'RootSquash',
- 'AllSquash'
+ :param root_squash: Possible values include: "NoRootSquash", "RootSquash", "AllSquash".
:type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash
"""
@@ -801,35 +817,36 @@ class SharePropertiesInternal(Model):
}
_attribute_map = {
- 'last_modified': {'key': 'Last-Modified', 'type': 'rfc-1123', 'xml': {'name': 'Last-Modified'}},
- 'etag': {'key': 'Etag', 'type': 'str', 'xml': {'name': 'Etag'}},
- 'quota': {'key': 'Quota', 'type': 'int', 'xml': {'name': 'Quota'}},
- 'provisioned_iops': {'key': 'ProvisionedIops', 'type': 'int', 'xml': {'name': 'ProvisionedIops'}},
- 'provisioned_ingress_mbps': {'key': 'ProvisionedIngressMBps', 'type': 'int', 'xml': {'name': 'ProvisionedIngressMBps'}},
- 'provisioned_egress_mbps': {'key': 'ProvisionedEgressMBps', 'type': 'int', 'xml': {'name': 'ProvisionedEgressMBps'}},
- 'next_allowed_quota_downgrade_time': {'key': 'NextAllowedQuotaDowngradeTime', 'type': 'rfc-1123', 'xml': {'name': 'NextAllowedQuotaDowngradeTime'}},
- 'deleted_time': {'key': 'DeletedTime', 'type': 'rfc-1123', 'xml': {'name': 'DeletedTime'}},
- 'remaining_retention_days': {'key': 'RemainingRetentionDays', 'type': 'int', 'xml': {'name': 'RemainingRetentionDays'}},
- 'access_tier': {'key': 'AccessTier', 'type': 'str', 'xml': {'name': 'AccessTier'}},
- 'access_tier_change_time': {'key': 'AccessTierChangeTime', 'type': 'rfc-1123', 'xml': {'name': 'AccessTierChangeTime'}},
- 'access_tier_transition_state': {'key': 'AccessTierTransitionState', 'type': 'str', 'xml': {'name': 'AccessTierTransitionState'}},
- 'lease_status': {'key': 'LeaseStatus', 'type': 'LeaseStatusType', 'xml': {'name': 'LeaseStatus'}},
- 'lease_state': {'key': 'LeaseState', 'type': 'LeaseStateType', 'xml': {'name': 'LeaseState'}},
- 'lease_duration': {'key': 'LeaseDuration', 'type': 'LeaseDurationType', 'xml': {'name': 'LeaseDuration'}},
- 'enabled_protocols': {'key': 'EnabledProtocols', 'type': 'str', 'xml': {'name': 'EnabledProtocols'}},
- 'root_squash': {'key': 'RootSquash', 'type': 'ShareRootSquash', 'xml': {'name': 'RootSquash'}},
- }
- _xml_map = {
- }
-
- def __init__(self, **kwargs):
+ 'last_modified': {'key': 'Last-Modified', 'type': 'rfc-1123'},
+ 'etag': {'key': 'Etag', 'type': 'str'},
+ 'quota': {'key': 'Quota', 'type': 'int'},
+ 'provisioned_iops': {'key': 'ProvisionedIops', 'type': 'int'},
+ 'provisioned_ingress_m_bps': {'key': 'ProvisionedIngressMBps', 'type': 'int'},
+ 'provisioned_egress_m_bps': {'key': 'ProvisionedEgressMBps', 'type': 'int'},
+ 'next_allowed_quota_downgrade_time': {'key': 'NextAllowedQuotaDowngradeTime', 'type': 'rfc-1123'},
+ 'deleted_time': {'key': 'DeletedTime', 'type': 'rfc-1123'},
+ 'remaining_retention_days': {'key': 'RemainingRetentionDays', 'type': 'int'},
+ 'access_tier': {'key': 'AccessTier', 'type': 'str'},
+ 'access_tier_change_time': {'key': 'AccessTierChangeTime', 'type': 'rfc-1123'},
+ 'access_tier_transition_state': {'key': 'AccessTierTransitionState', 'type': 'str'},
+ 'lease_status': {'key': 'LeaseStatus', 'type': 'str'},
+ 'lease_state': {'key': 'LeaseState', 'type': 'str'},
+ 'lease_duration': {'key': 'LeaseDuration', 'type': 'str'},
+ 'enabled_protocols': {'key': 'EnabledProtocols', 'type': 'str'},
+ 'root_squash': {'key': 'RootSquash', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
super(SharePropertiesInternal, self).__init__(**kwargs)
- self.last_modified = kwargs.get('last_modified', None)
- self.etag = kwargs.get('etag', None)
- self.quota = kwargs.get('quota', None)
+ self.last_modified = kwargs['last_modified']
+ self.etag = kwargs['etag']
+ self.quota = kwargs['quota']
self.provisioned_iops = kwargs.get('provisioned_iops', None)
- self.provisioned_ingress_mbps = kwargs.get('provisioned_ingress_mbps', None)
- self.provisioned_egress_mbps = kwargs.get('provisioned_egress_mbps', None)
+ self.provisioned_ingress_m_bps = kwargs.get('provisioned_ingress_m_bps', None)
+ self.provisioned_egress_m_bps = kwargs.get('provisioned_egress_m_bps', None)
self.next_allowed_quota_downgrade_time = kwargs.get('next_allowed_quota_downgrade_time', None)
self.deleted_time = kwargs.get('deleted_time', None)
self.remaining_retention_days = kwargs.get('remaining_retention_days', None)
@@ -843,7 +860,7 @@ def __init__(self, **kwargs):
self.root_squash = kwargs.get('root_squash', None)
-class ShareProtocolSettings(Model):
+class ShareProtocolSettings(msrest.serialization.Model):
"""Protocol settings.
:param smb: Settings for SMB protocol.
@@ -853,15 +870,16 @@ class ShareProtocolSettings(Model):
_attribute_map = {
'smb': {'key': 'Smb', 'type': 'ShareSmbSettings', 'xml': {'name': 'SMB'}},
}
- _xml_map = {
- }
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(ShareProtocolSettings, self).__init__(**kwargs)
self.smb = kwargs.get('smb', None)
-class ShareSmbSettings(Model):
+class ShareSmbSettings(msrest.serialization.Model):
"""Settings for SMB protocol.
:param multichannel: Settings for SMB Multichannel.
@@ -869,24 +887,24 @@ class ShareSmbSettings(Model):
"""
_attribute_map = {
- 'multichannel': {'key': 'Multichannel', 'type': 'SmbMultichannel', 'xml': {'name': 'Multichannel'}},
- }
- _xml_map = {
+ 'multichannel': {'key': 'Multichannel', 'type': 'SmbMultichannel'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(ShareSmbSettings, self).__init__(**kwargs)
self.multichannel = kwargs.get('multichannel', None)
-class ShareStats(Model):
+class ShareStats(msrest.serialization.Model):
"""Stats for the share.
All required parameters must be populated in order to send to Azure.
- :param share_usage_bytes: Required. The approximate size of the data
- stored in bytes. Note that this value may not include all recently created
- or recently resized files.
+ :param share_usage_bytes: Required. The approximate size of the data stored in bytes. Note that
+ this value may not include all recently created or recently resized files.
:type share_usage_bytes: int
"""
@@ -895,17 +913,18 @@ class ShareStats(Model):
}
_attribute_map = {
- 'share_usage_bytes': {'key': 'ShareUsageBytes', 'type': 'int', 'xml': {'name': 'ShareUsageBytes'}},
- }
- _xml_map = {
+ 'share_usage_bytes': {'key': 'ShareUsageBytes', 'type': 'int'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(ShareStats, self).__init__(**kwargs)
- self.share_usage_bytes = kwargs.get('share_usage_bytes', None)
+ self.share_usage_bytes = kwargs['share_usage_bytes']
-class SignedIdentifier(Model):
+class SignedIdentifier(msrest.serialization.Model):
"""Signed identifier.
All required parameters must be populated in order to send to Azure.
@@ -921,19 +940,20 @@ class SignedIdentifier(Model):
}
_attribute_map = {
- 'id': {'key': 'Id', 'type': 'str', 'xml': {'name': 'Id'}},
- 'access_policy': {'key': 'AccessPolicy', 'type': 'AccessPolicy', 'xml': {'name': 'AccessPolicy'}},
- }
- _xml_map = {
+ 'id': {'key': 'Id', 'type': 'str'},
+ 'access_policy': {'key': 'AccessPolicy', 'type': 'AccessPolicy'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(SignedIdentifier, self).__init__(**kwargs)
- self.id = kwargs.get('id', None)
+ self.id = kwargs['id']
self.access_policy = kwargs.get('access_policy', None)
-class SmbMultichannel(Model):
+class SmbMultichannel(msrest.serialization.Model):
"""Settings for SMB multichannel.
:param enabled: If SMB multichannel is enabled.
@@ -941,42 +961,46 @@ class SmbMultichannel(Model):
"""
_attribute_map = {
- 'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}},
+ 'enabled': {'key': 'Enabled', 'type': 'bool'},
}
_xml_map = {
'name': 'Multichannel'
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(SmbMultichannel, self).__init__(**kwargs)
self.enabled = kwargs.get('enabled', None)
-class SourceModifiedAccessConditions(Model):
- """Additional parameters for upload_range_from_url operation.
+class SourceModifiedAccessConditions(msrest.serialization.Model):
+ """Parameter group.
- :param source_if_match_crc64: Specify the crc64 value to operate only on
- range with a matching crc64 checksum.
+ :param source_if_match_crc64: Specify the crc64 value to operate only on range with a matching
+ crc64 checksum.
:type source_if_match_crc64: bytearray
- :param source_if_none_match_crc64: Specify the crc64 value to operate only
- on range without a matching crc64 checksum.
+ :param source_if_none_match_crc64: Specify the crc64 value to operate only on range without a
+ matching crc64 checksum.
:type source_if_none_match_crc64: bytearray
"""
_attribute_map = {
- 'source_if_match_crc64': {'key': '', 'type': 'bytearray', 'xml': {'name': 'source_if_match_crc64'}},
- 'source_if_none_match_crc64': {'key': '', 'type': 'bytearray', 'xml': {'name': 'source_if_none_match_crc64'}},
- }
- _xml_map = {
+ 'source_if_match_crc64': {'key': 'sourceIfMatchCrc64', 'type': 'bytearray'},
+ 'source_if_none_match_crc64': {'key': 'sourceIfNoneMatchCrc64', 'type': 'bytearray'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(SourceModifiedAccessConditions, self).__init__(**kwargs)
self.source_if_match_crc64 = kwargs.get('source_if_match_crc64', None)
self.source_if_none_match_crc64 = kwargs.get('source_if_none_match_crc64', None)
-class StorageError(Model):
+class StorageError(msrest.serialization.Model):
"""StorageError.
:param message:
@@ -984,57 +1008,43 @@ class StorageError(Model):
"""
_attribute_map = {
- 'message': {'key': 'Message', 'type': 'str', 'xml': {'name': 'Message'}},
- }
- _xml_map = {
+ 'message': {'key': 'Message', 'type': 'str'},
}
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(StorageError, self).__init__(**kwargs)
self.message = kwargs.get('message', None)
-class StorageErrorException(HttpResponseError):
- """Server responsed with exception of type: 'StorageError'.
-
- :param deserialize: A deserializer
- :param response: Server response to be deserialized.
- """
-
- def __init__(self, response, deserialize, *args):
-
- model_name = 'StorageError'
- self.error = deserialize(model_name, response)
- if self.error is None:
- self.error = deserialize.dependencies[model_name]()
- super(StorageErrorException, self).__init__(response=response)
-
-
-class StorageServiceProperties(Model):
+class StorageServiceProperties(msrest.serialization.Model):
"""Storage service properties.
- :param hour_metrics: A summary of request statistics grouped by API in
- hourly aggregates for files.
+ :param hour_metrics: A summary of request statistics grouped by API in hourly aggregates for
+ files.
:type hour_metrics: ~azure.storage.fileshare.models.Metrics
- :param minute_metrics: A summary of request statistics grouped by API in
- minute aggregates for files.
+ :param minute_metrics: A summary of request statistics grouped by API in minute aggregates for
+ files.
:type minute_metrics: ~azure.storage.fileshare.models.Metrics
:param cors: The set of CORS rules.
:type cors: list[~azure.storage.fileshare.models.CorsRule]
- :param protocol: Protocol settings
+ :param protocol: Protocol settings.
:type protocol: ~azure.storage.fileshare.models.ShareProtocolSettings
"""
_attribute_map = {
- 'hour_metrics': {'key': 'HourMetrics', 'type': 'Metrics', 'xml': {'name': 'HourMetrics'}},
- 'minute_metrics': {'key': 'MinuteMetrics', 'type': 'Metrics', 'xml': {'name': 'MinuteMetrics'}},
- 'cors': {'key': 'Cors', 'type': '[CorsRule]', 'xml': {'name': 'Cors', 'itemsName': 'CorsRule', 'wrapped': True}},
+ 'hour_metrics': {'key': 'HourMetrics', 'type': 'Metrics'},
+ 'minute_metrics': {'key': 'MinuteMetrics', 'type': 'Metrics'},
+ 'cors': {'key': 'Cors', 'type': '[CorsRule]', 'xml': {'wrapped': True}},
'protocol': {'key': 'Protocol', 'type': 'ShareProtocolSettings', 'xml': {'name': 'ProtocolSettings'}},
}
- _xml_map = {
- }
- def __init__(self, **kwargs):
+ def __init__(
+ self,
+ **kwargs
+ ):
super(StorageServiceProperties, self).__init__(**kwargs)
self.hour_metrics = kwargs.get('hour_metrics', None)
self.minute_metrics = kwargs.get('minute_metrics', None)
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py
index 52af754c7447..0a52ef9ea0ee 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py
@@ -1,19 +1,21 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from msrest.serialization import Model
+import datetime
+from typing import Dict, List, Optional, Union
+
from azure.core.exceptions import HttpResponseError
+import msrest.serialization
+
+from ._azure_file_storage_enums import *
-class AccessPolicy(Model):
+class AccessPolicy(msrest.serialization.Model):
"""An Access policy.
:param start: The date-time the policy is active.
@@ -25,21 +27,26 @@ class AccessPolicy(Model):
"""
_attribute_map = {
- 'start': {'key': 'Start', 'type': 'str', 'xml': {'name': 'Start'}},
- 'expiry': {'key': 'Expiry', 'type': 'str', 'xml': {'name': 'Expiry'}},
- 'permission': {'key': 'Permission', 'type': 'str', 'xml': {'name': 'Permission'}},
- }
- _xml_map = {
- }
-
- def __init__(self, *, start: str=None, expiry: str=None, permission: str=None, **kwargs) -> None:
+ 'start': {'key': 'Start', 'type': 'str'},
+ 'expiry': {'key': 'Expiry', 'type': 'str'},
+ 'permission': {'key': 'Permission', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ *,
+ start: Optional[str] = None,
+ expiry: Optional[str] = None,
+ permission: Optional[str] = None,
+ **kwargs
+ ):
super(AccessPolicy, self).__init__(**kwargs)
self.start = start
self.expiry = expiry
self.permission = permission
-class ClearRange(Model):
+class ClearRange(msrest.serialization.Model):
"""ClearRange.
All required parameters must be populated in order to send to Azure.
@@ -63,54 +70,65 @@ class ClearRange(Model):
'name': 'ClearRange'
}
- def __init__(self, *, start: int, end: int, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ start: int,
+ end: int,
+ **kwargs
+ ):
super(ClearRange, self).__init__(**kwargs)
self.start = start
self.end = end
-class CopyFileSmbInfo(Model):
- """Additional parameters for start_copy operation.
+class CopyFileSmbInfo(msrest.serialization.Model):
+ """Parameter group.
- :param file_permission_copy_mode: Specifies the option to copy file
- security descriptor from source file or to set it using the value which is
- defined by the header value of x-ms-file-permission or
- x-ms-file-permission-key. Possible values include: 'source', 'override'
- :type file_permission_copy_mode: str or
- ~azure.storage.fileshare.models.PermissionCopyModeType
- :param ignore_read_only: Specifies the option to overwrite the target file
- if it already exists and has read-only attribute set.
+ :param file_permission_copy_mode: Specifies the option to copy file security descriptor from
+ source file or to set it using the value which is defined by the header value of x-ms-file-
+ permission or x-ms-file-permission-key. Possible values include: "source", "override".
+ :type file_permission_copy_mode: str or ~azure.storage.fileshare.models.PermissionCopyModeType
+ :param ignore_read_only: Specifies the option to overwrite the target file if it already exists
+ and has read-only attribute set.
:type ignore_read_only: bool
- :param file_attributes: Specifies either the option to copy file
- attributes from a source file(source) to a target file or a list of
- attributes to set on a target file.
+ :param file_attributes: Specifies either the option to copy file attributes from a source
+ file(source) to a target file or a list of attributes to set on a target file.
:type file_attributes: str
- :param file_creation_time: Specifies either the option to copy file
- creation time from a source file(source) to a target file or a time value
- in ISO 8601 format to set as creation time on a target file.
+ :param file_creation_time: Specifies either the option to copy file creation time from a source
+ file(source) to a target file or a time value in ISO 8601 format to set as creation time on a
+ target file.
:type file_creation_time: str
- :param file_last_write_time: Specifies either the option to copy file last
- write time from a source file(source) to a target file or a time value in
- ISO 8601 format to set as last write time on a target file.
+ :param file_last_write_time: Specifies either the option to copy file last write time from a
+ source file(source) to a target file or a time value in ISO 8601 format to set as last write
+ time on a target file.
:type file_last_write_time: str
- :param set_archive_attribute: Specifies the option to set archive
- attribute on a target file. True means archive attribute will be set on a
- target file despite attribute overrides or a source file state.
+ :param set_archive_attribute: Specifies the option to set archive attribute on a target file.
+ True means archive attribute will be set on a target file despite attribute overrides or a
+ source file state.
:type set_archive_attribute: bool
"""
_attribute_map = {
- 'file_permission_copy_mode': {'key': '', 'type': 'PermissionCopyModeType', 'xml': {'name': 'file_permission_copy_mode'}},
- 'ignore_read_only': {'key': '', 'type': 'bool', 'xml': {'name': 'ignore_read_only'}},
- 'file_attributes': {'key': '', 'type': 'str', 'xml': {'name': 'file_attributes'}},
- 'file_creation_time': {'key': '', 'type': 'str', 'xml': {'name': 'file_creation_time'}},
- 'file_last_write_time': {'key': '', 'type': 'str', 'xml': {'name': 'file_last_write_time'}},
- 'set_archive_attribute': {'key': '', 'type': 'bool', 'xml': {'name': 'set_archive_attribute'}},
- }
- _xml_map = {
- }
-
- def __init__(self, *, file_permission_copy_mode=None, ignore_read_only: bool=None, file_attributes: str=None, file_creation_time: str=None, file_last_write_time: str=None, set_archive_attribute: bool=None, **kwargs) -> None:
+ 'file_permission_copy_mode': {'key': 'filePermissionCopyMode', 'type': 'str'},
+ 'ignore_read_only': {'key': 'ignoreReadOnly', 'type': 'bool'},
+ 'file_attributes': {'key': 'fileAttributes', 'type': 'str'},
+ 'file_creation_time': {'key': 'fileCreationTime', 'type': 'str'},
+ 'file_last_write_time': {'key': 'fileLastWriteTime', 'type': 'str'},
+ 'set_archive_attribute': {'key': 'setArchiveAttribute', 'type': 'bool'},
+ }
+
+ def __init__(
+ self,
+ *,
+ file_permission_copy_mode: Optional[Union[str, "PermissionCopyModeType"]] = None,
+ ignore_read_only: Optional[bool] = None,
+ file_attributes: Optional[str] = None,
+ file_creation_time: Optional[str] = None,
+ file_last_write_time: Optional[str] = None,
+ set_archive_attribute: Optional[bool] = None,
+ **kwargs
+ ):
super(CopyFileSmbInfo, self).__init__(**kwargs)
self.file_permission_copy_mode = file_permission_copy_mode
self.ignore_read_only = ignore_read_only
@@ -120,34 +138,28 @@ def __init__(self, *, file_permission_copy_mode=None, ignore_read_only: bool=Non
self.set_archive_attribute = set_archive_attribute
-class CorsRule(Model):
- """CORS is an HTTP feature that enables a web application running under one
- domain to access resources in another domain. Web browsers implement a
- security restriction known as same-origin policy that prevents a web page
- from calling APIs in a different domain; CORS provides a secure way to
- allow one domain (the origin domain) to call APIs in another domain.
+class CorsRule(msrest.serialization.Model):
+ """CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain.
All required parameters must be populated in order to send to Azure.
- :param allowed_origins: Required. The origin domains that are permitted to
- make a request against the storage service via CORS. The origin domain is
- the domain from which the request originates. Note that the origin must be
- an exact case-sensitive match with the origin that the user age sends to
- the service. You can also use the wildcard character '*' to allow all
- origin domains to make requests via CORS.
+ :param allowed_origins: Required. The origin domains that are permitted to make a request
+ against the storage service via CORS. The origin domain is the domain from which the request
+ originates. Note that the origin must be an exact case-sensitive match with the origin that the
+ user age sends to the service. You can also use the wildcard character '*' to allow all origin
+ domains to make requests via CORS.
:type allowed_origins: str
- :param allowed_methods: Required. The methods (HTTP request verbs) that
- the origin domain may use for a CORS request. (comma separated)
+ :param allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may
+ use for a CORS request. (comma separated).
:type allowed_methods: str
- :param allowed_headers: Required. The request headers that the origin
- domain may specify on the CORS request.
+ :param allowed_headers: Required. The request headers that the origin domain may specify on the
+ CORS request.
:type allowed_headers: str
- :param exposed_headers: Required. The response headers that may be sent in
- the response to the CORS request and exposed by the browser to the request
- issuer.
+ :param exposed_headers: Required. The response headers that may be sent in the response to the
+ CORS request and exposed by the browser to the request issuer.
:type exposed_headers: str
- :param max_age_in_seconds: Required. The maximum amount time that a
- browser should cache the preflight OPTIONS request.
+ :param max_age_in_seconds: Required. The maximum amount time that a browser should cache the
+ preflight OPTIONS request.
:type max_age_in_seconds: int
"""
@@ -160,16 +172,23 @@ class CorsRule(Model):
}
_attribute_map = {
- 'allowed_origins': {'key': 'AllowedOrigins', 'type': 'str', 'xml': {'name': 'AllowedOrigins'}},
- 'allowed_methods': {'key': 'AllowedMethods', 'type': 'str', 'xml': {'name': 'AllowedMethods'}},
- 'allowed_headers': {'key': 'AllowedHeaders', 'type': 'str', 'xml': {'name': 'AllowedHeaders'}},
- 'exposed_headers': {'key': 'ExposedHeaders', 'type': 'str', 'xml': {'name': 'ExposedHeaders'}},
- 'max_age_in_seconds': {'key': 'MaxAgeInSeconds', 'type': 'int', 'xml': {'name': 'MaxAgeInSeconds'}},
- }
- _xml_map = {
- }
-
- def __init__(self, *, allowed_origins: str, allowed_methods: str, allowed_headers: str, exposed_headers: str, max_age_in_seconds: int, **kwargs) -> None:
+ 'allowed_origins': {'key': 'AllowedOrigins', 'type': 'str'},
+ 'allowed_methods': {'key': 'AllowedMethods', 'type': 'str'},
+ 'allowed_headers': {'key': 'AllowedHeaders', 'type': 'str'},
+ 'exposed_headers': {'key': 'ExposedHeaders', 'type': 'str'},
+ 'max_age_in_seconds': {'key': 'MaxAgeInSeconds', 'type': 'int'},
+ }
+
+ def __init__(
+ self,
+ *,
+ allowed_origins: str,
+ allowed_methods: str,
+ allowed_headers: str,
+ exposed_headers: str,
+ max_age_in_seconds: int,
+ **kwargs
+ ):
super(CorsRule, self).__init__(**kwargs)
self.allowed_origins = allowed_origins
self.allowed_methods = allowed_methods
@@ -178,7 +197,7 @@ def __init__(self, *, allowed_origins: str, allowed_methods: str, allowed_header
self.max_age_in_seconds = max_age_in_seconds
-class DirectoryItem(Model):
+class DirectoryItem(msrest.serialization.Model):
"""A listed directory item.
All required parameters must be populated in order to send to Azure.
@@ -192,52 +211,61 @@ class DirectoryItem(Model):
}
_attribute_map = {
- 'name': {'key': 'Name', 'type': 'str', 'xml': {'name': 'Name'}},
+ 'name': {'key': 'Name', 'type': 'str'},
}
_xml_map = {
'name': 'Directory'
}
- def __init__(self, *, name: str, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ name: str,
+ **kwargs
+ ):
super(DirectoryItem, self).__init__(**kwargs)
self.name = name
-class FileHTTPHeaders(Model):
- """Additional parameters for a set of operations, such as: File_create,
- File_set_http_headers.
+class FileHTTPHeaders(msrest.serialization.Model):
+ """Parameter group.
- :param file_content_type: Sets the MIME content type of the file. The
- default type is 'application/octet-stream'.
+ :param file_content_type: Sets the MIME content type of the file. The default type is
+ 'application/octet-stream'.
:type file_content_type: str
- :param file_content_encoding: Specifies which content encodings have been
- applied to the file.
+ :param file_content_encoding: Specifies which content encodings have been applied to the file.
:type file_content_encoding: str
- :param file_content_language: Specifies the natural languages used by this
- resource.
+ :param file_content_language: Specifies the natural languages used by this resource.
:type file_content_language: str
- :param file_cache_control: Sets the file's cache control. The File service
- stores this value but does not use or modify it.
+ :param file_cache_control: Sets the file's cache control. The File service stores this value
+ but does not use or modify it.
:type file_cache_control: str
:param file_content_md5: Sets the file's MD5 hash.
:type file_content_md5: bytearray
- :param file_content_disposition: Sets the file's Content-Disposition
- header.
+ :param file_content_disposition: Sets the file's Content-Disposition header.
:type file_content_disposition: str
"""
_attribute_map = {
- 'file_content_type': {'key': '', 'type': 'str', 'xml': {'name': 'file_content_type'}},
- 'file_content_encoding': {'key': '', 'type': 'str', 'xml': {'name': 'file_content_encoding'}},
- 'file_content_language': {'key': '', 'type': 'str', 'xml': {'name': 'file_content_language'}},
- 'file_cache_control': {'key': '', 'type': 'str', 'xml': {'name': 'file_cache_control'}},
- 'file_content_md5': {'key': '', 'type': 'bytearray', 'xml': {'name': 'file_content_md5'}},
- 'file_content_disposition': {'key': '', 'type': 'str', 'xml': {'name': 'file_content_disposition'}},
- }
- _xml_map = {
- }
-
- def __init__(self, *, file_content_type: str=None, file_content_encoding: str=None, file_content_language: str=None, file_cache_control: str=None, file_content_md5: bytearray=None, file_content_disposition: str=None, **kwargs) -> None:
+ 'file_content_type': {'key': 'fileContentType', 'type': 'str'},
+ 'file_content_encoding': {'key': 'fileContentEncoding', 'type': 'str'},
+ 'file_content_language': {'key': 'fileContentLanguage', 'type': 'str'},
+ 'file_cache_control': {'key': 'fileCacheControl', 'type': 'str'},
+ 'file_content_md5': {'key': 'fileContentMD5', 'type': 'bytearray'},
+ 'file_content_disposition': {'key': 'fileContentDisposition', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ *,
+ file_content_type: Optional[str] = None,
+ file_content_encoding: Optional[str] = None,
+ file_content_language: Optional[str] = None,
+ file_cache_control: Optional[str] = None,
+ file_content_md5: Optional[bytearray] = None,
+ file_content_disposition: Optional[str] = None,
+ **kwargs
+ ):
super(FileHTTPHeaders, self).__init__(**kwargs)
self.file_content_type = file_content_type
self.file_content_encoding = file_content_encoding
@@ -247,14 +275,14 @@ def __init__(self, *, file_content_type: str=None, file_content_encoding: str=No
self.file_content_disposition = file_content_disposition
-class FileItem(Model):
+class FileItem(msrest.serialization.Model):
"""A listed file item.
All required parameters must be populated in order to send to Azure.
:param name: Required.
:type name: str
- :param properties: Required.
+ :param properties: Required. File properties.
:type properties: ~azure.storage.fileshare.models.FileProperty
"""
@@ -264,29 +292,34 @@ class FileItem(Model):
}
_attribute_map = {
- 'name': {'key': 'Name', 'type': 'str', 'xml': {'name': 'Name'}},
- 'properties': {'key': 'Properties', 'type': 'FileProperty', 'xml': {'name': 'Properties'}},
+ 'name': {'key': 'Name', 'type': 'str'},
+ 'properties': {'key': 'Properties', 'type': 'FileProperty'},
}
_xml_map = {
'name': 'File'
}
- def __init__(self, *, name: str, properties, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ name: str,
+ properties: "FileProperty",
+ **kwargs
+ ):
super(FileItem, self).__init__(**kwargs)
self.name = name
self.properties = properties
-class FileProperty(Model):
+class FileProperty(msrest.serialization.Model):
"""File properties.
All required parameters must be populated in order to send to Azure.
- :param content_length: Required. Content length of the file. This value
- may not be up-to-date since an SMB client may have modified the file
- locally. The value of Content-Length may not reflect that fact until the
- handle is closed or the op-lock is broken. To retrieve current property
- values, call Get File Properties.
+ :param content_length: Required. Content length of the file. This value may not be up-to-date
+ since an SMB client may have modified the file locally. The value of Content-Length may not
+ reflect that fact until the handle is closed or the op-lock is broken. To retrieve current
+ property values, call Get File Properties.
:type content_length: long
"""
@@ -295,17 +328,20 @@ class FileProperty(Model):
}
_attribute_map = {
- 'content_length': {'key': 'Content-Length', 'type': 'long', 'xml': {'name': 'Content-Length'}},
- }
- _xml_map = {
+ 'content_length': {'key': 'Content-Length', 'type': 'long'},
}
- def __init__(self, *, content_length: int, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ content_length: int,
+ **kwargs
+ ):
super(FileProperty, self).__init__(**kwargs)
self.content_length = content_length
-class FileRange(Model):
+class FileRange(msrest.serialization.Model):
"""An Azure Storage file range.
All required parameters must be populated in order to send to Azure.
@@ -322,20 +358,26 @@ class FileRange(Model):
}
_attribute_map = {
- 'start': {'key': 'Start', 'type': 'long', 'xml': {'name': 'Start'}},
- 'end': {'key': 'End', 'type': 'long', 'xml': {'name': 'End'}},
+ 'start': {'key': 'Start', 'type': 'long'},
+ 'end': {'key': 'End', 'type': 'long'},
}
_xml_map = {
'name': 'Range'
}
- def __init__(self, *, start: int, end: int, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ start: int,
+ end: int,
+ **kwargs
+ ):
super(FileRange, self).__init__(**kwargs)
self.start = start
self.end = end
-class FilesAndDirectoriesListSegment(Model):
+class FilesAndDirectoriesListSegment(msrest.serialization.Model):
"""Abstract for entries that can be listed from Directory.
All required parameters must be populated in order to send to Azure.
@@ -352,45 +394,47 @@ class FilesAndDirectoriesListSegment(Model):
}
_attribute_map = {
- 'directory_items': {'key': 'DirectoryItems', 'type': '[DirectoryItem]', 'xml': {'name': 'DirectoryItems', 'itemsName': 'Directory'}},
- 'file_items': {'key': 'FileItems', 'type': '[FileItem]', 'xml': {'name': 'FileItems', 'itemsName': 'File'}},
+ 'directory_items': {'key': 'DirectoryItems', 'type': '[DirectoryItem]'},
+ 'file_items': {'key': 'FileItems', 'type': '[FileItem]'},
}
_xml_map = {
'name': 'Entries'
}
- def __init__(self, *, directory_items, file_items, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ directory_items: List["DirectoryItem"],
+ file_items: List["FileItem"],
+ **kwargs
+ ):
super(FilesAndDirectoriesListSegment, self).__init__(**kwargs)
self.directory_items = directory_items
self.file_items = file_items
-class HandleItem(Model):
+class HandleItem(msrest.serialization.Model):
"""A listed Azure Storage handle item.
All required parameters must be populated in order to send to Azure.
- :param handle_id: Required. XSMB service handle ID
+ :param handle_id: Required. XSMB service handle ID.
:type handle_id: str
- :param path: Required. File or directory name including full path starting
- from share root
+ :param path: Required. File or directory name including full path starting from share root.
:type path: str
- :param file_id: Required. FileId uniquely identifies the file or
- directory.
+ :param file_id: Required. FileId uniquely identifies the file or directory.
:type file_id: str
- :param parent_id: ParentId uniquely identifies the parent directory of the
- object.
+ :param parent_id: ParentId uniquely identifies the parent directory of the object.
:type parent_id: str
- :param session_id: Required. SMB session ID in context of which the file
- handle was opened
+ :param session_id: Required. SMB session ID in context of which the file handle was opened.
:type session_id: str
- :param client_ip: Required. Client IP that opened the handle
+ :param client_ip: Required. Client IP that opened the handle.
:type client_ip: str
- :param open_time: Required. Time when the session that previously opened
- the handle has last been reconnected. (UTC)
- :type open_time: datetime
- :param last_reconnect_time: Time handle was last connected to (UTC)
- :type last_reconnect_time: datetime
+ :param open_time: Required. Time when the session that previously opened the handle has last
+ been reconnected. (UTC).
+ :type open_time: ~datetime.datetime
+ :param last_reconnect_time: Time handle was last connected to (UTC).
+ :type last_reconnect_time: ~datetime.datetime
"""
_validation = {
@@ -403,20 +447,32 @@ class HandleItem(Model):
}
_attribute_map = {
- 'handle_id': {'key': 'HandleId', 'type': 'str', 'xml': {'name': 'HandleId'}},
- 'path': {'key': 'Path', 'type': 'str', 'xml': {'name': 'Path'}},
- 'file_id': {'key': 'FileId', 'type': 'str', 'xml': {'name': 'FileId'}},
- 'parent_id': {'key': 'ParentId', 'type': 'str', 'xml': {'name': 'ParentId'}},
- 'session_id': {'key': 'SessionId', 'type': 'str', 'xml': {'name': 'SessionId'}},
- 'client_ip': {'key': 'ClientIp', 'type': 'str', 'xml': {'name': 'ClientIp'}},
- 'open_time': {'key': 'OpenTime', 'type': 'rfc-1123', 'xml': {'name': 'OpenTime'}},
- 'last_reconnect_time': {'key': 'LastReconnectTime', 'type': 'rfc-1123', 'xml': {'name': 'LastReconnectTime'}},
+ 'handle_id': {'key': 'HandleId', 'type': 'str'},
+ 'path': {'key': 'Path', 'type': 'str'},
+ 'file_id': {'key': 'FileId', 'type': 'str'},
+ 'parent_id': {'key': 'ParentId', 'type': 'str'},
+ 'session_id': {'key': 'SessionId', 'type': 'str'},
+ 'client_ip': {'key': 'ClientIp', 'type': 'str'},
+ 'open_time': {'key': 'OpenTime', 'type': 'rfc-1123'},
+ 'last_reconnect_time': {'key': 'LastReconnectTime', 'type': 'rfc-1123'},
}
_xml_map = {
'name': 'Handle'
}
- def __init__(self, *, handle_id: str, path: str, file_id: str, session_id: str, client_ip: str, open_time, parent_id: str=None, last_reconnect_time=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ handle_id: str,
+ path: str,
+ file_id: str,
+ session_id: str,
+ client_ip: str,
+ open_time: datetime.datetime,
+ parent_id: Optional[str] = None,
+ last_reconnect_time: Optional[datetime.datetime] = None,
+ **kwargs
+ ):
super(HandleItem, self).__init__(**kwargs)
self.handle_id = handle_id
self.path = path
@@ -428,26 +484,29 @@ def __init__(self, *, handle_id: str, path: str, file_id: str, session_id: str,
self.last_reconnect_time = last_reconnect_time
-class LeaseAccessConditions(Model):
- """Additional parameters for a set of operations.
+class LeaseAccessConditions(msrest.serialization.Model):
+ """Parameter group.
- :param lease_id: If specified, the operation only succeeds if the
- resource's lease is active and matches this ID.
+ :param lease_id: If specified, the operation only succeeds if the resource's lease is active
+ and matches this ID.
:type lease_id: str
"""
_attribute_map = {
- 'lease_id': {'key': '', 'type': 'str', 'xml': {'name': 'lease_id'}},
- }
- _xml_map = {
+ 'lease_id': {'key': 'leaseId', 'type': 'str'},
}
- def __init__(self, *, lease_id: str=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ lease_id: Optional[str] = None,
+ **kwargs
+ ):
super(LeaseAccessConditions, self).__init__(**kwargs)
self.lease_id = lease_id
-class ListFilesAndDirectoriesSegmentResponse(Model):
+class ListFilesAndDirectoriesSegmentResponse(msrest.serialization.Model):
"""An enumeration of directories and files.
All required parameters must be populated in order to send to Azure.
@@ -466,9 +525,8 @@ class ListFilesAndDirectoriesSegmentResponse(Model):
:type marker: str
:param max_results:
:type max_results: int
- :param segment: Required.
- :type segment:
- ~azure.storage.fileshare.models.FilesAndDirectoriesListSegment
+ :param segment: Required. Abstract for entries that can be listed from Directory.
+ :type segment: ~azure.storage.fileshare.models.FilesAndDirectoriesListSegment
:param next_marker: Required.
:type next_marker: str
"""
@@ -483,21 +541,34 @@ class ListFilesAndDirectoriesSegmentResponse(Model):
}
_attribute_map = {
- 'service_endpoint': {'key': 'ServiceEndpoint', 'type': 'str', 'xml': {'name': 'ServiceEndpoint', 'attr': True}},
- 'share_name': {'key': 'ShareName', 'type': 'str', 'xml': {'name': 'ShareName', 'attr': True}},
- 'share_snapshot': {'key': 'ShareSnapshot', 'type': 'str', 'xml': {'name': 'ShareSnapshot', 'attr': True}},
- 'directory_path': {'key': 'DirectoryPath', 'type': 'str', 'xml': {'name': 'DirectoryPath', 'attr': True}},
- 'prefix': {'key': 'Prefix', 'type': 'str', 'xml': {'name': 'Prefix'}},
- 'marker': {'key': 'Marker', 'type': 'str', 'xml': {'name': 'Marker'}},
- 'max_results': {'key': 'MaxResults', 'type': 'int', 'xml': {'name': 'MaxResults'}},
- 'segment': {'key': 'Segment', 'type': 'FilesAndDirectoriesListSegment', 'xml': {'name': 'Segment'}},
- 'next_marker': {'key': 'NextMarker', 'type': 'str', 'xml': {'name': 'NextMarker'}},
+ 'service_endpoint': {'key': 'ServiceEndpoint', 'type': 'str', 'xml': {'attr': True}},
+ 'share_name': {'key': 'ShareName', 'type': 'str', 'xml': {'attr': True}},
+ 'share_snapshot': {'key': 'ShareSnapshot', 'type': 'str', 'xml': {'attr': True}},
+ 'directory_path': {'key': 'DirectoryPath', 'type': 'str', 'xml': {'attr': True}},
+ 'prefix': {'key': 'Prefix', 'type': 'str'},
+ 'marker': {'key': 'Marker', 'type': 'str'},
+ 'max_results': {'key': 'MaxResults', 'type': 'int'},
+ 'segment': {'key': 'Segment', 'type': 'FilesAndDirectoriesListSegment'},
+ 'next_marker': {'key': 'NextMarker', 'type': 'str'},
}
_xml_map = {
'name': 'EnumerationResults'
}
- def __init__(self, *, service_endpoint: str, share_name: str, directory_path: str, prefix: str, segment, next_marker: str, share_snapshot: str=None, marker: str=None, max_results: int=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ service_endpoint: str,
+ share_name: str,
+ directory_path: str,
+ prefix: str,
+ segment: "FilesAndDirectoriesListSegment",
+ next_marker: str,
+ share_snapshot: Optional[str] = None,
+ marker: Optional[str] = None,
+ max_results: Optional[int] = None,
+ **kwargs
+ ):
super(ListFilesAndDirectoriesSegmentResponse, self).__init__(**kwargs)
self.service_endpoint = service_endpoint
self.share_name = share_name
@@ -510,7 +581,7 @@ def __init__(self, *, service_endpoint: str, share_name: str, directory_path: st
self.next_marker = next_marker
-class ListHandlesResponse(Model):
+class ListHandlesResponse(msrest.serialization.Model):
"""An enumeration of handles.
All required parameters must be populated in order to send to Azure.
@@ -526,20 +597,26 @@ class ListHandlesResponse(Model):
}
_attribute_map = {
- 'handle_list': {'key': 'HandleList', 'type': '[HandleItem]', 'xml': {'name': 'Entries', 'itemsName': 'Entries', 'wrapped': True}},
- 'next_marker': {'key': 'NextMarker', 'type': 'str', 'xml': {'name': 'NextMarker'}},
+ 'handle_list': {'key': 'HandleList', 'type': '[HandleItem]', 'xml': {'name': 'Entries', 'wrapped': True, 'itemsName': 'Handle'}},
+ 'next_marker': {'key': 'NextMarker', 'type': 'str'},
}
_xml_map = {
'name': 'EnumerationResults'
}
- def __init__(self, *, next_marker: str, handle_list=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ next_marker: str,
+ handle_list: Optional[List["HandleItem"]] = None,
+ **kwargs
+ ):
super(ListHandlesResponse, self).__init__(**kwargs)
self.handle_list = handle_list
self.next_marker = next_marker
-class ListSharesResponse(Model):
+class ListSharesResponse(msrest.serialization.Model):
"""An enumeration of shares.
All required parameters must be populated in order to send to Azure.
@@ -564,18 +641,28 @@ class ListSharesResponse(Model):
}
_attribute_map = {
- 'service_endpoint': {'key': 'ServiceEndpoint', 'type': 'str', 'xml': {'name': 'ServiceEndpoint', 'attr': True}},
- 'prefix': {'key': 'Prefix', 'type': 'str', 'xml': {'name': 'Prefix'}},
- 'marker': {'key': 'Marker', 'type': 'str', 'xml': {'name': 'Marker'}},
- 'max_results': {'key': 'MaxResults', 'type': 'int', 'xml': {'name': 'MaxResults'}},
- 'share_items': {'key': 'ShareItems', 'type': '[ShareItemInternal]', 'xml': {'name': 'Shares', 'itemsName': 'Shares', 'wrapped': True}},
- 'next_marker': {'key': 'NextMarker', 'type': 'str', 'xml': {'name': 'NextMarker'}},
+ 'service_endpoint': {'key': 'ServiceEndpoint', 'type': 'str', 'xml': {'attr': True}},
+ 'prefix': {'key': 'Prefix', 'type': 'str'},
+ 'marker': {'key': 'Marker', 'type': 'str'},
+ 'max_results': {'key': 'MaxResults', 'type': 'int'},
+ 'share_items': {'key': 'ShareItems', 'type': '[ShareItemInternal]', 'xml': {'name': 'Shares', 'wrapped': True, 'itemsName': 'Share'}},
+ 'next_marker': {'key': 'NextMarker', 'type': 'str'},
}
_xml_map = {
'name': 'EnumerationResults'
}
- def __init__(self, *, service_endpoint: str, next_marker: str, prefix: str=None, marker: str=None, max_results: int=None, share_items=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ service_endpoint: str,
+ next_marker: str,
+ prefix: Optional[str] = None,
+ marker: Optional[str] = None,
+ max_results: Optional[int] = None,
+ share_items: Optional[List["ShareItemInternal"]] = None,
+ **kwargs
+ ):
super(ListSharesResponse, self).__init__(**kwargs)
self.service_endpoint = service_endpoint
self.prefix = prefix
@@ -585,20 +672,19 @@ def __init__(self, *, service_endpoint: str, next_marker: str, prefix: str=None,
self.next_marker = next_marker
-class Metrics(Model):
+class Metrics(msrest.serialization.Model):
"""Storage Analytics metrics for file service.
All required parameters must be populated in order to send to Azure.
:param version: Required. The version of Storage Analytics to configure.
:type version: str
- :param enabled: Required. Indicates whether metrics are enabled for the
- File service.
+ :param enabled: Required. Indicates whether metrics are enabled for the File service.
:type enabled: bool
- :param include_apis: Indicates whether metrics should generate summary
- statistics for called API operations.
+ :param include_apis: Indicates whether metrics should generate summary statistics for called
+ API operations.
:type include_apis: bool
- :param retention_policy:
+ :param retention_policy: The retention policy.
:type retention_policy: ~azure.storage.fileshare.models.RetentionPolicy
"""
@@ -608,15 +694,21 @@ class Metrics(Model):
}
_attribute_map = {
- 'version': {'key': 'Version', 'type': 'str', 'xml': {'name': 'Version'}},
- 'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}},
- 'include_apis': {'key': 'IncludeAPIs', 'type': 'bool', 'xml': {'name': 'IncludeAPIs'}},
- 'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy', 'xml': {'name': 'RetentionPolicy'}},
- }
- _xml_map = {
- }
-
- def __init__(self, *, version: str, enabled: bool, include_apis: bool=None, retention_policy=None, **kwargs) -> None:
+ 'version': {'key': 'Version', 'type': 'str'},
+ 'enabled': {'key': 'Enabled', 'type': 'bool'},
+ 'include_apis': {'key': 'IncludeAPIs', 'type': 'bool'},
+ 'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy'},
+ }
+
+ def __init__(
+ self,
+ *,
+ version: str,
+ enabled: bool,
+ include_apis: Optional[bool] = None,
+ retention_policy: Optional["RetentionPolicy"] = None,
+ **kwargs
+ ):
super(Metrics, self).__init__(**kwargs)
self.version = version
self.enabled = enabled
@@ -624,18 +716,17 @@ def __init__(self, *, version: str, enabled: bool, include_apis: bool=None, rete
self.retention_policy = retention_policy
-class RetentionPolicy(Model):
+class RetentionPolicy(msrest.serialization.Model):
"""The retention policy.
All required parameters must be populated in order to send to Azure.
- :param enabled: Required. Indicates whether a retention policy is enabled
- for the File service. If false, metrics data is retained, and the user is
- responsible for deleting it.
+ :param enabled: Required. Indicates whether a retention policy is enabled for the File service.
+ If false, metrics data is retained, and the user is responsible for deleting it.
:type enabled: bool
- :param days: Indicates the number of days that metrics data should be
- retained. All data older than this value will be deleted. Metrics data is
- deleted on a best-effort basis after the retention period expires.
+ :param days: Indicates the number of days that metrics data should be retained. All data older
+ than this value will be deleted. Metrics data is deleted on a best-effort basis after the
+ retention period expires.
:type days: int
"""
@@ -645,19 +736,23 @@ class RetentionPolicy(Model):
}
_attribute_map = {
- 'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}},
- 'days': {'key': 'Days', 'type': 'int', 'xml': {'name': 'Days'}},
- }
- _xml_map = {
+ 'enabled': {'key': 'Enabled', 'type': 'bool'},
+ 'days': {'key': 'Days', 'type': 'int'},
}
- def __init__(self, *, enabled: bool, days: int=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ enabled: bool,
+ days: Optional[int] = None,
+ **kwargs
+ ):
super(RetentionPolicy, self).__init__(**kwargs)
self.enabled = enabled
self.days = days
-class ShareFileRangeList(Model):
+class ShareFileRangeList(msrest.serialization.Model):
"""The list of file ranges.
:param ranges:
@@ -667,19 +762,23 @@ class ShareFileRangeList(Model):
"""
_attribute_map = {
- 'ranges': {'key': 'Ranges', 'type': '[FileRange]', 'xml': {'name': 'Ranges', 'itemsName': 'Range'}},
- 'clear_ranges': {'key': 'ClearRanges', 'type': '[ClearRange]', 'xml': {'name': 'ClearRanges', 'itemsName': 'ClearRange'}},
- }
- _xml_map = {
+ 'ranges': {'key': 'Ranges', 'type': '[FileRange]'},
+ 'clear_ranges': {'key': 'ClearRanges', 'type': '[ClearRange]'},
}
- def __init__(self, *, ranges=None, clear_ranges=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ ranges: Optional[List["FileRange"]] = None,
+ clear_ranges: Optional[List["ClearRange"]] = None,
+ **kwargs
+ ):
super(ShareFileRangeList, self).__init__(**kwargs)
self.ranges = ranges
self.clear_ranges = clear_ranges
-class ShareItemInternal(Model):
+class ShareItemInternal(msrest.serialization.Model):
"""A listed Azure Storage share item.
All required parameters must be populated in order to send to Azure.
@@ -692,9 +791,9 @@ class ShareItemInternal(Model):
:type deleted: bool
:param version:
:type version: str
- :param properties: Required.
+ :param properties: Required. Properties of a share.
:type properties: ~azure.storage.fileshare.models.SharePropertiesInternal
- :param metadata:
+ :param metadata: Dictionary of :code:``.
:type metadata: dict[str, str]
"""
@@ -704,18 +803,28 @@ class ShareItemInternal(Model):
}
_attribute_map = {
- 'name': {'key': 'Name', 'type': 'str', 'xml': {'name': 'Name'}},
- 'snapshot': {'key': 'Snapshot', 'type': 'str', 'xml': {'name': 'Snapshot'}},
- 'deleted': {'key': 'Deleted', 'type': 'bool', 'xml': {'name': 'Deleted'}},
- 'version': {'key': 'Version', 'type': 'str', 'xml': {'name': 'Version'}},
- 'properties': {'key': 'Properties', 'type': 'SharePropertiesInternal', 'xml': {'name': 'Properties'}},
- 'metadata': {'key': 'Metadata', 'type': '{str}', 'xml': {'name': 'Metadata'}},
+ 'name': {'key': 'Name', 'type': 'str'},
+ 'snapshot': {'key': 'Snapshot', 'type': 'str'},
+ 'deleted': {'key': 'Deleted', 'type': 'bool'},
+ 'version': {'key': 'Version', 'type': 'str'},
+ 'properties': {'key': 'Properties', 'type': 'SharePropertiesInternal'},
+ 'metadata': {'key': 'Metadata', 'type': '{str}'},
}
_xml_map = {
'name': 'Share'
}
- def __init__(self, *, name: str, properties, snapshot: str=None, deleted: bool=None, version: str=None, metadata=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ name: str,
+ properties: "SharePropertiesInternal",
+ snapshot: Optional[str] = None,
+ deleted: Optional[bool] = None,
+ version: Optional[str] = None,
+ metadata: Optional[Dict[str, str]] = None,
+ **kwargs
+ ):
super(ShareItemInternal, self).__init__(**kwargs)
self.name = name
self.snapshot = snapshot
@@ -725,13 +834,13 @@ def __init__(self, *, name: str, properties, snapshot: str=None, deleted: bool=N
self.metadata = metadata
-class SharePermission(Model):
+class SharePermission(msrest.serialization.Model):
"""A permission (a security descriptor) at the share level.
All required parameters must be populated in order to send to Azure.
- :param permission: Required. The permission in the Security Descriptor
- Definition Language (SDDL).
+ :param permission: Required. The permission in the Security Descriptor Definition Language
+ (SDDL).
:type permission: str
"""
@@ -740,57 +849,60 @@ class SharePermission(Model):
}
_attribute_map = {
- 'permission': {'key': 'permission', 'type': 'str', 'xml': {'name': 'permission'}},
- }
- _xml_map = {
+ 'permission': {'key': 'permission', 'type': 'str'},
}
- def __init__(self, *, permission: str, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ permission: str,
+ **kwargs
+ ):
super(SharePermission, self).__init__(**kwargs)
self.permission = permission
-class SharePropertiesInternal(Model):
+class SharePropertiesInternal(msrest.serialization.Model):
"""Properties of a share.
All required parameters must be populated in order to send to Azure.
:param last_modified: Required.
- :type last_modified: datetime
+ :type last_modified: ~datetime.datetime
:param etag: Required.
:type etag: str
:param quota: Required.
:type quota: int
:param provisioned_iops:
:type provisioned_iops: int
- :param provisioned_ingress_mbps:
- :type provisioned_ingress_mbps: int
- :param provisioned_egress_mbps:
- :type provisioned_egress_mbps: int
+ :param provisioned_ingress_m_bps:
+ :type provisioned_ingress_m_bps: int
+ :param provisioned_egress_m_bps:
+ :type provisioned_egress_m_bps: int
:param next_allowed_quota_downgrade_time:
- :type next_allowed_quota_downgrade_time: datetime
+ :type next_allowed_quota_downgrade_time: ~datetime.datetime
:param deleted_time:
- :type deleted_time: datetime
+ :type deleted_time: ~datetime.datetime
:param remaining_retention_days:
:type remaining_retention_days: int
:param access_tier:
:type access_tier: str
:param access_tier_change_time:
- :type access_tier_change_time: datetime
+ :type access_tier_change_time: ~datetime.datetime
:param access_tier_transition_state:
:type access_tier_transition_state: str
- :param lease_status: Possible values include: 'locked', 'unlocked'
+ :param lease_status: The current lease status of the share. Possible values include: "locked",
+ "unlocked".
:type lease_status: str or ~azure.storage.fileshare.models.LeaseStatusType
- :param lease_state: Possible values include: 'available', 'leased',
- 'expired', 'breaking', 'broken'
+ :param lease_state: Lease state of the share. Possible values include: "available", "leased",
+ "expired", "breaking", "broken".
:type lease_state: str or ~azure.storage.fileshare.models.LeaseStateType
- :param lease_duration: Possible values include: 'infinite', 'fixed'
- :type lease_duration: str or
- ~azure.storage.fileshare.models.LeaseDurationType
+ :param lease_duration: When a share is leased, specifies whether the lease is of infinite or
+ fixed duration. Possible values include: "infinite", "fixed".
+ :type lease_duration: str or ~azure.storage.fileshare.models.LeaseDurationType
:param enabled_protocols:
:type enabled_protocols: str
- :param root_squash: Possible values include: 'NoRootSquash', 'RootSquash',
- 'AllSquash'
+ :param root_squash: Possible values include: "NoRootSquash", "RootSquash", "AllSquash".
:type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash
"""
@@ -801,35 +913,54 @@ class SharePropertiesInternal(Model):
}
_attribute_map = {
- 'last_modified': {'key': 'Last-Modified', 'type': 'rfc-1123', 'xml': {'name': 'Last-Modified'}},
- 'etag': {'key': 'Etag', 'type': 'str', 'xml': {'name': 'Etag'}},
- 'quota': {'key': 'Quota', 'type': 'int', 'xml': {'name': 'Quota'}},
- 'provisioned_iops': {'key': 'ProvisionedIops', 'type': 'int', 'xml': {'name': 'ProvisionedIops'}},
- 'provisioned_ingress_mbps': {'key': 'ProvisionedIngressMBps', 'type': 'int', 'xml': {'name': 'ProvisionedIngressMBps'}},
- 'provisioned_egress_mbps': {'key': 'ProvisionedEgressMBps', 'type': 'int', 'xml': {'name': 'ProvisionedEgressMBps'}},
- 'next_allowed_quota_downgrade_time': {'key': 'NextAllowedQuotaDowngradeTime', 'type': 'rfc-1123', 'xml': {'name': 'NextAllowedQuotaDowngradeTime'}},
- 'deleted_time': {'key': 'DeletedTime', 'type': 'rfc-1123', 'xml': {'name': 'DeletedTime'}},
- 'remaining_retention_days': {'key': 'RemainingRetentionDays', 'type': 'int', 'xml': {'name': 'RemainingRetentionDays'}},
- 'access_tier': {'key': 'AccessTier', 'type': 'str', 'xml': {'name': 'AccessTier'}},
- 'access_tier_change_time': {'key': 'AccessTierChangeTime', 'type': 'rfc-1123', 'xml': {'name': 'AccessTierChangeTime'}},
- 'access_tier_transition_state': {'key': 'AccessTierTransitionState', 'type': 'str', 'xml': {'name': 'AccessTierTransitionState'}},
- 'lease_status': {'key': 'LeaseStatus', 'type': 'LeaseStatusType', 'xml': {'name': 'LeaseStatus'}},
- 'lease_state': {'key': 'LeaseState', 'type': 'LeaseStateType', 'xml': {'name': 'LeaseState'}},
- 'lease_duration': {'key': 'LeaseDuration', 'type': 'LeaseDurationType', 'xml': {'name': 'LeaseDuration'}},
- 'enabled_protocols': {'key': 'EnabledProtocols', 'type': 'str', 'xml': {'name': 'EnabledProtocols'}},
- 'root_squash': {'key': 'RootSquash', 'type': 'ShareRootSquash', 'xml': {'name': 'RootSquash'}},
- }
- _xml_map = {
- }
-
- def __init__(self, *, last_modified, etag: str, quota: int, provisioned_iops: int=None, provisioned_ingress_mbps: int=None, provisioned_egress_mbps: int=None, next_allowed_quota_downgrade_time=None, deleted_time=None, remaining_retention_days: int=None, access_tier: str=None, access_tier_change_time=None, access_tier_transition_state: str=None, lease_status=None, lease_state=None, lease_duration=None, enabled_protocols: str=None, root_squash=None, **kwargs) -> None:
+ 'last_modified': {'key': 'Last-Modified', 'type': 'rfc-1123'},
+ 'etag': {'key': 'Etag', 'type': 'str'},
+ 'quota': {'key': 'Quota', 'type': 'int'},
+ 'provisioned_iops': {'key': 'ProvisionedIops', 'type': 'int'},
+ 'provisioned_ingress_m_bps': {'key': 'ProvisionedIngressMBps', 'type': 'int'},
+ 'provisioned_egress_m_bps': {'key': 'ProvisionedEgressMBps', 'type': 'int'},
+ 'next_allowed_quota_downgrade_time': {'key': 'NextAllowedQuotaDowngradeTime', 'type': 'rfc-1123'},
+ 'deleted_time': {'key': 'DeletedTime', 'type': 'rfc-1123'},
+ 'remaining_retention_days': {'key': 'RemainingRetentionDays', 'type': 'int'},
+ 'access_tier': {'key': 'AccessTier', 'type': 'str'},
+ 'access_tier_change_time': {'key': 'AccessTierChangeTime', 'type': 'rfc-1123'},
+ 'access_tier_transition_state': {'key': 'AccessTierTransitionState', 'type': 'str'},
+ 'lease_status': {'key': 'LeaseStatus', 'type': 'str'},
+ 'lease_state': {'key': 'LeaseState', 'type': 'str'},
+ 'lease_duration': {'key': 'LeaseDuration', 'type': 'str'},
+ 'enabled_protocols': {'key': 'EnabledProtocols', 'type': 'str'},
+ 'root_squash': {'key': 'RootSquash', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ *,
+ last_modified: datetime.datetime,
+ etag: str,
+ quota: int,
+ provisioned_iops: Optional[int] = None,
+ provisioned_ingress_m_bps: Optional[int] = None,
+ provisioned_egress_m_bps: Optional[int] = None,
+ next_allowed_quota_downgrade_time: Optional[datetime.datetime] = None,
+ deleted_time: Optional[datetime.datetime] = None,
+ remaining_retention_days: Optional[int] = None,
+ access_tier: Optional[str] = None,
+ access_tier_change_time: Optional[datetime.datetime] = None,
+ access_tier_transition_state: Optional[str] = None,
+ lease_status: Optional[Union[str, "LeaseStatusType"]] = None,
+ lease_state: Optional[Union[str, "LeaseStateType"]] = None,
+ lease_duration: Optional[Union[str, "LeaseDurationType"]] = None,
+ enabled_protocols: Optional[str] = None,
+ root_squash: Optional[Union[str, "ShareRootSquash"]] = None,
+ **kwargs
+ ):
super(SharePropertiesInternal, self).__init__(**kwargs)
self.last_modified = last_modified
self.etag = etag
self.quota = quota
self.provisioned_iops = provisioned_iops
- self.provisioned_ingress_mbps = provisioned_ingress_mbps
- self.provisioned_egress_mbps = provisioned_egress_mbps
+ self.provisioned_ingress_m_bps = provisioned_ingress_m_bps
+ self.provisioned_egress_m_bps = provisioned_egress_m_bps
self.next_allowed_quota_downgrade_time = next_allowed_quota_downgrade_time
self.deleted_time = deleted_time
self.remaining_retention_days = remaining_retention_days
@@ -843,7 +974,7 @@ def __init__(self, *, last_modified, etag: str, quota: int, provisioned_iops: in
self.root_squash = root_squash
-class ShareProtocolSettings(Model):
+class ShareProtocolSettings(msrest.serialization.Model):
"""Protocol settings.
:param smb: Settings for SMB protocol.
@@ -853,15 +984,18 @@ class ShareProtocolSettings(Model):
_attribute_map = {
'smb': {'key': 'Smb', 'type': 'ShareSmbSettings', 'xml': {'name': 'SMB'}},
}
- _xml_map = {
- }
- def __init__(self, *, smb=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ smb: Optional["ShareSmbSettings"] = None,
+ **kwargs
+ ):
super(ShareProtocolSettings, self).__init__(**kwargs)
self.smb = smb
-class ShareSmbSettings(Model):
+class ShareSmbSettings(msrest.serialization.Model):
"""Settings for SMB protocol.
:param multichannel: Settings for SMB Multichannel.
@@ -869,24 +1003,26 @@ class ShareSmbSettings(Model):
"""
_attribute_map = {
- 'multichannel': {'key': 'Multichannel', 'type': 'SmbMultichannel', 'xml': {'name': 'Multichannel'}},
- }
- _xml_map = {
+ 'multichannel': {'key': 'Multichannel', 'type': 'SmbMultichannel'},
}
- def __init__(self, *, multichannel=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ multichannel: Optional["SmbMultichannel"] = None,
+ **kwargs
+ ):
super(ShareSmbSettings, self).__init__(**kwargs)
self.multichannel = multichannel
-class ShareStats(Model):
+class ShareStats(msrest.serialization.Model):
"""Stats for the share.
All required parameters must be populated in order to send to Azure.
- :param share_usage_bytes: Required. The approximate size of the data
- stored in bytes. Note that this value may not include all recently created
- or recently resized files.
+ :param share_usage_bytes: Required. The approximate size of the data stored in bytes. Note that
+ this value may not include all recently created or recently resized files.
:type share_usage_bytes: int
"""
@@ -895,17 +1031,20 @@ class ShareStats(Model):
}
_attribute_map = {
- 'share_usage_bytes': {'key': 'ShareUsageBytes', 'type': 'int', 'xml': {'name': 'ShareUsageBytes'}},
- }
- _xml_map = {
+ 'share_usage_bytes': {'key': 'ShareUsageBytes', 'type': 'int'},
}
- def __init__(self, *, share_usage_bytes: int, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ share_usage_bytes: int,
+ **kwargs
+ ):
super(ShareStats, self).__init__(**kwargs)
self.share_usage_bytes = share_usage_bytes
-class SignedIdentifier(Model):
+class SignedIdentifier(msrest.serialization.Model):
"""Signed identifier.
All required parameters must be populated in order to send to Azure.
@@ -921,19 +1060,23 @@ class SignedIdentifier(Model):
}
_attribute_map = {
- 'id': {'key': 'Id', 'type': 'str', 'xml': {'name': 'Id'}},
- 'access_policy': {'key': 'AccessPolicy', 'type': 'AccessPolicy', 'xml': {'name': 'AccessPolicy'}},
- }
- _xml_map = {
+ 'id': {'key': 'Id', 'type': 'str'},
+ 'access_policy': {'key': 'AccessPolicy', 'type': 'AccessPolicy'},
}
- def __init__(self, *, id: str, access_policy=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ id: str,
+ access_policy: Optional["AccessPolicy"] = None,
+ **kwargs
+ ):
super(SignedIdentifier, self).__init__(**kwargs)
self.id = id
self.access_policy = access_policy
-class SmbMultichannel(Model):
+class SmbMultichannel(msrest.serialization.Model):
"""Settings for SMB multichannel.
:param enabled: If SMB multichannel is enabled.
@@ -941,42 +1084,51 @@ class SmbMultichannel(Model):
"""
_attribute_map = {
- 'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}},
+ 'enabled': {'key': 'Enabled', 'type': 'bool'},
}
_xml_map = {
'name': 'Multichannel'
}
- def __init__(self, *, enabled: bool=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ enabled: Optional[bool] = None,
+ **kwargs
+ ):
super(SmbMultichannel, self).__init__(**kwargs)
self.enabled = enabled
-class SourceModifiedAccessConditions(Model):
- """Additional parameters for upload_range_from_url operation.
+class SourceModifiedAccessConditions(msrest.serialization.Model):
+ """Parameter group.
- :param source_if_match_crc64: Specify the crc64 value to operate only on
- range with a matching crc64 checksum.
+ :param source_if_match_crc64: Specify the crc64 value to operate only on range with a matching
+ crc64 checksum.
:type source_if_match_crc64: bytearray
- :param source_if_none_match_crc64: Specify the crc64 value to operate only
- on range without a matching crc64 checksum.
+ :param source_if_none_match_crc64: Specify the crc64 value to operate only on range without a
+ matching crc64 checksum.
:type source_if_none_match_crc64: bytearray
"""
_attribute_map = {
- 'source_if_match_crc64': {'key': '', 'type': 'bytearray', 'xml': {'name': 'source_if_match_crc64'}},
- 'source_if_none_match_crc64': {'key': '', 'type': 'bytearray', 'xml': {'name': 'source_if_none_match_crc64'}},
- }
- _xml_map = {
+ 'source_if_match_crc64': {'key': 'sourceIfMatchCrc64', 'type': 'bytearray'},
+ 'source_if_none_match_crc64': {'key': 'sourceIfNoneMatchCrc64', 'type': 'bytearray'},
}
- def __init__(self, *, source_if_match_crc64: bytearray=None, source_if_none_match_crc64: bytearray=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ source_if_match_crc64: Optional[bytearray] = None,
+ source_if_none_match_crc64: Optional[bytearray] = None,
+ **kwargs
+ ):
super(SourceModifiedAccessConditions, self).__init__(**kwargs)
self.source_if_match_crc64 = source_if_match_crc64
self.source_if_none_match_crc64 = source_if_none_match_crc64
-class StorageError(Model):
+class StorageError(msrest.serialization.Model):
"""StorageError.
:param message:
@@ -984,57 +1136,50 @@ class StorageError(Model):
"""
_attribute_map = {
- 'message': {'key': 'Message', 'type': 'str', 'xml': {'name': 'Message'}},
- }
- _xml_map = {
+ 'message': {'key': 'Message', 'type': 'str'},
}
- def __init__(self, *, message: str=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ message: Optional[str] = None,
+ **kwargs
+ ):
super(StorageError, self).__init__(**kwargs)
self.message = message
-class StorageErrorException(HttpResponseError):
- """Server responsed with exception of type: 'StorageError'.
-
- :param deserialize: A deserializer
- :param response: Server response to be deserialized.
- """
-
- def __init__(self, response, deserialize, *args):
-
- model_name = 'StorageError'
- self.error = deserialize(model_name, response)
- if self.error is None:
- self.error = deserialize.dependencies[model_name]()
- super(StorageErrorException, self).__init__(response=response)
-
-
-class StorageServiceProperties(Model):
+class StorageServiceProperties(msrest.serialization.Model):
"""Storage service properties.
- :param hour_metrics: A summary of request statistics grouped by API in
- hourly aggregates for files.
+ :param hour_metrics: A summary of request statistics grouped by API in hourly aggregates for
+ files.
:type hour_metrics: ~azure.storage.fileshare.models.Metrics
- :param minute_metrics: A summary of request statistics grouped by API in
- minute aggregates for files.
+ :param minute_metrics: A summary of request statistics grouped by API in minute aggregates for
+ files.
:type minute_metrics: ~azure.storage.fileshare.models.Metrics
:param cors: The set of CORS rules.
:type cors: list[~azure.storage.fileshare.models.CorsRule]
- :param protocol: Protocol settings
+ :param protocol: Protocol settings.
:type protocol: ~azure.storage.fileshare.models.ShareProtocolSettings
"""
_attribute_map = {
- 'hour_metrics': {'key': 'HourMetrics', 'type': 'Metrics', 'xml': {'name': 'HourMetrics'}},
- 'minute_metrics': {'key': 'MinuteMetrics', 'type': 'Metrics', 'xml': {'name': 'MinuteMetrics'}},
- 'cors': {'key': 'Cors', 'type': '[CorsRule]', 'xml': {'name': 'Cors', 'itemsName': 'CorsRule', 'wrapped': True}},
+ 'hour_metrics': {'key': 'HourMetrics', 'type': 'Metrics'},
+ 'minute_metrics': {'key': 'MinuteMetrics', 'type': 'Metrics'},
+ 'cors': {'key': 'Cors', 'type': '[CorsRule]', 'xml': {'wrapped': True}},
'protocol': {'key': 'Protocol', 'type': 'ShareProtocolSettings', 'xml': {'name': 'ProtocolSettings'}},
}
- _xml_map = {
- }
- def __init__(self, *, hour_metrics=None, minute_metrics=None, cors=None, protocol=None, **kwargs) -> None:
+ def __init__(
+ self,
+ *,
+ hour_metrics: Optional["Metrics"] = None,
+ minute_metrics: Optional["Metrics"] = None,
+ cors: Optional[List["CorsRule"]] = None,
+ protocol: Optional["ShareProtocolSettings"] = None,
+ **kwargs
+ ):
super(StorageServiceProperties, self).__init__(**kwargs)
self.hour_metrics = hour_metrics
self.minute_metrics = minute_metrics
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/__init__.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/__init__.py
index 65680c942feb..ba8fb22157f4 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/__init__.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/__init__.py
@@ -1,12 +1,9 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from ._service_operations import ServiceOperations
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py
index c38bc8d2fe2e..20dd7c04c3c4 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py
@@ -1,97 +1,113 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from typing import TYPE_CHECKING
+import warnings
-from azure.core.exceptions import map_error
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import HttpRequest, HttpResponse
-from .. import models
+from .. import models as _models
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any, Callable, Dict, Generic, Optional, TypeVar
+
+ T = TypeVar('T')
+ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
class DirectoryOperations(object):
"""DirectoryOperations operations.
- You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~azure.storage.fileshare.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
- :ivar restype: . Constant value: "directory".
"""
- models = models
+ models = _models
def __init__(self, client, config, serializer, deserializer):
-
self._client = client
self._serialize = serializer
self._deserialize = deserializer
-
self._config = config
- self.restype = "directory"
- def create(self, file_attributes="none", file_creation_time="now", file_last_write_time="now", timeout=None, metadata=None, file_permission="inherit", file_permission_key=None, cls=None, **kwargs):
+ def create(
+ self,
+ timeout=None, # type: Optional[int]
+ metadata=None, # type: Optional[str]
+ file_permission="inherit", # type: Optional[str]
+ file_permission_key=None, # type: Optional[str]
+ file_attributes="none", # type: str
+ file_creation_time="now", # type: str
+ file_last_write_time="now", # type: str
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""Creates a new directory under the specified share or parent directory.
- :param file_attributes: If specified, the provided file attributes
- shall be set. Default value: ‘Archive’ for file and ‘Directory’ for
- directory. ‘None’ can also be specified as default.
- :type file_attributes: str
- :param file_creation_time: Creation time for the file/directory.
- Default value: Now.
- :type file_creation_time: str
- :param file_last_write_time: Last write time for the file/directory.
- Default value: Now.
- :type file_last_write_time: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param metadata: A name-value pair to associate with a file storage
- object.
+ :param metadata: A name-value pair to associate with a file storage object.
:type metadata: str
- :param file_permission: If specified the permission (security
- descriptor) shall be set for the directory/file. This header can be
- used if Permission size is <= 8KB, else x-ms-file-permission-key
- header shall be used. Default value: Inherit. If SDDL is specified as
- input, it must have owner, group and dacl. Note: Only one of the
- x-ms-file-permission or x-ms-file-permission-key should be specified.
+ :param file_permission: If specified the permission (security descriptor) shall be set for the
+ directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-
+ permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it
+ must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-
+ permission-key should be specified.
:type file_permission: str
- :param file_permission_key: Key of the permission to be set for the
- directory/file. Note: Only one of the x-ms-file-permission or
- x-ms-file-permission-key should be specified.
+ :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only
+ one of the x-ms-file-permission or x-ms-file-permission-key should be specified.
:type file_permission_key: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param file_attributes: If specified, the provided file attributes shall be set. Default value:
+ ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default.
+ :type file_attributes: str
+ :param file_creation_time: Creation time for the file/directory. Default value: Now.
+ :type file_creation_time: str
+ :param file_last_write_time: Last write time for the file/directory. Default value: Now.
+ :type file_last_write_time: str
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "directory"
+ accept = "application/xml"
+
# Construct URL
- url = self.create.metadata['url']
+ url = self.create.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
if metadata is not None:
header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
@@ -102,214 +118,247 @@ def create(self, file_attributes="none", file_creation_time="now", file_last_wri
header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str')
header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str')
header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+ response_headers['x-ms-file-attributes']=self._deserialize('str', response.headers.get('x-ms-file-attributes'))
+ response_headers['x-ms-file-creation-time']=self._deserialize('str', response.headers.get('x-ms-file-creation-time'))
+ response_headers['x-ms-file-last-write-time']=self._deserialize('str', response.headers.get('x-ms-file-last-write-time'))
+ response_headers['x-ms-file-change-time']=self._deserialize('str', response.headers.get('x-ms-file-change-time'))
+ response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id'))
+ response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-file-attributes': self._deserialize('str', response.headers.get('x-ms-file-attributes')),
- 'x-ms-file-creation-time': self._deserialize('str', response.headers.get('x-ms-file-creation-time')),
- 'x-ms-file-last-write-time': self._deserialize('str', response.headers.get('x-ms-file-last-write-time')),
- 'x-ms-file-change-time': self._deserialize('str', response.headers.get('x-ms-file-change-time')),
- 'x-ms-file-id': self._deserialize('str', response.headers.get('x-ms-file-id')),
- 'x-ms-file-parent-id': self._deserialize('str', response.headers.get('x-ms-file-parent-id')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- create.metadata = {'url': '/{shareName}/{directory}'}
-
- def get_properties(self, sharesnapshot=None, timeout=None, cls=None, **kwargs):
- """Returns all system properties for the specified directory, and can also
- be used to check the existence of a directory. The data returned does
- not include the files in the directory or any subdirectories.
-
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
+ return cls(pipeline_response, None, response_headers)
+
+ create.metadata = {'url': '/{shareName}/{directory}'} # type: ignore
+
+ def get_properties(
+ self,
+ sharesnapshot=None, # type: Optional[str]
+ timeout=None, # type: Optional[int]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """Returns all system properties for the specified directory, and can also be used to check the
+ existence of a directory. The data returned does not include the files in the directory or any
+ subdirectories.
+
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
:type sharesnapshot: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "directory"
+ accept = "application/xml"
+
# Construct URL
- url = self.get_properties.metadata['url']
+ url = self.get_properties.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
if sharesnapshot is not None:
query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta'))
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-server-encrypted'))
+ response_headers['x-ms-file-attributes']=self._deserialize('str', response.headers.get('x-ms-file-attributes'))
+ response_headers['x-ms-file-creation-time']=self._deserialize('str', response.headers.get('x-ms-file-creation-time'))
+ response_headers['x-ms-file-last-write-time']=self._deserialize('str', response.headers.get('x-ms-file-last-write-time'))
+ response_headers['x-ms-file-change-time']=self._deserialize('str', response.headers.get('x-ms-file-change-time'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+ response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id'))
+ response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id'))
if cls:
- response_headers = {
- 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')),
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-server-encrypted')),
- 'x-ms-file-attributes': self._deserialize('str', response.headers.get('x-ms-file-attributes')),
- 'x-ms-file-creation-time': self._deserialize('str', response.headers.get('x-ms-file-creation-time')),
- 'x-ms-file-last-write-time': self._deserialize('str', response.headers.get('x-ms-file-last-write-time')),
- 'x-ms-file-change-time': self._deserialize('str', response.headers.get('x-ms-file-change-time')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-file-id': self._deserialize('str', response.headers.get('x-ms-file-id')),
- 'x-ms-file-parent-id': self._deserialize('str', response.headers.get('x-ms-file-parent-id')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- get_properties.metadata = {'url': '/{shareName}/{directory}'}
-
- def delete(self, timeout=None, cls=None, **kwargs):
- """Removes the specified empty directory. Note that the directory must be
- empty before it can be deleted.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ return cls(pipeline_response, None, response_headers)
+
+ get_properties.metadata = {'url': '/{shareName}/{directory}'} # type: ignore
+
+ def delete(
+ self,
+ timeout=None, # type: Optional[int]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """Removes the specified empty directory. Note that the directory must be empty before it can be
+ deleted.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "directory"
+ accept = "application/xml"
+
# Construct URL
- url = self.delete.metadata['url']
+ url = self.delete.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.delete(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- delete.metadata = {'url': '/{shareName}/{directory}'}
-
- def set_properties(self, file_attributes="none", file_creation_time="now", file_last_write_time="now", timeout=None, file_permission="inherit", file_permission_key=None, cls=None, **kwargs):
+ return cls(pipeline_response, None, response_headers)
+
+ delete.metadata = {'url': '/{shareName}/{directory}'} # type: ignore
+
+ def set_properties(
+ self,
+ timeout=None, # type: Optional[int]
+ file_permission="inherit", # type: Optional[str]
+ file_permission_key=None, # type: Optional[str]
+ file_attributes="none", # type: str
+ file_creation_time="now", # type: str
+ file_last_write_time="now", # type: str
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""Sets properties on the directory.
- :param file_attributes: If specified, the provided file attributes
- shall be set. Default value: ‘Archive’ for file and ‘Directory’ for
- directory. ‘None’ can also be specified as default.
- :type file_attributes: str
- :param file_creation_time: Creation time for the file/directory.
- Default value: Now.
- :type file_creation_time: str
- :param file_last_write_time: Last write time for the file/directory.
- Default value: Now.
- :type file_last_write_time: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param file_permission: If specified the permission (security
- descriptor) shall be set for the directory/file. This header can be
- used if Permission size is <= 8KB, else x-ms-file-permission-key
- header shall be used. Default value: Inherit. If SDDL is specified as
- input, it must have owner, group and dacl. Note: Only one of the
- x-ms-file-permission or x-ms-file-permission-key should be specified.
+ :param file_permission: If specified the permission (security descriptor) shall be set for the
+ directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-
+ permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it
+ must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-
+ permission-key should be specified.
:type file_permission: str
- :param file_permission_key: Key of the permission to be set for the
- directory/file. Note: Only one of the x-ms-file-permission or
- x-ms-file-permission-key should be specified.
+ :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only
+ one of the x-ms-file-permission or x-ms-file-permission-key should be specified.
:type file_permission_key: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param file_attributes: If specified, the provided file attributes shall be set. Default value:
+ ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default.
+ :type file_attributes: str
+ :param file_creation_time: Creation time for the file/directory. Default value: Now.
+ :type file_creation_time: str
+ :param file_last_write_time: Last write time for the file/directory. Default value: Now.
+ :type file_last_write_time: str
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "directory"
comp = "properties"
+ accept = "application/xml"
# Construct URL
- url = self.set_properties.metadata['url']
+ url = self.set_properties.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
if file_permission is not None:
header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str')
@@ -318,146 +367,167 @@ def set_properties(self, file_attributes="none", file_creation_time="now", file_
header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str')
header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str')
header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+ response_headers['x-ms-file-attributes']=self._deserialize('str', response.headers.get('x-ms-file-attributes'))
+ response_headers['x-ms-file-creation-time']=self._deserialize('str', response.headers.get('x-ms-file-creation-time'))
+ response_headers['x-ms-file-last-write-time']=self._deserialize('str', response.headers.get('x-ms-file-last-write-time'))
+ response_headers['x-ms-file-change-time']=self._deserialize('str', response.headers.get('x-ms-file-change-time'))
+ response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id'))
+ response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-file-attributes': self._deserialize('str', response.headers.get('x-ms-file-attributes')),
- 'x-ms-file-creation-time': self._deserialize('str', response.headers.get('x-ms-file-creation-time')),
- 'x-ms-file-last-write-time': self._deserialize('str', response.headers.get('x-ms-file-last-write-time')),
- 'x-ms-file-change-time': self._deserialize('str', response.headers.get('x-ms-file-change-time')),
- 'x-ms-file-id': self._deserialize('str', response.headers.get('x-ms-file-id')),
- 'x-ms-file-parent-id': self._deserialize('str', response.headers.get('x-ms-file-parent-id')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_properties.metadata = {'url': '/{shareName}/{directory}'}
-
- def set_metadata(self, timeout=None, metadata=None, cls=None, **kwargs):
+ return cls(pipeline_response, None, response_headers)
+
+ set_properties.metadata = {'url': '/{shareName}/{directory}'} # type: ignore
+
+ def set_metadata(
+ self,
+ timeout=None, # type: Optional[int]
+ metadata=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""Updates user defined metadata for the specified directory.
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param metadata: A name-value pair to associate with a file storage
- object.
+ :param metadata: A name-value pair to associate with a file storage object.
:type metadata: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "directory"
comp = "metadata"
+ accept = "application/xml"
# Construct URL
- url = self.set_metadata.metadata['url']
+ url = self.set_metadata.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
if metadata is not None:
header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_metadata.metadata = {'url': '/{shareName}/{directory}'}
-
- def list_files_and_directories_segment(self, prefix=None, sharesnapshot=None, marker=None, maxresults=None, timeout=None, cls=None, **kwargs):
- """Returns a list of files or directories under the specified share or
- directory. It lists the contents only for a single level of the
- directory hierarchy.
-
- :param prefix: Filters the results to return only entries whose name
- begins with the specified prefix.
+ return cls(pipeline_response, None, response_headers)
+
+ set_metadata.metadata = {'url': '/{shareName}/{directory}'} # type: ignore
+
+ def list_files_and_directories_segment(
+ self,
+ prefix=None, # type: Optional[str]
+ sharesnapshot=None, # type: Optional[str]
+ marker=None, # type: Optional[str]
+ maxresults=None, # type: Optional[int]
+ timeout=None, # type: Optional[int]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> "_models.ListFilesAndDirectoriesSegmentResponse"
+ """Returns a list of files or directories under the specified share or directory. It lists the
+ contents only for a single level of the directory hierarchy.
+
+ :param prefix: Filters the results to return only entries whose name begins with the specified
+ prefix.
:type prefix: str
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
:type sharesnapshot: str
- :param marker: A string value that identifies the portion of the list
- to be returned with the next list operation. The operation returns a
- marker value within the response body if the list returned was not
- complete. The marker value may then be used in a subsequent call to
- request the next set of list items. The marker value is opaque to the
- client.
+ :param marker: A string value that identifies the portion of the list to be returned with the
+ next list operation. The operation returns a marker value within the response body if the list
+ returned was not complete. The marker value may then be used in a subsequent call to request
+ the next set of list items. The marker value is opaque to the client.
:type marker: str
- :param maxresults: Specifies the maximum number of entries to return.
- If the request does not specify maxresults, or specifies a value
- greater than 5,000, the server will return up to 5,000 items.
+ :param maxresults: Specifies the maximum number of entries to return. If the request does not
+ specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000
+ items.
:type maxresults: int
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: ListFilesAndDirectoriesSegmentResponse or the result of
- cls(response)
- :rtype:
- ~azure.storage.fileshare.models.ListFilesAndDirectoriesSegmentResponse
- :raises:
- :class:`StorageErrorException`
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ListFilesAndDirectoriesSegmentResponse, or the result of cls(response)
+ :rtype: ~azure.storage.fileshare.models.ListFilesAndDirectoriesSegmentResponse
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListFilesAndDirectoriesSegmentResponse"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "directory"
comp = "list"
+ accept = "application/xml"
# Construct URL
- url = self.list_files_and_directories_segment.metadata['url']
+ url = self.list_files_and_directories_segment.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if prefix is not None:
query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str')
if sharesnapshot is not None:
@@ -468,85 +538,89 @@ def list_files_and_directories_segment(self, prefix=None, sharesnapshot=None, ma
query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1)
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('ListFilesAndDirectoriesSegmentResponse', response)
- header_dict = {
- 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('ListFilesAndDirectoriesSegmentResponse', pipeline_response)
if cls:
- return cls(response, deserialized, header_dict)
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
- list_files_and_directories_segment.metadata = {'url': '/{shareName}/{directory}'}
-
- def list_handles(self, marker=None, maxresults=None, timeout=None, sharesnapshot=None, recursive=None, cls=None, **kwargs):
+ list_files_and_directories_segment.metadata = {'url': '/{shareName}/{directory}'} # type: ignore
+
+ def list_handles(
+ self,
+ marker=None, # type: Optional[str]
+ maxresults=None, # type: Optional[int]
+ timeout=None, # type: Optional[int]
+ sharesnapshot=None, # type: Optional[str]
+ recursive=None, # type: Optional[bool]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> "_models.ListHandlesResponse"
"""Lists handles for directory.
- :param marker: A string value that identifies the portion of the list
- to be returned with the next list operation. The operation returns a
- marker value within the response body if the list returned was not
- complete. The marker value may then be used in a subsequent call to
- request the next set of list items. The marker value is opaque to the
- client.
+ :param marker: A string value that identifies the portion of the list to be returned with the
+ next list operation. The operation returns a marker value within the response body if the list
+ returned was not complete. The marker value may then be used in a subsequent call to request
+ the next set of list items. The marker value is opaque to the client.
:type marker: str
- :param maxresults: Specifies the maximum number of entries to return.
- If the request does not specify maxresults, or specifies a value
- greater than 5,000, the server will return up to 5,000 items.
+ :param maxresults: Specifies the maximum number of entries to return. If the request does not
+ specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000
+ items.
:type maxresults: int
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
:type sharesnapshot: str
- :param recursive: Specifies operation should apply to the directory
- specified in the URI, its files, its subdirectories and their files.
+ :param recursive: Specifies operation should apply to the directory specified in the URI, its
+ files, its subdirectories and their files.
:type recursive: bool
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: ListHandlesResponse or the result of cls(response)
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ListHandlesResponse, or the result of cls(response)
:rtype: ~azure.storage.fileshare.models.ListHandlesResponse
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListHandlesResponse"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
comp = "listhandles"
+ accept = "application/xml"
# Construct URL
- url = self.list_handles.metadata['url']
+ url = self.list_handles.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if marker is not None:
query_parameters['marker'] = self._serialize.query("marker", marker, 'str')
if maxresults is not None:
@@ -555,118 +629,123 @@ def list_handles(self, marker=None, maxresults=None, timeout=None, sharesnapshot
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
if sharesnapshot is not None:
query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
+ header_parameters = {} # type: Dict[str, Any]
if recursive is not None:
header_parameters['x-ms-recursive'] = self._serialize.header("recursive", recursive, 'bool')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('ListHandlesResponse', response)
- header_dict = {
- 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('ListHandlesResponse', pipeline_response)
if cls:
- return cls(response, deserialized, header_dict)
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
- list_handles.metadata = {'url': '/{shareName}/{directory}'}
-
- def force_close_handles(self, handle_id, timeout=None, marker=None, sharesnapshot=None, recursive=None, cls=None, **kwargs):
+ list_handles.metadata = {'url': '/{shareName}/{directory}'} # type: ignore
+
+ def force_close_handles(
+ self,
+ handle_id, # type: str
+ timeout=None, # type: Optional[int]
+ marker=None, # type: Optional[str]
+ sharesnapshot=None, # type: Optional[str]
+ recursive=None, # type: Optional[bool]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""Closes all handles open for given directory.
- :param handle_id: Specifies handle ID opened on the file or directory
- to be closed. Asterisk (‘*’) is a wildcard that specifies all handles.
+ :param handle_id: Specifies handle ID opened on the file or directory to be closed. Asterisk
+ (‘*’) is a wildcard that specifies all handles.
:type handle_id: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param marker: A string value that identifies the portion of the list
- to be returned with the next list operation. The operation returns a
- marker value within the response body if the list returned was not
- complete. The marker value may then be used in a subsequent call to
- request the next set of list items. The marker value is opaque to the
- client.
+ :param marker: A string value that identifies the portion of the list to be returned with the
+ next list operation. The operation returns a marker value within the response body if the list
+ returned was not complete. The marker value may then be used in a subsequent call to request
+ the next set of list items. The marker value is opaque to the client.
:type marker: str
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
:type sharesnapshot: str
- :param recursive: Specifies operation should apply to the directory
- specified in the URI, its files, its subdirectories and their files.
+ :param recursive: Specifies operation should apply to the directory specified in the URI, its
+ files, its subdirectories and their files.
:type recursive: bool
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
comp = "forceclosehandles"
+ accept = "application/xml"
# Construct URL
- url = self.force_close_handles.metadata['url']
+ url = self.force_close_handles.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
if marker is not None:
query_parameters['marker'] = self._serialize.query("marker", marker, 'str')
if sharesnapshot is not None:
query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-handle-id'] = self._serialize.header("handle_id", handle_id, 'str')
if recursive is not None:
header_parameters['x-ms-recursive'] = self._serialize.header("recursive", recursive, 'bool')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-marker']=self._deserialize('str', response.headers.get('x-ms-marker'))
+ response_headers['x-ms-number-of-handles-closed']=self._deserialize('int', response.headers.get('x-ms-number-of-handles-closed'))
+ response_headers['x-ms-number-of-handles-failed']=self._deserialize('int', response.headers.get('x-ms-number-of-handles-failed'))
if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-marker': self._deserialize('str', response.headers.get('x-ms-marker')),
- 'x-ms-number-of-handles-closed': self._deserialize('int', response.headers.get('x-ms-number-of-handles-closed')),
- 'x-ms-number-of-handles-failed': self._deserialize('int', response.headers.get('x-ms-number-of-handles-failed')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- force_close_handles.metadata = {'url': '/{shareName}/{directory}'}
+ return cls(pipeline_response, None, response_headers)
+
+ force_close_handles.metadata = {'url': '/{shareName}/{directory}'} # type: ignore
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py
index 48df9325f80d..8c37bb704ad8 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py
@@ -1,134 +1,153 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from typing import TYPE_CHECKING
+import warnings
-from azure.core.exceptions import map_error
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import HttpRequest, HttpResponse
-from .. import models
+from .. import models as _models
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union
+
+ T = TypeVar('T')
+ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
class FileOperations(object):
"""FileOperations operations.
- You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~azure.storage.fileshare.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
- :ivar x_ms_type: Dummy constant parameter, file type can only be file. Constant value: "file".
- :ivar x_ms_copy_action: . Constant value: "abort".
"""
- models = models
+ models = _models
def __init__(self, client, config, serializer, deserializer):
-
self._client = client
self._serialize = serializer
self._deserialize = deserializer
-
self._config = config
- self.x_ms_type = "file"
- self.x_ms_copy_action = "abort"
-
- def create(self, file_content_length, file_attributes="none", file_creation_time="now", file_last_write_time="now", timeout=None, metadata=None, file_permission="inherit", file_permission_key=None, file_http_headers=None, lease_access_conditions=None, cls=None, **kwargs):
- """Creates a new file or replaces a file. Note it only initializes the
- file with no content.
- :param file_content_length: Specifies the maximum size for the file,
- up to 4 TB.
+ def create(
+ self,
+ file_content_length, # type: int
+ timeout=None, # type: Optional[int]
+ metadata=None, # type: Optional[str]
+ file_permission="inherit", # type: Optional[str]
+ file_permission_key=None, # type: Optional[str]
+ file_attributes="none", # type: str
+ file_creation_time="now", # type: str
+ file_last_write_time="now", # type: str
+ file_http_headers=None, # type: Optional["_models.FileHTTPHeaders"]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """Creates a new file or replaces a file. Note it only initializes the file with no content.
+
+ :param file_content_length: Specifies the maximum size for the file, up to 4 TB.
:type file_content_length: long
- :param file_attributes: If specified, the provided file attributes
- shall be set. Default value: ‘Archive’ for file and ‘Directory’ for
- directory. ‘None’ can also be specified as default.
- :type file_attributes: str
- :param file_creation_time: Creation time for the file/directory.
- Default value: Now.
- :type file_creation_time: str
- :param file_last_write_time: Last write time for the file/directory.
- Default value: Now.
- :type file_last_write_time: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param metadata: A name-value pair to associate with a file storage
- object.
+ :param metadata: A name-value pair to associate with a file storage object.
:type metadata: str
- :param file_permission: If specified the permission (security
- descriptor) shall be set for the directory/file. This header can be
- used if Permission size is <= 8KB, else x-ms-file-permission-key
- header shall be used. Default value: Inherit. If SDDL is specified as
- input, it must have owner, group and dacl. Note: Only one of the
- x-ms-file-permission or x-ms-file-permission-key should be specified.
+ :param file_permission: If specified the permission (security descriptor) shall be set for the
+ directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-
+ permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it
+ must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-
+ permission-key should be specified.
:type file_permission: str
- :param file_permission_key: Key of the permission to be set for the
- directory/file. Note: Only one of the x-ms-file-permission or
- x-ms-file-permission-key should be specified.
+ :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only
+ one of the x-ms-file-permission or x-ms-file-permission-key should be specified.
:type file_permission_key: str
- :param file_http_headers: Additional parameters for the operation
- :type file_http_headers:
- ~azure.storage.fileshare.models.FileHTTPHeaders
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param file_attributes: If specified, the provided file attributes shall be set. Default value:
+ ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default.
+ :type file_attributes: str
+ :param file_creation_time: Creation time for the file/directory. Default value: Now.
+ :type file_creation_time: str
+ :param file_last_write_time: Last write time for the file/directory. Default value: Now.
+ :type file_last_write_time: str
+ :param file_http_headers: Parameter group.
+ :type file_http_headers: ~azure.storage.fileshare.models.FileHTTPHeaders
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- file_content_type = None
- if file_http_headers is not None:
- file_content_type = file_http_headers.file_content_type
- file_content_encoding = None
- if file_http_headers is not None:
- file_content_encoding = file_http_headers.file_content_encoding
- file_content_language = None
- if file_http_headers is not None:
- file_content_language = file_http_headers.file_content_language
- file_cache_control = None
- if file_http_headers is not None:
- file_cache_control = file_http_headers.file_cache_control
- file_content_md5 = None
- if file_http_headers is not None:
- file_content_md5 = file_http_headers.file_content_md5
- file_content_disposition = None
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _file_content_type = None
+ _file_content_encoding = None
+ _file_content_language = None
+ _file_cache_control = None
+ _file_content_md5 = None
+ _file_content_disposition = None
+ _lease_id = None
if file_http_headers is not None:
- file_content_disposition = file_http_headers.file_content_disposition
- lease_id = None
+ _file_content_type = file_http_headers.file_content_type
+ _file_content_encoding = file_http_headers.file_content_encoding
+ _file_content_language = file_http_headers.file_content_language
+ _file_cache_control = file_http_headers.file_cache_control
+ _file_content_md5 = file_http_headers.file_content_md5
+ _file_content_disposition = file_http_headers.file_content_disposition
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
+ _lease_id = lease_access_conditions.lease_id
+ file_type_constant = "file"
+ accept = "application/xml"
# Construct URL
- url = self.create.metadata['url']
+ url = self.create.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
header_parameters['x-ms-content-length'] = self._serialize.header("file_content_length", file_content_length, 'long')
- header_parameters['x-ms-type'] = self._serialize.header("self.x_ms_type", self.x_ms_type, 'str')
+ header_parameters['x-ms-type'] = self._serialize.header("file_type_constant", file_type_constant, 'str')
+ if _file_content_type is not None:
+ header_parameters['x-ms-content-type'] = self._serialize.header("file_content_type", _file_content_type, 'str')
+ if _file_content_encoding is not None:
+ header_parameters['x-ms-content-encoding'] = self._serialize.header("file_content_encoding", _file_content_encoding, 'str')
+ if _file_content_language is not None:
+ header_parameters['x-ms-content-language'] = self._serialize.header("file_content_language", _file_content_language, 'str')
+ if _file_cache_control is not None:
+ header_parameters['x-ms-cache-control'] = self._serialize.header("file_cache_control", _file_cache_control, 'str')
+ if _file_content_md5 is not None:
+ header_parameters['x-ms-content-md5'] = self._serialize.header("file_content_md5", _file_content_md5, 'bytearray')
+ if _file_content_disposition is not None:
+ header_parameters['x-ms-content-disposition'] = self._serialize.header("file_content_disposition", _file_content_disposition, 'str')
if metadata is not None:
header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
if file_permission is not None:
@@ -138,445 +157,470 @@ def create(self, file_content_length, file_attributes="none", file_creation_time
header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str')
header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str')
header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str')
- if file_content_type is not None:
- header_parameters['x-ms-content-type'] = self._serialize.header("file_content_type", file_content_type, 'str')
- if file_content_encoding is not None:
- header_parameters['x-ms-content-encoding'] = self._serialize.header("file_content_encoding", file_content_encoding, 'str')
- if file_content_language is not None:
- header_parameters['x-ms-content-language'] = self._serialize.header("file_content_language", file_content_language, 'str')
- if file_cache_control is not None:
- header_parameters['x-ms-cache-control'] = self._serialize.header("file_cache_control", file_cache_control, 'str')
- if file_content_md5 is not None:
- header_parameters['x-ms-content-md5'] = self._serialize.header("file_content_md5", file_content_md5, 'bytearray')
- if file_content_disposition is not None:
- header_parameters['x-ms-content-disposition'] = self._serialize.header("file_content_disposition", file_content_disposition, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+ response_headers['x-ms-file-attributes']=self._deserialize('str', response.headers.get('x-ms-file-attributes'))
+ response_headers['x-ms-file-creation-time']=self._deserialize('str', response.headers.get('x-ms-file-creation-time'))
+ response_headers['x-ms-file-last-write-time']=self._deserialize('str', response.headers.get('x-ms-file-last-write-time'))
+ response_headers['x-ms-file-change-time']=self._deserialize('str', response.headers.get('x-ms-file-change-time'))
+ response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id'))
+ response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-file-attributes': self._deserialize('str', response.headers.get('x-ms-file-attributes')),
- 'x-ms-file-creation-time': self._deserialize('str', response.headers.get('x-ms-file-creation-time')),
- 'x-ms-file-last-write-time': self._deserialize('str', response.headers.get('x-ms-file-last-write-time')),
- 'x-ms-file-change-time': self._deserialize('str', response.headers.get('x-ms-file-change-time')),
- 'x-ms-file-id': self._deserialize('str', response.headers.get('x-ms-file-id')),
- 'x-ms-file-parent-id': self._deserialize('str', response.headers.get('x-ms-file-parent-id')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- create.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- def download(self, timeout=None, range=None, range_get_content_md5=None, lease_access_conditions=None, cls=None, **kwargs):
- """Reads or downloads a file from the system, including its metadata and
- properties.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ return cls(pipeline_response, None, response_headers)
+
+ create.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ def download(
+ self,
+ timeout=None, # type: Optional[int]
+ range=None, # type: Optional[str]
+ range_get_content_md5=None, # type: Optional[bool]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> IO
+ """Reads or downloads a file from the system, including its metadata and properties.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
:param range: Return file data only from the specified byte range.
:type range: str
- :param range_get_content_md5: When this header is set to true and
- specified together with the Range header, the service returns the MD5
- hash for the range, as long as the range is less than or equal to 4 MB
- in size.
+ :param range_get_content_md5: When this header is set to true and specified together with the
+ Range header, the service returns the MD5 hash for the range, as long as the range is less than
+ or equal to 4 MB in size.
:type range_get_content_md5: bool
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: object or the result of cls(response)
- :rtype: Generator
- :raises:
- :class:`StorageErrorException`
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: IO, or the result of cls(response)
+ :rtype: IO
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType[IO]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
+ _lease_id = lease_access_conditions.lease_id
+ accept = "application/xml"
# Construct URL
- url = self.download.metadata['url']
+ url = self.download.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
# Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
if range is not None:
header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str')
if range_get_content_md5 is not None:
header_parameters['x-ms-range-get-content-md5'] = self._serialize.header("range_get_content_md5", range_get_content_md5, 'bool')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200, 206]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
- header_dict = {}
- deserialized = None
+ response_headers = {}
if response.status_code == 200:
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta'))
+ response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length'))
+ response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type'))
+ response_headers['Content-Range']=self._deserialize('str', response.headers.get('Content-Range'))
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Content-MD5']=self._deserialize('bytearray', response.headers.get('Content-MD5'))
+ response_headers['Content-Encoding']=self._deserialize('str', response.headers.get('Content-Encoding'))
+ response_headers['Cache-Control']=self._deserialize('str', response.headers.get('Cache-Control'))
+ response_headers['Content-Disposition']=self._deserialize('str', response.headers.get('Content-Disposition'))
+ response_headers['Content-Language']=self._deserialize('str', response.headers.get('Content-Language'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Accept-Ranges']=self._deserialize('str', response.headers.get('Accept-Ranges'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-copy-completion-time']=self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time'))
+ response_headers['x-ms-copy-status-description']=self._deserialize('str', response.headers.get('x-ms-copy-status-description'))
+ response_headers['x-ms-copy-id']=self._deserialize('str', response.headers.get('x-ms-copy-id'))
+ response_headers['x-ms-copy-progress']=self._deserialize('str', response.headers.get('x-ms-copy-progress'))
+ response_headers['x-ms-copy-source']=self._deserialize('str', response.headers.get('x-ms-copy-source'))
+ response_headers['x-ms-copy-status']=self._deserialize('str', response.headers.get('x-ms-copy-status'))
+ response_headers['x-ms-content-md5']=self._deserialize('bytearray', response.headers.get('x-ms-content-md5'))
+ response_headers['x-ms-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-server-encrypted'))
+ response_headers['x-ms-file-attributes']=self._deserialize('str', response.headers.get('x-ms-file-attributes'))
+ response_headers['x-ms-file-creation-time']=self._deserialize('str', response.headers.get('x-ms-file-creation-time'))
+ response_headers['x-ms-file-last-write-time']=self._deserialize('str', response.headers.get('x-ms-file-last-write-time'))
+ response_headers['x-ms-file-change-time']=self._deserialize('str', response.headers.get('x-ms-file-change-time'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+ response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id'))
+ response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id'))
+ response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration'))
+ response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state'))
+ response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status'))
deserialized = response.stream_download(self._client._pipeline)
- header_dict = {
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')),
- 'Content-Length': self._deserialize('long', response.headers.get('Content-Length')),
- 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')),
- 'Content-Range': self._deserialize('str', response.headers.get('Content-Range')),
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')),
- 'Content-Encoding': self._deserialize('str', response.headers.get('Content-Encoding')),
- 'Cache-Control': self._deserialize('str', response.headers.get('Cache-Control')),
- 'Content-Disposition': self._deserialize('str', response.headers.get('Content-Disposition')),
- 'Content-Language': self._deserialize('str', response.headers.get('Content-Language')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Accept-Ranges': self._deserialize('str', response.headers.get('Accept-Ranges')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-copy-completion-time': self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time')),
- 'x-ms-copy-status-description': self._deserialize('str', response.headers.get('x-ms-copy-status-description')),
- 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')),
- 'x-ms-copy-progress': self._deserialize('str', response.headers.get('x-ms-copy-progress')),
- 'x-ms-copy-source': self._deserialize('str', response.headers.get('x-ms-copy-source')),
- 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')),
- 'x-ms-content-md5': self._deserialize('bytearray', response.headers.get('x-ms-content-md5')),
- 'x-ms-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-server-encrypted')),
- 'x-ms-file-attributes': self._deserialize('str', response.headers.get('x-ms-file-attributes')),
- 'x-ms-file-creation-time': self._deserialize('str', response.headers.get('x-ms-file-creation-time')),
- 'x-ms-file-last-write-time': self._deserialize('str', response.headers.get('x-ms-file-last-write-time')),
- 'x-ms-file-change-time': self._deserialize('str', response.headers.get('x-ms-file-change-time')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-file-id': self._deserialize('str', response.headers.get('x-ms-file-id')),
- 'x-ms-file-parent-id': self._deserialize('str', response.headers.get('x-ms-file-parent-id')),
- 'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')),
- 'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')),
- 'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
+
if response.status_code == 206:
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta'))
+ response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length'))
+ response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type'))
+ response_headers['Content-Range']=self._deserialize('str', response.headers.get('Content-Range'))
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Content-MD5']=self._deserialize('bytearray', response.headers.get('Content-MD5'))
+ response_headers['Content-Encoding']=self._deserialize('str', response.headers.get('Content-Encoding'))
+ response_headers['Cache-Control']=self._deserialize('str', response.headers.get('Cache-Control'))
+ response_headers['Content-Disposition']=self._deserialize('str', response.headers.get('Content-Disposition'))
+ response_headers['Content-Language']=self._deserialize('str', response.headers.get('Content-Language'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Accept-Ranges']=self._deserialize('str', response.headers.get('Accept-Ranges'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-copy-completion-time']=self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time'))
+ response_headers['x-ms-copy-status-description']=self._deserialize('str', response.headers.get('x-ms-copy-status-description'))
+ response_headers['x-ms-copy-id']=self._deserialize('str', response.headers.get('x-ms-copy-id'))
+ response_headers['x-ms-copy-progress']=self._deserialize('str', response.headers.get('x-ms-copy-progress'))
+ response_headers['x-ms-copy-source']=self._deserialize('str', response.headers.get('x-ms-copy-source'))
+ response_headers['x-ms-copy-status']=self._deserialize('str', response.headers.get('x-ms-copy-status'))
+ response_headers['x-ms-content-md5']=self._deserialize('bytearray', response.headers.get('x-ms-content-md5'))
+ response_headers['x-ms-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-server-encrypted'))
+ response_headers['x-ms-file-attributes']=self._deserialize('str', response.headers.get('x-ms-file-attributes'))
+ response_headers['x-ms-file-creation-time']=self._deserialize('str', response.headers.get('x-ms-file-creation-time'))
+ response_headers['x-ms-file-last-write-time']=self._deserialize('str', response.headers.get('x-ms-file-last-write-time'))
+ response_headers['x-ms-file-change-time']=self._deserialize('str', response.headers.get('x-ms-file-change-time'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+ response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id'))
+ response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id'))
+ response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration'))
+ response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state'))
+ response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status'))
deserialized = response.stream_download(self._client._pipeline)
- header_dict = {
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')),
- 'Content-Length': self._deserialize('long', response.headers.get('Content-Length')),
- 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')),
- 'Content-Range': self._deserialize('str', response.headers.get('Content-Range')),
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')),
- 'Content-Encoding': self._deserialize('str', response.headers.get('Content-Encoding')),
- 'Cache-Control': self._deserialize('str', response.headers.get('Cache-Control')),
- 'Content-Disposition': self._deserialize('str', response.headers.get('Content-Disposition')),
- 'Content-Language': self._deserialize('str', response.headers.get('Content-Language')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Accept-Ranges': self._deserialize('str', response.headers.get('Accept-Ranges')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-copy-completion-time': self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time')),
- 'x-ms-copy-status-description': self._deserialize('str', response.headers.get('x-ms-copy-status-description')),
- 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')),
- 'x-ms-copy-progress': self._deserialize('str', response.headers.get('x-ms-copy-progress')),
- 'x-ms-copy-source': self._deserialize('str', response.headers.get('x-ms-copy-source')),
- 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')),
- 'x-ms-content-md5': self._deserialize('bytearray', response.headers.get('x-ms-content-md5')),
- 'x-ms-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-server-encrypted')),
- 'x-ms-file-attributes': self._deserialize('str', response.headers.get('x-ms-file-attributes')),
- 'x-ms-file-creation-time': self._deserialize('str', response.headers.get('x-ms-file-creation-time')),
- 'x-ms-file-last-write-time': self._deserialize('str', response.headers.get('x-ms-file-last-write-time')),
- 'x-ms-file-change-time': self._deserialize('str', response.headers.get('x-ms-file-change-time')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-file-id': self._deserialize('str', response.headers.get('x-ms-file-id')),
- 'x-ms-file-parent-id': self._deserialize('str', response.headers.get('x-ms-file-parent-id')),
- 'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')),
- 'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')),
- 'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
if cls:
- return cls(response, deserialized, header_dict)
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
- download.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- def get_properties(self, sharesnapshot=None, timeout=None, lease_access_conditions=None, cls=None, **kwargs):
- """Returns all user-defined metadata, standard HTTP properties, and system
- properties for the file. It does not return the content of the file.
-
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
+ download.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ def get_properties(
+ self,
+ sharesnapshot=None, # type: Optional[str]
+ timeout=None, # type: Optional[int]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """Returns all user-defined metadata, standard HTTP properties, and system properties for the
+ file. It does not return the content of the file.
+
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
:type sharesnapshot: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
+ _lease_id = lease_access_conditions.lease_id
+ accept = "application/xml"
# Construct URL
- url = self.get_properties.metadata['url']
+ url = self.get_properties.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
if sharesnapshot is not None:
query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.head(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta'))
+ response_headers['x-ms-type']=self._deserialize('str', response.headers.get('x-ms-type'))
+ response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length'))
+ response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type'))
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Content-MD5']=self._deserialize('bytearray', response.headers.get('Content-MD5'))
+ response_headers['Content-Encoding']=self._deserialize('str', response.headers.get('Content-Encoding'))
+ response_headers['Cache-Control']=self._deserialize('str', response.headers.get('Cache-Control'))
+ response_headers['Content-Disposition']=self._deserialize('str', response.headers.get('Content-Disposition'))
+ response_headers['Content-Language']=self._deserialize('str', response.headers.get('Content-Language'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-copy-completion-time']=self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time'))
+ response_headers['x-ms-copy-status-description']=self._deserialize('str', response.headers.get('x-ms-copy-status-description'))
+ response_headers['x-ms-copy-id']=self._deserialize('str', response.headers.get('x-ms-copy-id'))
+ response_headers['x-ms-copy-progress']=self._deserialize('str', response.headers.get('x-ms-copy-progress'))
+ response_headers['x-ms-copy-source']=self._deserialize('str', response.headers.get('x-ms-copy-source'))
+ response_headers['x-ms-copy-status']=self._deserialize('str', response.headers.get('x-ms-copy-status'))
+ response_headers['x-ms-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-server-encrypted'))
+ response_headers['x-ms-file-attributes']=self._deserialize('str', response.headers.get('x-ms-file-attributes'))
+ response_headers['x-ms-file-creation-time']=self._deserialize('str', response.headers.get('x-ms-file-creation-time'))
+ response_headers['x-ms-file-last-write-time']=self._deserialize('str', response.headers.get('x-ms-file-last-write-time'))
+ response_headers['x-ms-file-change-time']=self._deserialize('str', response.headers.get('x-ms-file-change-time'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+ response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id'))
+ response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id'))
+ response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration'))
+ response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state'))
+ response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status'))
if cls:
- response_headers = {
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')),
- 'x-ms-type': self._deserialize('str', response.headers.get('x-ms-type')),
- 'Content-Length': self._deserialize('long', response.headers.get('Content-Length')),
- 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')),
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')),
- 'Content-Encoding': self._deserialize('str', response.headers.get('Content-Encoding')),
- 'Cache-Control': self._deserialize('str', response.headers.get('Cache-Control')),
- 'Content-Disposition': self._deserialize('str', response.headers.get('Content-Disposition')),
- 'Content-Language': self._deserialize('str', response.headers.get('Content-Language')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-copy-completion-time': self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time')),
- 'x-ms-copy-status-description': self._deserialize('str', response.headers.get('x-ms-copy-status-description')),
- 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')),
- 'x-ms-copy-progress': self._deserialize('str', response.headers.get('x-ms-copy-progress')),
- 'x-ms-copy-source': self._deserialize('str', response.headers.get('x-ms-copy-source')),
- 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')),
- 'x-ms-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-server-encrypted')),
- 'x-ms-file-attributes': self._deserialize('str', response.headers.get('x-ms-file-attributes')),
- 'x-ms-file-creation-time': self._deserialize('str', response.headers.get('x-ms-file-creation-time')),
- 'x-ms-file-last-write-time': self._deserialize('str', response.headers.get('x-ms-file-last-write-time')),
- 'x-ms-file-change-time': self._deserialize('str', response.headers.get('x-ms-file-change-time')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-file-id': self._deserialize('str', response.headers.get('x-ms-file-id')),
- 'x-ms-file-parent-id': self._deserialize('str', response.headers.get('x-ms-file-parent-id')),
- 'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')),
- 'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')),
- 'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- get_properties.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- def delete(self, timeout=None, lease_access_conditions=None, cls=None, **kwargs):
+ return cls(pipeline_response, None, response_headers)
+
+ get_properties.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ def delete(
+ self,
+ timeout=None, # type: Optional[int]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""removes the file from the storage account.
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
+ _lease_id = lease_access_conditions.lease_id
+ accept = "application/xml"
# Construct URL
- url = self.delete.metadata['url']
+ url = self.delete.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.delete(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- delete.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- def set_http_headers(self, file_attributes="none", file_creation_time="now", file_last_write_time="now", timeout=None, file_content_length=None, file_permission="inherit", file_permission_key=None, file_http_headers=None, lease_access_conditions=None, cls=None, **kwargs):
+ return cls(pipeline_response, None, response_headers)
+
+ delete.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ def set_http_headers(
+ self,
+ timeout=None, # type: Optional[int]
+ file_content_length=None, # type: Optional[int]
+ file_permission="inherit", # type: Optional[str]
+ file_permission_key=None, # type: Optional[str]
+ file_attributes="none", # type: str
+ file_creation_time="now", # type: str
+ file_last_write_time="now", # type: str
+ file_http_headers=None, # type: Optional["_models.FileHTTPHeaders"]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""Sets HTTP headers on the file.
- :param file_attributes: If specified, the provided file attributes
- shall be set. Default value: ‘Archive’ for file and ‘Directory’ for
- directory. ‘None’ can also be specified as default.
- :type file_attributes: str
- :param file_creation_time: Creation time for the file/directory.
- Default value: Now.
- :type file_creation_time: str
- :param file_last_write_time: Last write time for the file/directory.
- Default value: Now.
- :type file_last_write_time: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param file_content_length: Resizes a file to the specified size. If
- the specified byte value is less than the current size of the file,
- then all ranges above the specified byte value are cleared.
+ :param file_content_length: Resizes a file to the specified size. If the specified byte value
+ is less than the current size of the file, then all ranges above the specified byte value are
+ cleared.
:type file_content_length: long
- :param file_permission: If specified the permission (security
- descriptor) shall be set for the directory/file. This header can be
- used if Permission size is <= 8KB, else x-ms-file-permission-key
- header shall be used. Default value: Inherit. If SDDL is specified as
- input, it must have owner, group and dacl. Note: Only one of the
- x-ms-file-permission or x-ms-file-permission-key should be specified.
+ :param file_permission: If specified the permission (security descriptor) shall be set for the
+ directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-
+ permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it
+ must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-
+ permission-key should be specified.
:type file_permission: str
- :param file_permission_key: Key of the permission to be set for the
- directory/file. Note: Only one of the x-ms-file-permission or
- x-ms-file-permission-key should be specified.
+ :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only
+ one of the x-ms-file-permission or x-ms-file-permission-key should be specified.
:type file_permission_key: str
- :param file_http_headers: Additional parameters for the operation
- :type file_http_headers:
- ~azure.storage.fileshare.models.FileHTTPHeaders
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param file_attributes: If specified, the provided file attributes shall be set. Default value:
+ ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default.
+ :type file_attributes: str
+ :param file_creation_time: Creation time for the file/directory. Default value: Now.
+ :type file_creation_time: str
+ :param file_last_write_time: Last write time for the file/directory. Default value: Now.
+ :type file_last_write_time: str
+ :param file_http_headers: Parameter group.
+ :type file_http_headers: ~azure.storage.fileshare.models.FileHTTPHeaders
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- file_content_type = None
- if file_http_headers is not None:
- file_content_type = file_http_headers.file_content_type
- file_content_encoding = None
- if file_http_headers is not None:
- file_content_encoding = file_http_headers.file_content_encoding
- file_content_language = None
- if file_http_headers is not None:
- file_content_language = file_http_headers.file_content_language
- file_cache_control = None
- if file_http_headers is not None:
- file_cache_control = file_http_headers.file_cache_control
- file_content_md5 = None
- if file_http_headers is not None:
- file_content_md5 = file_http_headers.file_content_md5
- file_content_disposition = None
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _file_content_type = None
+ _file_content_encoding = None
+ _file_content_language = None
+ _file_cache_control = None
+ _file_content_md5 = None
+ _file_content_disposition = None
+ _lease_id = None
if file_http_headers is not None:
- file_content_disposition = file_http_headers.file_content_disposition
- lease_id = None
+ _file_content_type = file_http_headers.file_content_type
+ _file_content_encoding = file_http_headers.file_content_encoding
+ _file_content_language = file_http_headers.file_content_language
+ _file_cache_control = file_http_headers.file_cache_control
+ _file_content_md5 = file_http_headers.file_content_md5
+ _file_content_disposition = file_http_headers.file_content_disposition
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
+ _lease_id = lease_access_conditions.lease_id
comp = "properties"
+ accept = "application/xml"
# Construct URL
- url = self.set_http_headers.metadata['url']
+ url = self.set_http_headers.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
if file_content_length is not None:
header_parameters['x-ms-content-length'] = self._serialize.header("file_content_length", file_content_length, 'long')
+ if _file_content_type is not None:
+ header_parameters['x-ms-content-type'] = self._serialize.header("file_content_type", _file_content_type, 'str')
+ if _file_content_encoding is not None:
+ header_parameters['x-ms-content-encoding'] = self._serialize.header("file_content_encoding", _file_content_encoding, 'str')
+ if _file_content_language is not None:
+ header_parameters['x-ms-content-language'] = self._serialize.header("file_content_language", _file_content_language, 'str')
+ if _file_cache_control is not None:
+ header_parameters['x-ms-cache-control'] = self._serialize.header("file_cache_control", _file_cache_control, 'str')
+ if _file_content_md5 is not None:
+ header_parameters['x-ms-content-md5'] = self._serialize.header("file_content_md5", _file_content_md5, 'bytearray')
+ if _file_content_disposition is not None:
+ header_parameters['x-ms-content-disposition'] = self._serialize.header("file_content_disposition", _file_content_disposition, 'str')
if file_permission is not None:
header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str')
if file_permission_key is not None:
@@ -584,605 +628,650 @@ def set_http_headers(self, file_attributes="none", file_creation_time="now", fil
header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str')
header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str')
header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str')
- if file_content_type is not None:
- header_parameters['x-ms-content-type'] = self._serialize.header("file_content_type", file_content_type, 'str')
- if file_content_encoding is not None:
- header_parameters['x-ms-content-encoding'] = self._serialize.header("file_content_encoding", file_content_encoding, 'str')
- if file_content_language is not None:
- header_parameters['x-ms-content-language'] = self._serialize.header("file_content_language", file_content_language, 'str')
- if file_cache_control is not None:
- header_parameters['x-ms-cache-control'] = self._serialize.header("file_cache_control", file_cache_control, 'str')
- if file_content_md5 is not None:
- header_parameters['x-ms-content-md5'] = self._serialize.header("file_content_md5", file_content_md5, 'bytearray')
- if file_content_disposition is not None:
- header_parameters['x-ms-content-disposition'] = self._serialize.header("file_content_disposition", file_content_disposition, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
+ response_headers['x-ms-file-attributes']=self._deserialize('str', response.headers.get('x-ms-file-attributes'))
+ response_headers['x-ms-file-creation-time']=self._deserialize('str', response.headers.get('x-ms-file-creation-time'))
+ response_headers['x-ms-file-last-write-time']=self._deserialize('str', response.headers.get('x-ms-file-last-write-time'))
+ response_headers['x-ms-file-change-time']=self._deserialize('str', response.headers.get('x-ms-file-change-time'))
+ response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id'))
+ response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-file-attributes': self._deserialize('str', response.headers.get('x-ms-file-attributes')),
- 'x-ms-file-creation-time': self._deserialize('str', response.headers.get('x-ms-file-creation-time')),
- 'x-ms-file-last-write-time': self._deserialize('str', response.headers.get('x-ms-file-last-write-time')),
- 'x-ms-file-change-time': self._deserialize('str', response.headers.get('x-ms-file-change-time')),
- 'x-ms-file-id': self._deserialize('str', response.headers.get('x-ms-file-id')),
- 'x-ms-file-parent-id': self._deserialize('str', response.headers.get('x-ms-file-parent-id')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_http_headers.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- def set_metadata(self, timeout=None, metadata=None, lease_access_conditions=None, cls=None, **kwargs):
+ return cls(pipeline_response, None, response_headers)
+
+ set_http_headers.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ def set_metadata(
+ self,
+ timeout=None, # type: Optional[int]
+ metadata=None, # type: Optional[str]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""Updates user-defined metadata for the specified file.
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param metadata: A name-value pair to associate with a file storage
- object.
+ :param metadata: A name-value pair to associate with a file storage object.
:type metadata: str
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
+ _lease_id = lease_access_conditions.lease_id
comp = "metadata"
+ accept = "application/xml"
# Construct URL
- url = self.set_metadata.metadata['url']
+ url = self.set_metadata.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
if metadata is not None:
header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_metadata.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- def acquire_lease(self, timeout=None, duration=None, proposed_lease_id=None, request_id=None, cls=None, **kwargs):
- """[Update] The Lease File operation establishes and manages a lock on a
- file for write and delete operations.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ return cls(pipeline_response, None, response_headers)
+
+ set_metadata.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ def acquire_lease(
+ self,
+ timeout=None, # type: Optional[int]
+ duration=None, # type: Optional[int]
+ proposed_lease_id=None, # type: Optional[str]
+ request_id_parameter=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """[Update] The Lease File operation establishes and manages a lock on a file for write and delete
+ operations.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param duration: Specifies the duration of the lease, in seconds, or
- negative one (-1) for a lease that never expires. A non-infinite lease
- can be between 15 and 60 seconds. A lease duration cannot be changed
- using renew or change.
+ :param duration: Specifies the duration of the lease, in seconds, or negative one (-1) for a
+ lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease
+ duration cannot be changed using renew or change.
:type duration: int
- :param proposed_lease_id: Proposed lease ID, in a GUID string format.
- The File service returns 400 (Invalid request) if the proposed lease
- ID is not in the correct format. See Guid Constructor (String) for a
- list of valid GUID string formats.
+ :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns
+ 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid
+ Constructor (String) for a list of valid GUID string formats.
:type proposed_lease_id: str
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
comp = "lease"
action = "acquire"
+ accept = "application/xml"
# Construct URL
- url = self.acquire_lease.metadata['url']
+ url = self.acquire_lease.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
if duration is not None:
header_parameters['x-ms-lease-duration'] = self._serialize.header("duration", duration, 'int')
if proposed_lease_id is not None:
header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- acquire_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- def release_lease(self, lease_id, timeout=None, request_id=None, cls=None, **kwargs):
- """[Update] The Lease File operation establishes and manages a lock on a
- file for write and delete operations.
+ return cls(pipeline_response, None, response_headers)
+
+ acquire_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ def release_lease(
+ self,
+ lease_id, # type: str
+ timeout=None, # type: Optional[int]
+ request_id_parameter=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """[Update] The Lease File operation establishes and manages a lock on a file for write and delete
+ operations.
:param lease_id: Specifies the current lease ID on the resource.
:type lease_id: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
comp = "lease"
action = "release"
+ accept = "application/xml"
# Construct URL
- url = self.release_lease.metadata['url']
+ url = self.release_lease.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- release_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- def change_lease(self, lease_id, timeout=None, proposed_lease_id=None, request_id=None, cls=None, **kwargs):
- """[Update] The Lease File operation establishes and manages a lock on a
- file for write and delete operations.
+ return cls(pipeline_response, None, response_headers)
+
+ release_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ def change_lease(
+ self,
+ lease_id, # type: str
+ timeout=None, # type: Optional[int]
+ proposed_lease_id=None, # type: Optional[str]
+ request_id_parameter=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """[Update] The Lease File operation establishes and manages a lock on a file for write and delete
+ operations.
:param lease_id: Specifies the current lease ID on the resource.
:type lease_id: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param proposed_lease_id: Proposed lease ID, in a GUID string format.
- The File service returns 400 (Invalid request) if the proposed lease
- ID is not in the correct format. See Guid Constructor (String) for a
- list of valid GUID string formats.
+ :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns
+ 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid
+ Constructor (String) for a list of valid GUID string formats.
:type proposed_lease_id: str
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
comp = "lease"
action = "change"
+ accept = "application/xml"
# Construct URL
- url = self.change_lease.metadata['url']
+ url = self.change_lease.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
if proposed_lease_id is not None:
header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- change_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- def break_lease(self, timeout=None, request_id=None, lease_access_conditions=None, cls=None, **kwargs):
- """[Update] The Lease File operation establishes and manages a lock on a
- file for write and delete operations.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ return cls(pipeline_response, None, response_headers)
+
+ change_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ def break_lease(
+ self,
+ timeout=None, # type: Optional[int]
+ request_id_parameter=None, # type: Optional[str]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """[Update] The Lease File operation establishes and manages a lock on a file for write and delete
+ operations.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
+ _lease_id = lease_access_conditions.lease_id
comp = "lease"
action = "break"
+ accept = "application/xml"
# Construct URL
- url = self.break_lease.metadata['url']
+ url = self.break_lease.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- break_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- def upload_range(self, range, content_length, file_range_write="update", optionalbody=None, timeout=None, content_md5=None, lease_access_conditions=None, cls=None, **kwargs):
+ return cls(pipeline_response, None, response_headers)
+
+ break_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ def upload_range(
+ self,
+ range, # type: str
+ content_length, # type: int
+ optionalbody, # type: IO
+ timeout=None, # type: Optional[int]
+ file_range_write="update", # type: Union[str, "_models.FileRangeWriteType"]
+ content_md5=None, # type: Optional[bytearray]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""Upload a range of bytes to a file.
- :param range: Specifies the range of bytes to be written. Both the
- start and end of the range must be specified. For an update operation,
- the range can be up to 4 MB in size. For a clear operation, the range
- can be up to the value of the file's full size. The File service
- accepts only a single byte range for the Range and 'x-ms-range'
- headers, and the byte range must be specified in the following format:
- bytes=startByte-endByte.
+ :param range: Specifies the range of bytes to be written. Both the start and end of the range
+ must be specified. For an update operation, the range can be up to 4 MB in size. For a clear
+ operation, the range can be up to the value of the file's full size. The File service accepts
+ only a single byte range for the Range and 'x-ms-range' headers, and the byte range must be
+ specified in the following format: bytes=startByte-endByte.
:type range: str
- :param file_range_write: Specify one of the following options: -
- Update: Writes the bytes specified by the request body into the
- specified range. The Range and Content-Length headers must match to
- perform the update. - Clear: Clears the specified range and releases
- the space used in storage for that range. To clear a range, set the
- Content-Length header to zero, and set the Range header to a value
- that indicates the range to clear, up to maximum file size. Possible
- values include: 'update', 'clear'
- :type file_range_write: str or
- ~azure.storage.fileshare.models.FileRangeWriteType
- :param content_length: Specifies the number of bytes being transmitted
- in the request body. When the x-ms-write header is set to clear, the
- value of this header must be set to zero.
+ :param content_length: Specifies the number of bytes being transmitted in the request body.
+ When the x-ms-write header is set to clear, the value of this header must be set to zero.
:type content_length: long
:param optionalbody: Initial data.
- :type optionalbody: Generator
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :type optionalbody: IO
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param content_md5: An MD5 hash of the content. This hash is used to
- verify the integrity of the data during transport. When the
- Content-MD5 header is specified, the File service compares the hash of
- the content that has arrived with the header value that was sent. If
- the two hashes do not match, the operation will fail with error code
- 400 (Bad Request).
+ :param file_range_write: Specify one of the following options: - Update: Writes the bytes
+ specified by the request body into the specified range. The Range and Content-Length headers
+ must match to perform the update. - Clear: Clears the specified range and releases the space
+ used in storage for that range. To clear a range, set the Content-Length header to zero, and
+ set the Range header to a value that indicates the range to clear, up to maximum file size.
+ :type file_range_write: str or ~azure.storage.fileshare.models.FileRangeWriteType
+ :param content_md5: An MD5 hash of the content. This hash is used to verify the integrity of
+ the data during transport. When the Content-MD5 header is specified, the File service compares
+ the hash of the content that has arrived with the header value that was sent. If the two hashes
+ do not match, the operation will fail with error code 400 (Bad Request).
:type content_md5: bytearray
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
+ _lease_id = lease_access_conditions.lease_id
comp = "range"
+ content_type = kwargs.pop("content_type", "application/octet-stream")
+ accept = "application/xml"
# Construct URL
- url = self.upload_range.metadata['url']
+ url = self.upload_range.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['Content-Type'] = 'application/octet-stream'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str')
- header_parameters['x-ms-write'] = self._serialize.header("file_range_write", file_range_write, 'FileRangeWriteType')
+ header_parameters['x-ms-write'] = self._serialize.header("file_range_write", file_range_write, 'str')
header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long')
if content_md5 is not None:
header_parameters['Content-MD5'] = self._serialize.header("content_md5", content_md5, 'bytearray')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct body
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters, stream_content=optionalbody)
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ body_content_kwargs = {} # type: Dict[str, Any]
+ body_content_kwargs['stream_content'] = optionalbody
+ request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['Content-MD5']=self._deserialize('bytearray', response.headers.get('Content-MD5'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'Content-MD5': self._deserialize('bytearray', response.headers.get('Content-MD5')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- upload_range.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- def upload_range_from_url(self, range, copy_source, content_length, timeout=None, source_range=None, source_content_crc64=None, source_modified_access_conditions=None, lease_access_conditions=None, cls=None, **kwargs):
- """Upload a range of bytes to a file where the contents are read from a
- URL.
+ return cls(pipeline_response, None, response_headers)
+
+ upload_range.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ def upload_range_from_url(
+ self,
+ range, # type: str
+ copy_source, # type: str
+ content_length, # type: int
+ timeout=None, # type: Optional[int]
+ source_range=None, # type: Optional[str]
+ source_content_crc64=None, # type: Optional[bytearray]
+ source_modified_access_conditions=None, # type: Optional["_models.SourceModifiedAccessConditions"]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """Upload a range of bytes to a file where the contents are read from a URL.
:param range: Writes data to the specified byte range in the file.
:type range: str
- :param copy_source: Specifies the URL of the source file or blob, up
- to 2 KB in length. To copy a file to another file within the same
- storage account, you may use Shared Key to authenticate the source
- file. If you are copying a file from another storage account, or if
- you are copying a blob from the same storage account or another
- storage account, then you must authenticate the source file or blob
- using a shared access signature. If the source is a public blob, no
- authentication is required to perform the copy operation. A file in a
- share snapshot can also be specified as a copy source.
+ :param copy_source: Specifies the URL of the source file or blob, up to 2 KB in length. To copy
+ a file to another file within the same storage account, you may use Shared Key to authenticate
+ the source file. If you are copying a file from another storage account, or if you are copying
+ a blob from the same storage account or another storage account, then you must authenticate the
+ source file or blob using a shared access signature. If the source is a public blob, no
+ authentication is required to perform the copy operation. A file in a share snapshot can also
+ be specified as a copy source.
:type copy_source: str
- :param content_length: Specifies the number of bytes being transmitted
- in the request body. When the x-ms-write header is set to clear, the
- value of this header must be set to zero.
+ :param content_length: Specifies the number of bytes being transmitted in the request body.
+ When the x-ms-write header is set to clear, the value of this header must be set to zero.
:type content_length: long
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
:param source_range: Bytes of source data in the specified range.
:type source_range: str
- :param source_content_crc64: Specify the crc64 calculated for the
- range of bytes that must be read from the copy source.
+ :param source_content_crc64: Specify the crc64 calculated for the range of bytes that must be
+ read from the copy source.
:type source_content_crc64: bytearray
- :param source_modified_access_conditions: Additional parameters for
- the operation
- :type source_modified_access_conditions:
- ~azure.storage.fileshare.models.SourceModifiedAccessConditions
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param source_modified_access_conditions: Parameter group.
+ :type source_modified_access_conditions: ~azure.storage.fileshare.models.SourceModifiedAccessConditions
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- source_if_match_crc64 = None
- if source_modified_access_conditions is not None:
- source_if_match_crc64 = source_modified_access_conditions.source_if_match_crc64
- source_if_none_match_crc64 = None
- if source_modified_access_conditions is not None:
- source_if_none_match_crc64 = source_modified_access_conditions.source_if_none_match_crc64
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _source_if_match_crc64 = None
+ _source_if_none_match_crc64 = None
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
+ _lease_id = lease_access_conditions.lease_id
+ if source_modified_access_conditions is not None:
+ _source_if_match_crc64 = source_modified_access_conditions.source_if_match_crc64
+ _source_if_none_match_crc64 = source_modified_access_conditions.source_if_none_match_crc64
comp = "range"
+ accept = "application/xml"
# Construct URL
- url = self.upload_range_from_url.metadata['url']
+ url = self.upload_range_from_url.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str')
header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str')
if source_range is not None:
@@ -1191,210 +1280,217 @@ def upload_range_from_url(self, range, copy_source, content_length, timeout=None
header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long')
if source_content_crc64 is not None:
header_parameters['x-ms-source-content-crc64'] = self._serialize.header("source_content_crc64", source_content_crc64, 'bytearray')
+ if _source_if_match_crc64 is not None:
+ header_parameters['x-ms-source-if-match-crc64'] = self._serialize.header("source_if_match_crc64", _source_if_match_crc64, 'bytearray')
+ if _source_if_none_match_crc64 is not None:
+ header_parameters['x-ms-source-if-none-match-crc64'] = self._serialize.header("source_if_none_match_crc64", _source_if_none_match_crc64, 'bytearray')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if source_if_match_crc64 is not None:
- header_parameters['x-ms-source-if-match-crc64'] = self._serialize.header("source_if_match_crc64", source_if_match_crc64, 'bytearray')
- if source_if_none_match_crc64 is not None:
- header_parameters['x-ms-source-if-none-match-crc64'] = self._serialize.header("source_if_none_match_crc64", source_if_none_match_crc64, 'bytearray')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-content-crc64']=self._deserialize('bytearray', response.headers.get('x-ms-content-crc64'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-content-crc64': self._deserialize('bytearray', response.headers.get('x-ms-content-crc64')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-request-server-encrypted': self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- upload_range_from_url.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- def get_range_list(self, sharesnapshot=None, prevsharesnapshot=None, timeout=None, range=None, lease_access_conditions=None, cls=None, **kwargs):
+ return cls(pipeline_response, None, response_headers)
+
+ upload_range_from_url.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ def get_range_list(
+ self,
+ sharesnapshot=None, # type: Optional[str]
+ prevsharesnapshot=None, # type: Optional[str]
+ timeout=None, # type: Optional[int]
+ range=None, # type: Optional[str]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> "_models.ShareFileRangeList"
"""Returns the list of valid ranges for a file.
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
:type sharesnapshot: str
- :param prevsharesnapshot: The previous snapshot parameter is an opaque
- DateTime value that, when present, specifies the previous snapshot.
+ :param prevsharesnapshot: The previous snapshot parameter is an opaque DateTime value that,
+ when present, specifies the previous snapshot.
:type prevsharesnapshot: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param range: Specifies the range of bytes over which to list ranges,
- inclusively.
+ :param range: Specifies the range of bytes over which to list ranges, inclusively.
:type range: str
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: ShareFileRangeList or the result of cls(response)
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ShareFileRangeList, or the result of cls(response)
:rtype: ~azure.storage.fileshare.models.ShareFileRangeList
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareFileRangeList"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
+ _lease_id = lease_access_conditions.lease_id
comp = "rangelist"
+ accept = "application/xml"
# Construct URL
- url = self.get_range_list.metadata['url']
+ url = self.get_range_list.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if sharesnapshot is not None:
query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
if prevsharesnapshot is not None:
query_parameters['prevsharesnapshot'] = self._serialize.query("prevsharesnapshot", prevsharesnapshot, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
if range is not None:
header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('ShareFileRangeList', response)
- header_dict = {
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'x-ms-content-length': self._deserialize('long', response.headers.get('x-ms-content-length')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['x-ms-content-length']=self._deserialize('long', response.headers.get('x-ms-content-length'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('ShareFileRangeList', pipeline_response)
if cls:
- return cls(response, deserialized, header_dict)
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
- get_range_list.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- def start_copy(self, copy_source, timeout=None, metadata=None, file_permission="inherit", file_permission_key=None, copy_file_smb_info=None, lease_access_conditions=None, cls=None, **kwargs):
+ get_range_list.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ def start_copy(
+ self,
+ copy_source, # type: str
+ timeout=None, # type: Optional[int]
+ metadata=None, # type: Optional[str]
+ file_permission="inherit", # type: Optional[str]
+ file_permission_key=None, # type: Optional[str]
+ copy_file_smb_info=None, # type: Optional["_models.CopyFileSmbInfo"]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""Copies a blob or file to a destination file within the storage account.
- :param copy_source: Specifies the URL of the source file or blob, up
- to 2 KB in length. To copy a file to another file within the same
- storage account, you may use Shared Key to authenticate the source
- file. If you are copying a file from another storage account, or if
- you are copying a blob from the same storage account or another
- storage account, then you must authenticate the source file or blob
- using a shared access signature. If the source is a public blob, no
- authentication is required to perform the copy operation. A file in a
- share snapshot can also be specified as a copy source.
+ :param copy_source: Specifies the URL of the source file or blob, up to 2 KB in length. To copy
+ a file to another file within the same storage account, you may use Shared Key to authenticate
+ the source file. If you are copying a file from another storage account, or if you are copying
+ a blob from the same storage account or another storage account, then you must authenticate the
+ source file or blob using a shared access signature. If the source is a public blob, no
+ authentication is required to perform the copy operation. A file in a share snapshot can also
+ be specified as a copy source.
:type copy_source: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param metadata: A name-value pair to associate with a file storage
- object.
+ :param metadata: A name-value pair to associate with a file storage object.
:type metadata: str
- :param file_permission: If specified the permission (security
- descriptor) shall be set for the directory/file. This header can be
- used if Permission size is <= 8KB, else x-ms-file-permission-key
- header shall be used. Default value: Inherit. If SDDL is specified as
- input, it must have owner, group and dacl. Note: Only one of the
- x-ms-file-permission or x-ms-file-permission-key should be specified.
+ :param file_permission: If specified the permission (security descriptor) shall be set for the
+ directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-
+ permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it
+ must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-
+ permission-key should be specified.
:type file_permission: str
- :param file_permission_key: Key of the permission to be set for the
- directory/file. Note: Only one of the x-ms-file-permission or
- x-ms-file-permission-key should be specified.
+ :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only
+ one of the x-ms-file-permission or x-ms-file-permission-key should be specified.
:type file_permission_key: str
- :param copy_file_smb_info: Additional parameters for the operation
- :type copy_file_smb_info:
- ~azure.storage.fileshare.models.CopyFileSmbInfo
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param copy_file_smb_info: Parameter group.
+ :type copy_file_smb_info: ~azure.storage.fileshare.models.CopyFileSmbInfo
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- file_permission_copy_mode = None
- if copy_file_smb_info is not None:
- file_permission_copy_mode = copy_file_smb_info.file_permission_copy_mode
- ignore_read_only = None
- if copy_file_smb_info is not None:
- ignore_read_only = copy_file_smb_info.ignore_read_only
- file_attributes = None
- if copy_file_smb_info is not None:
- file_attributes = copy_file_smb_info.file_attributes
- file_creation_time = None
- if copy_file_smb_info is not None:
- file_creation_time = copy_file_smb_info.file_creation_time
- file_last_write_time = None
- if copy_file_smb_info is not None:
- file_last_write_time = copy_file_smb_info.file_last_write_time
- set_archive_attribute = None
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _file_permission_copy_mode = None
+ _ignore_read_only = None
+ _file_attributes = None
+ _file_creation_time = None
+ _file_last_write_time = None
+ _set_archive_attribute = None
+ _lease_id = None
if copy_file_smb_info is not None:
- set_archive_attribute = copy_file_smb_info.set_archive_attribute
- lease_id = None
+ _file_permission_copy_mode = copy_file_smb_info.file_permission_copy_mode
+ _ignore_read_only = copy_file_smb_info.ignore_read_only
+ _file_attributes = copy_file_smb_info.file_attributes
+ _file_creation_time = copy_file_smb_info.file_creation_time
+ _file_last_write_time = copy_file_smb_info.file_last_write_time
+ _set_archive_attribute = copy_file_smb_info.set_archive_attribute
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
+ _lease_id = lease_access_conditions.lease_id
+ accept = "application/xml"
# Construct URL
- url = self.start_copy.metadata['url']
+ url = self.start_copy.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
if metadata is not None:
header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
@@ -1403,155 +1499,176 @@ def start_copy(self, copy_source, timeout=None, metadata=None, file_permission="
header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str')
if file_permission_key is not None:
header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str')
- if file_permission_copy_mode is not None:
- header_parameters['x-ms-file-permission-copy-mode'] = self._serialize.header("file_permission_copy_mode", file_permission_copy_mode, 'PermissionCopyModeType')
- if ignore_read_only is not None:
- header_parameters['x-ms-file-copy-ignore-read-only'] = self._serialize.header("ignore_read_only", ignore_read_only, 'bool')
- if file_attributes is not None:
- header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str')
- if file_creation_time is not None:
- header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str')
- if file_last_write_time is not None:
- header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str')
- if set_archive_attribute is not None:
- header_parameters['x-ms-file-copy-set-archive'] = self._serialize.header("set_archive_attribute", set_archive_attribute, 'bool')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
-
- # Construct and send request
+ if _file_permission_copy_mode is not None:
+ header_parameters['x-ms-file-permission-copy-mode'] = self._serialize.header("file_permission_copy_mode", _file_permission_copy_mode, 'str')
+ if _ignore_read_only is not None:
+ header_parameters['x-ms-file-copy-ignore-read-only'] = self._serialize.header("ignore_read_only", _ignore_read_only, 'bool')
+ if _file_attributes is not None:
+ header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", _file_attributes, 'str')
+ if _file_creation_time is not None:
+ header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", _file_creation_time, 'str')
+ if _file_last_write_time is not None:
+ header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", _file_last_write_time, 'str')
+ if _set_archive_attribute is not None:
+ header_parameters['x-ms-file-copy-set-archive'] = self._serialize.header("set_archive_attribute", _set_archive_attribute, 'bool')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-copy-id']=self._deserialize('str', response.headers.get('x-ms-copy-id'))
+ response_headers['x-ms-copy-status']=self._deserialize('str', response.headers.get('x-ms-copy-status'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-copy-id': self._deserialize('str', response.headers.get('x-ms-copy-id')),
- 'x-ms-copy-status': self._deserialize(models.CopyStatusType, response.headers.get('x-ms-copy-status')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- start_copy.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- def abort_copy(self, copy_id, timeout=None, lease_access_conditions=None, cls=None, **kwargs):
- """Aborts a pending Copy File operation, and leaves a destination file
- with zero length and full metadata.
-
- :param copy_id: The copy identifier provided in the x-ms-copy-id
- header of the original Copy File operation.
+ return cls(pipeline_response, None, response_headers)
+
+ start_copy.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ def abort_copy(
+ self,
+ copy_id, # type: str
+ timeout=None, # type: Optional[int]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """Aborts a pending Copy File operation, and leaves a destination file with zero length and full
+ metadata.
+
+ :param copy_id: The copy identifier provided in the x-ms-copy-id header of the original Copy
+ File operation.
:type copy_id: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
+ _lease_id = lease_access_conditions.lease_id
comp = "copy"
+ copy_action_abort_constant = "abort"
+ accept = "application/xml"
# Construct URL
- url = self.abort_copy.metadata['url']
+ url = self.abort_copy.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
query_parameters['copyid'] = self._serialize.query("copy_id", copy_id, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['x-ms-copy-action'] = self._serialize.header("self.x_ms_copy_action", self.x_ms_copy_action, 'str')
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-copy-action'] = self._serialize.header("copy_action_abort_constant", copy_action_abort_constant, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- abort_copy.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- def list_handles(self, marker=None, maxresults=None, timeout=None, sharesnapshot=None, cls=None, **kwargs):
+ return cls(pipeline_response, None, response_headers)
+
+ abort_copy.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ def list_handles(
+ self,
+ marker=None, # type: Optional[str]
+ maxresults=None, # type: Optional[int]
+ timeout=None, # type: Optional[int]
+ sharesnapshot=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> "_models.ListHandlesResponse"
"""Lists handles for file.
- :param marker: A string value that identifies the portion of the list
- to be returned with the next list operation. The operation returns a
- marker value within the response body if the list returned was not
- complete. The marker value may then be used in a subsequent call to
- request the next set of list items. The marker value is opaque to the
- client.
+ :param marker: A string value that identifies the portion of the list to be returned with the
+ next list operation. The operation returns a marker value within the response body if the list
+ returned was not complete. The marker value may then be used in a subsequent call to request
+ the next set of list items. The marker value is opaque to the client.
:type marker: str
- :param maxresults: Specifies the maximum number of entries to return.
- If the request does not specify maxresults, or specifies a value
- greater than 5,000, the server will return up to 5,000 items.
+ :param maxresults: Specifies the maximum number of entries to return. If the request does not
+ specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000
+ items.
:type maxresults: int
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
:type sharesnapshot: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: ListHandlesResponse or the result of cls(response)
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ListHandlesResponse, or the result of cls(response)
:rtype: ~azure.storage.fileshare.models.ListHandlesResponse
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListHandlesResponse"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
comp = "listhandles"
+ accept = "application/xml"
# Construct URL
- url = self.list_handles.metadata['url']
+ url = self.list_handles.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if marker is not None:
query_parameters['marker'] = self._serialize.query("marker", marker, 'str')
if maxresults is not None:
@@ -1560,111 +1677,115 @@ def list_handles(self, marker=None, maxresults=None, timeout=None, sharesnapshot
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
if sharesnapshot is not None:
query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('ListHandlesResponse', response)
- header_dict = {
- 'Content-Type': self._deserialize('str', response.headers.get('Content-Type')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
+ response_headers = {}
+ response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('ListHandlesResponse', pipeline_response)
if cls:
- return cls(response, deserialized, header_dict)
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
- list_handles.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
-
- def force_close_handles(self, handle_id, timeout=None, marker=None, sharesnapshot=None, cls=None, **kwargs):
+ list_handles.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
+
+ def force_close_handles(
+ self,
+ handle_id, # type: str
+ timeout=None, # type: Optional[int]
+ marker=None, # type: Optional[str]
+ sharesnapshot=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""Closes all handles open for given file.
- :param handle_id: Specifies handle ID opened on the file or directory
- to be closed. Asterisk (‘*’) is a wildcard that specifies all handles.
+ :param handle_id: Specifies handle ID opened on the file or directory to be closed. Asterisk
+ (‘*’) is a wildcard that specifies all handles.
:type handle_id: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param marker: A string value that identifies the portion of the list
- to be returned with the next list operation. The operation returns a
- marker value within the response body if the list returned was not
- complete. The marker value may then be used in a subsequent call to
- request the next set of list items. The marker value is opaque to the
- client.
+ :param marker: A string value that identifies the portion of the list to be returned with the
+ next list operation. The operation returns a marker value within the response body if the list
+ returned was not complete. The marker value may then be used in a subsequent call to request
+ the next set of list items. The marker value is opaque to the client.
:type marker: str
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
:type sharesnapshot: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
comp = "forceclosehandles"
+ accept = "application/xml"
# Construct URL
- url = self.force_close_handles.metadata['url']
+ url = self.force_close_handles.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
if marker is not None:
query_parameters['marker'] = self._serialize.query("marker", marker, 'str')
if sharesnapshot is not None:
query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-handle-id'] = self._serialize.header("handle_id", handle_id, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-marker']=self._deserialize('str', response.headers.get('x-ms-marker'))
+ response_headers['x-ms-number-of-handles-closed']=self._deserialize('int', response.headers.get('x-ms-number-of-handles-closed'))
+ response_headers['x-ms-number-of-handles-failed']=self._deserialize('int', response.headers.get('x-ms-number-of-handles-failed'))
if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-marker': self._deserialize('str', response.headers.get('x-ms-marker')),
- 'x-ms-number-of-handles-closed': self._deserialize('int', response.headers.get('x-ms-number-of-handles-closed')),
- 'x-ms-number-of-handles-failed': self._deserialize('int', response.headers.get('x-ms-number-of-handles-failed')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- force_close_handles.metadata = {'url': '/{shareName}/{directory}/{fileName}'}
+ return cls(pipeline_response, None, response_headers)
+
+ force_close_handles.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py
index cd43e83f9dfc..94f79e74d033 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py
@@ -1,215 +1,244 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from typing import TYPE_CHECKING
+import warnings
-from azure.core.exceptions import map_error
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import HttpRequest, HttpResponse
-from .. import models
+from .. import models as _models
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union
+
+ T = TypeVar('T')
+ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
class ServiceOperations(object):
"""ServiceOperations operations.
- You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~azure.storage.fileshare.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
- :ivar restype: . Constant value: "service".
"""
- models = models
+ models = _models
def __init__(self, client, config, serializer, deserializer):
-
self._client = client
self._serialize = serializer
self._deserialize = deserializer
-
self._config = config
- self.restype = "service"
- def set_properties(self, storage_service_properties, timeout=None, cls=None, **kwargs):
- """Sets properties for a storage account's File service endpoint,
- including properties for Storage Analytics metrics and CORS
- (Cross-Origin Resource Sharing) rules.
+ def set_properties(
+ self,
+ storage_service_properties, # type: "_models.StorageServiceProperties"
+ timeout=None, # type: Optional[int]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """Sets properties for a storage account's File service endpoint, including properties for Storage
+ Analytics metrics and CORS (Cross-Origin Resource Sharing) rules.
:param storage_service_properties: The StorageService properties.
- :type storage_service_properties:
- ~azure.storage.fileshare.models.StorageServiceProperties
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :type storage_service_properties: ~azure.storage.fileshare.models.StorageServiceProperties
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "service"
comp = "properties"
+ content_type = kwargs.pop("content_type", "application/xml")
+ accept = "application/xml"
# Construct URL
- url = self.set_properties.metadata['url']
+ url = self.set_properties.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['Content-Type'] = 'application/xml; charset=utf-8'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct body
- body_content = self._serialize.body(storage_service_properties, 'StorageServiceProperties')
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters, body_content)
+ body_content_kwargs = {} # type: Dict[str, Any]
+ body_content = self._serialize.body(storage_service_properties, 'StorageServiceProperties', is_xml=True)
+ body_content_kwargs['content'] = body_content
+ request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_properties.metadata = {'url': '/'}
-
- def get_properties(self, timeout=None, cls=None, **kwargs):
- """Gets the properties of a storage account's File service, including
- properties for Storage Analytics metrics and CORS (Cross-Origin
- Resource Sharing) rules.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ return cls(pipeline_response, None, response_headers)
+
+ set_properties.metadata = {'url': '/'} # type: ignore
+
+ def get_properties(
+ self,
+ timeout=None, # type: Optional[int]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> "_models.StorageServiceProperties"
+ """Gets the properties of a storage account's File service, including properties for Storage
+ Analytics metrics and CORS (Cross-Origin Resource Sharing) rules.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: StorageServiceProperties or the result of cls(response)
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: StorageServiceProperties, or the result of cls(response)
:rtype: ~azure.storage.fileshare.models.StorageServiceProperties
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageServiceProperties"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "service"
comp = "properties"
+ accept = "application/xml"
# Construct URL
- url = self.get_properties.metadata['url']
+ url = self.get_properties.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('StorageServiceProperties', response)
- header_dict = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ deserialized = self._deserialize('StorageServiceProperties', pipeline_response)
if cls:
- return cls(response, deserialized, header_dict)
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
- get_properties.metadata = {'url': '/'}
-
- def list_shares_segment(self, prefix=None, marker=None, maxresults=None, include=None, timeout=None, cls=None, **kwargs):
- """The List Shares Segment operation returns a list of the shares and
- share snapshots under the specified account.
-
- :param prefix: Filters the results to return only entries whose name
- begins with the specified prefix.
+ get_properties.metadata = {'url': '/'} # type: ignore
+
+ def list_shares_segment(
+ self,
+ prefix=None, # type: Optional[str]
+ marker=None, # type: Optional[str]
+ maxresults=None, # type: Optional[int]
+ include=None, # type: Optional[List[Union[str, "_models.ListSharesIncludeType"]]]
+ timeout=None, # type: Optional[int]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> "_models.ListSharesResponse"
+ """The List Shares Segment operation returns a list of the shares and share snapshots under the
+ specified account.
+
+ :param prefix: Filters the results to return only entries whose name begins with the specified
+ prefix.
:type prefix: str
- :param marker: A string value that identifies the portion of the list
- to be returned with the next list operation. The operation returns a
- marker value within the response body if the list returned was not
- complete. The marker value may then be used in a subsequent call to
- request the next set of list items. The marker value is opaque to the
- client.
+ :param marker: A string value that identifies the portion of the list to be returned with the
+ next list operation. The operation returns a marker value within the response body if the list
+ returned was not complete. The marker value may then be used in a subsequent call to request
+ the next set of list items. The marker value is opaque to the client.
:type marker: str
- :param maxresults: Specifies the maximum number of entries to return.
- If the request does not specify maxresults, or specifies a value
- greater than 5,000, the server will return up to 5,000 items.
+ :param maxresults: Specifies the maximum number of entries to return. If the request does not
+ specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000
+ items.
:type maxresults: int
- :param include: Include this parameter to specify one or more datasets
- to include in the response.
- :type include: list[str or
- ~azure.storage.fileshare.models.ListSharesIncludeType]
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param include: Include this parameter to specify one or more datasets to include in the
+ response.
+ :type include: list[str or ~azure.storage.fileshare.models.ListSharesIncludeType]
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: ListSharesResponse or the result of cls(response)
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ListSharesResponse, or the result of cls(response)
:rtype: ~azure.storage.fileshare.models.ListSharesResponse
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListSharesResponse"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
comp = "list"
+ accept = "application/xml"
# Construct URL
- url = self.list_shares_segment.metadata['url']
+ url = self.list_shares_segment.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if prefix is not None:
query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str')
if marker is not None:
@@ -217,37 +246,31 @@ def list_shares_segment(self, prefix=None, marker=None, maxresults=None, include
if maxresults is not None:
query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1)
if include is not None:
- query_parameters['include'] = self._serialize.query("include", include, '[ListSharesIncludeType]', div=',')
+ query_parameters['include'] = self._serialize.query("include", include, '[str]', div=',')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('ListSharesResponse', response)
- header_dict = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ deserialized = self._deserialize('ListSharesResponse', pipeline_response)
if cls:
- return cls(response, deserialized, header_dict)
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
- list_shares_segment.metadata = {'url': '/'}
+ list_shares_segment.metadata = {'url': '/'} # type: ignore
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py
index 077dfbe10301..6f1ebedd07b0 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py
@@ -1,90 +1,105 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
+# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from typing import TYPE_CHECKING
+import warnings
-from azure.core.exceptions import map_error
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import HttpRequest, HttpResponse
-from .. import models
+from .. import models as _models
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union
+
+ T = TypeVar('T')
+ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
class ShareOperations(object):
"""ShareOperations operations.
- You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~azure.storage.fileshare.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
- :ivar restype: . Constant value: "share".
"""
- models = models
+ models = _models
def __init__(self, client, config, serializer, deserializer):
-
self._client = client
self._serialize = serializer
self._deserialize = deserializer
-
self._config = config
- self.restype = "share"
- def create(self, timeout=None, metadata=None, quota=None, access_tier=None, enabled_protocols=None, root_squash=None, cls=None, **kwargs):
- """Creates a new share under the specified account. If the share with the
- same name already exists, the operation fails.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ def create(
+ self,
+ timeout=None, # type: Optional[int]
+ metadata=None, # type: Optional[str]
+ quota=None, # type: Optional[int]
+ access_tier=None, # type: Optional[Union[str, "_models.ShareAccessTier"]]
+ enabled_protocols=None, # type: Optional[str]
+ root_squash=None, # type: Optional[Union[str, "_models.ShareRootSquash"]]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """Creates a new share under the specified account. If the share with the same name already
+ exists, the operation fails.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param metadata: A name-value pair to associate with a file storage
- object.
+ :param metadata: A name-value pair to associate with a file storage object.
:type metadata: str
:param quota: Specifies the maximum size of the share, in gigabytes.
:type quota: int
- :param access_tier: Specifies the access tier of the share. Possible
- values include: 'TransactionOptimized', 'Hot', 'Cool'
- :type access_tier: str or
- ~azure.storage.fileshare.models.ShareAccessTier
+ :param access_tier: Specifies the access tier of the share.
+ :type access_tier: str or ~azure.storage.fileshare.models.ShareAccessTier
:param enabled_protocols: Protocols to enable on the share.
:type enabled_protocols: str
- :param root_squash: Root squash to set on the share. Only valid for
- NFS shares. Possible values include: 'NoRootSquash', 'RootSquash',
- 'AllSquash'
- :type root_squash: str or
- ~azure.storage.fileshare.models.ShareRootSquash
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param root_squash: Root squash to set on the share. Only valid for NFS shares.
+ :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "share"
+ accept = "application/xml"
+
# Construct URL
- url = self.create.metadata['url']
+ url = self.create.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
if metadata is not None:
header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
if quota is not None:
@@ -95,1256 +110,1397 @@ def create(self, timeout=None, metadata=None, quota=None, access_tier=None, enab
if enabled_protocols is not None:
header_parameters['x-ms-enabled-protocols'] = self._serialize.header("enabled_protocols", enabled_protocols, 'str')
if root_squash is not None:
- header_parameters['x-ms-root-squash'] = self._serialize.header("root_squash", root_squash, 'ShareRootSquash')
+ header_parameters['x-ms-root-squash'] = self._serialize.header("root_squash", root_squash, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- create.metadata = {'url': '/{shareName}'}
-
- def get_properties(self, sharesnapshot=None, timeout=None, lease_access_conditions=None, cls=None, **kwargs):
- """Returns all user-defined metadata and system properties for the
- specified share or share snapshot. The data returned does not include
- the share's list of files.
-
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
+ return cls(pipeline_response, None, response_headers)
+
+ create.metadata = {'url': '/{shareName}'} # type: ignore
+
+ def get_properties(
+ self,
+ sharesnapshot=None, # type: Optional[str]
+ timeout=None, # type: Optional[int]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """Returns all user-defined metadata and system properties for the specified share or share
+ snapshot. The data returned does not include the share's list of files.
+
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
:type sharesnapshot: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
+ _lease_id = lease_access_conditions.lease_id
+ restype = "share"
+ accept = "application/xml"
# Construct URL
- url = self.get_properties.metadata['url']
+ url = self.get_properties.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
if sharesnapshot is not None:
query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta'))
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-share-quota']=self._deserialize('int', response.headers.get('x-ms-share-quota'))
+ response_headers['x-ms-share-provisioned-iops']=self._deserialize('int', response.headers.get('x-ms-share-provisioned-iops'))
+ response_headers['x-ms-share-provisioned-ingress-mbps']=self._deserialize('int', response.headers.get('x-ms-share-provisioned-ingress-mbps'))
+ response_headers['x-ms-share-provisioned-egress-mbps']=self._deserialize('int', response.headers.get('x-ms-share-provisioned-egress-mbps'))
+ response_headers['x-ms-share-next-allowed-quota-downgrade-time']=self._deserialize('rfc-1123', response.headers.get('x-ms-share-next-allowed-quota-downgrade-time'))
+ response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration'))
+ response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state'))
+ response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status'))
+ response_headers['x-ms-access-tier']=self._deserialize('str', response.headers.get('x-ms-access-tier'))
+ response_headers['x-ms-access-tier-change-time']=self._deserialize('rfc-1123', response.headers.get('x-ms-access-tier-change-time'))
+ response_headers['x-ms-access-tier-transition-state']=self._deserialize('str', response.headers.get('x-ms-access-tier-transition-state'))
+ response_headers['x-ms-enabled-protocols']=self._deserialize('str', response.headers.get('x-ms-enabled-protocols'))
+ response_headers['x-ms-root-squash']=self._deserialize('str', response.headers.get('x-ms-root-squash'))
if cls:
- response_headers = {
- 'x-ms-meta': self._deserialize('{str}', response.headers.get('x-ms-meta')),
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-share-quota': self._deserialize('int', response.headers.get('x-ms-share-quota')),
- 'x-ms-share-provisioned-iops': self._deserialize('int', response.headers.get('x-ms-share-provisioned-iops')),
- 'x-ms-share-provisioned-ingress-mbps': self._deserialize('int', response.headers.get('x-ms-share-provisioned-ingress-mbps')),
- 'x-ms-share-provisioned-egress-mbps': self._deserialize('int', response.headers.get('x-ms-share-provisioned-egress-mbps')),
- 'x-ms-share-next-allowed-quota-downgrade-time': self._deserialize('rfc-1123', response.headers.get('x-ms-share-next-allowed-quota-downgrade-time')),
- 'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')),
- 'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')),
- 'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')),
- 'x-ms-access-tier': self._deserialize('str', response.headers.get('x-ms-access-tier')),
- 'x-ms-access-tier-change-time': self._deserialize('rfc-1123', response.headers.get('x-ms-access-tier-change-time')),
- 'x-ms-access-tier-transition-state': self._deserialize('str', response.headers.get('x-ms-access-tier-transition-state')),
- 'x-ms-enabled-protocols': self._deserialize('str', response.headers.get('x-ms-enabled-protocols')),
- 'x-ms-root-squash': self._deserialize(models.ShareRootSquash, response.headers.get('x-ms-root-squash')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- get_properties.metadata = {'url': '/{shareName}'}
-
- def delete(self, sharesnapshot=None, timeout=None, delete_snapshots=None, lease_access_conditions=None, cls=None, **kwargs):
- """Operation marks the specified share or share snapshot for deletion. The
- share or share snapshot and any files contained within it are later
- deleted during garbage collection.
-
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
+ return cls(pipeline_response, None, response_headers)
+
+ get_properties.metadata = {'url': '/{shareName}'} # type: ignore
+
+ def delete(
+ self,
+ sharesnapshot=None, # type: Optional[str]
+ timeout=None, # type: Optional[int]
+ delete_snapshots=None, # type: Optional[Union[str, "_models.DeleteSnapshotsOptionType"]]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """Operation marks the specified share or share snapshot for deletion. The share or share snapshot
+ and any files contained within it are later deleted during garbage collection.
+
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
:type sharesnapshot: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param delete_snapshots: Specifies the option include to delete the
- base share and all of its snapshots. Possible values include:
- 'include', 'include-leased'
- :type delete_snapshots: str or
- ~azure.storage.fileshare.models.DeleteSnapshotsOptionType
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param delete_snapshots: Specifies the option include to delete the base share and all of its
+ snapshots.
+ :type delete_snapshots: str or ~azure.storage.fileshare.models.DeleteSnapshotsOptionType
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
+ _lease_id = lease_access_conditions.lease_id
+ restype = "share"
+ accept = "application/xml"
# Construct URL
- url = self.delete.metadata['url']
+ url = self.delete.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
if sharesnapshot is not None:
query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
if delete_snapshots is not None:
- header_parameters['x-ms-delete-snapshots'] = self._serialize.header("delete_snapshots", delete_snapshots, 'DeleteSnapshotsOptionType')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ header_parameters['x-ms-delete-snapshots'] = self._serialize.header("delete_snapshots", delete_snapshots, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.delete(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- delete.metadata = {'url': '/{shareName}'}
-
- def acquire_lease(self, timeout=None, duration=None, proposed_lease_id=None, sharesnapshot=None, request_id=None, cls=None, **kwargs):
- """The Lease Share operation establishes and manages a lock on a share, or
- the specified snapshot for set and delete share operations.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ return cls(pipeline_response, None, response_headers)
+
+ delete.metadata = {'url': '/{shareName}'} # type: ignore
+
+ def acquire_lease(
+ self,
+ timeout=None, # type: Optional[int]
+ duration=None, # type: Optional[int]
+ proposed_lease_id=None, # type: Optional[str]
+ sharesnapshot=None, # type: Optional[str]
+ request_id_parameter=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """The Lease Share operation establishes and manages a lock on a share, or the specified snapshot
+ for set and delete share operations.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param duration: Specifies the duration of the lease, in seconds, or
- negative one (-1) for a lease that never expires. A non-infinite lease
- can be between 15 and 60 seconds. A lease duration cannot be changed
- using renew or change.
+ :param duration: Specifies the duration of the lease, in seconds, or negative one (-1) for a
+ lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease
+ duration cannot be changed using renew or change.
:type duration: int
- :param proposed_lease_id: Proposed lease ID, in a GUID string format.
- The File service returns 400 (Invalid request) if the proposed lease
- ID is not in the correct format. See Guid Constructor (String) for a
- list of valid GUID string formats.
+ :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns
+ 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid
+ Constructor (String) for a list of valid GUID string formats.
:type proposed_lease_id: str
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
:type sharesnapshot: str
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
comp = "lease"
action = "acquire"
+ restype = "share"
+ accept = "application/xml"
# Construct URL
- url = self.acquire_lease.metadata['url']
+ url = self.acquire_lease.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
if sharesnapshot is not None:
query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
if duration is not None:
header_parameters['x-ms-lease-duration'] = self._serialize.header("duration", duration, 'int')
if proposed_lease_id is not None:
header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- acquire_lease.metadata = {'url': '/{shareName}'}
-
- def release_lease(self, lease_id, timeout=None, sharesnapshot=None, request_id=None, cls=None, **kwargs):
- """The Lease Share operation establishes and manages a lock on a share, or
- the specified snapshot for set and delete share operations.
+ return cls(pipeline_response, None, response_headers)
+
+ acquire_lease.metadata = {'url': '/{shareName}'} # type: ignore
+
+ def release_lease(
+ self,
+ lease_id, # type: str
+ timeout=None, # type: Optional[int]
+ sharesnapshot=None, # type: Optional[str]
+ request_id_parameter=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """The Lease Share operation establishes and manages a lock on a share, or the specified snapshot
+ for set and delete share operations.
:param lease_id: Specifies the current lease ID on the resource.
:type lease_id: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
:type sharesnapshot: str
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
comp = "lease"
action = "release"
+ restype = "share"
+ accept = "application/xml"
# Construct URL
- url = self.release_lease.metadata['url']
+ url = self.release_lease.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
if sharesnapshot is not None:
query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- release_lease.metadata = {'url': '/{shareName}'}
-
- def change_lease(self, lease_id, timeout=None, proposed_lease_id=None, sharesnapshot=None, request_id=None, cls=None, **kwargs):
- """The Lease Share operation establishes and manages a lock on a share, or
- the specified snapshot for set and delete share operations.
+ return cls(pipeline_response, None, response_headers)
+
+ release_lease.metadata = {'url': '/{shareName}'} # type: ignore
+
+ def change_lease(
+ self,
+ lease_id, # type: str
+ timeout=None, # type: Optional[int]
+ proposed_lease_id=None, # type: Optional[str]
+ sharesnapshot=None, # type: Optional[str]
+ request_id_parameter=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """The Lease Share operation establishes and manages a lock on a share, or the specified snapshot
+ for set and delete share operations.
:param lease_id: Specifies the current lease ID on the resource.
:type lease_id: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param proposed_lease_id: Proposed lease ID, in a GUID string format.
- The File service returns 400 (Invalid request) if the proposed lease
- ID is not in the correct format. See Guid Constructor (String) for a
- list of valid GUID string formats.
+ :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns
+ 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid
+ Constructor (String) for a list of valid GUID string formats.
:type proposed_lease_id: str
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
:type sharesnapshot: str
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
comp = "lease"
action = "change"
+ restype = "share"
+ accept = "application/xml"
# Construct URL
- url = self.change_lease.metadata['url']
+ url = self.change_lease.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
if sharesnapshot is not None:
query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
if proposed_lease_id is not None:
header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- change_lease.metadata = {'url': '/{shareName}'}
-
- def renew_lease(self, lease_id, timeout=None, sharesnapshot=None, request_id=None, cls=None, **kwargs):
- """The Lease Share operation establishes and manages a lock on a share, or
- the specified snapshot for set and delete share operations.
+ return cls(pipeline_response, None, response_headers)
+
+ change_lease.metadata = {'url': '/{shareName}'} # type: ignore
+
+ def renew_lease(
+ self,
+ lease_id, # type: str
+ timeout=None, # type: Optional[int]
+ sharesnapshot=None, # type: Optional[str]
+ request_id_parameter=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """The Lease Share operation establishes and manages a lock on a share, or the specified snapshot
+ for set and delete share operations.
:param lease_id: Specifies the current lease ID on the resource.
:type lease_id: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
:type sharesnapshot: str
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
comp = "lease"
action = "renew"
+ restype = "share"
+ accept = "application/xml"
# Construct URL
- url = self.renew_lease.metadata['url']
+ url = self.renew_lease.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
if sharesnapshot is not None:
query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- renew_lease.metadata = {'url': '/{shareName}'}
-
- def break_lease(self, timeout=None, break_period=None, request_id=None, sharesnapshot=None, lease_access_conditions=None, cls=None, **kwargs):
- """The Lease Share operation establishes and manages a lock on a share, or
- the specified snapshot for set and delete share operations.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ return cls(pipeline_response, None, response_headers)
+
+ renew_lease.metadata = {'url': '/{shareName}'} # type: ignore
+
+ def break_lease(
+ self,
+ timeout=None, # type: Optional[int]
+ break_period=None, # type: Optional[int]
+ request_id_parameter=None, # type: Optional[str]
+ sharesnapshot=None, # type: Optional[str]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ """The Lease Share operation establishes and manages a lock on a share, or the specified snapshot
+ for set and delete share operations.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param break_period: For a break operation, proposed duration the
- lease should continue before it is broken, in seconds, between 0 and
- 60. This break period is only used if it is shorter than the time
- remaining on the lease. If longer, the time remaining on the lease is
- used. A new lease will not be available before the break period has
- expired, but the lease may be held for longer than the break period.
- If this header does not appear with a break operation, a
- fixed-duration lease breaks after the remaining lease period elapses,
- and an infinite lease breaks immediately.
+ :param break_period: For a break operation, proposed duration the lease should continue before
+ it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter
+ than the time remaining on the lease. If longer, the time remaining on the lease is used. A new
+ lease will not be available before the break period has expired, but the lease may be held for
+ longer than the break period. If this header does not appear with a break operation, a fixed-
+ duration lease breaks after the remaining lease period elapses, and an infinite lease breaks
+ immediately.
:type break_period: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param sharesnapshot: The snapshot parameter is an opaque DateTime
- value that, when present, specifies the share snapshot to query.
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present,
+ specifies the share snapshot to query.
:type sharesnapshot: str
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
+ _lease_id = lease_access_conditions.lease_id
comp = "lease"
action = "break"
+ restype = "share"
+ accept = "application/xml"
# Construct URL
- url = self.break_lease.metadata['url']
+ url = self.break_lease.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
if sharesnapshot is not None:
query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
if break_period is not None:
header_parameters['x-ms-lease-break-period'] = self._serialize.header("break_period", break_period, 'int')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
- header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-lease-time']=self._deserialize('int', response.headers.get('x-ms-lease-time'))
+ response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-lease-time': self._deserialize('int', response.headers.get('x-ms-lease-time')),
- 'x-ms-lease-id': self._deserialize('str', response.headers.get('x-ms-lease-id')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- break_lease.metadata = {'url': '/{shareName}'}
-
- def create_snapshot(self, timeout=None, metadata=None, cls=None, **kwargs):
+ return cls(pipeline_response, None, response_headers)
+
+ break_lease.metadata = {'url': '/{shareName}'} # type: ignore
+
+ def create_snapshot(
+ self,
+ timeout=None, # type: Optional[int]
+ metadata=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""Creates a read-only snapshot of a share.
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param metadata: A name-value pair to associate with a file storage
- object.
+ :param metadata: A name-value pair to associate with a file storage object.
:type metadata: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "share"
comp = "snapshot"
+ accept = "application/xml"
# Construct URL
- url = self.create_snapshot.metadata['url']
+ url = self.create_snapshot.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
if metadata is not None:
header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-snapshot']=self._deserialize('str', response.headers.get('x-ms-snapshot'))
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'x-ms-snapshot': self._deserialize('str', response.headers.get('x-ms-snapshot')),
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- create_snapshot.metadata = {'url': '/{shareName}'}
-
- def create_permission(self, share_permission, timeout=None, cls=None, **kwargs):
+ return cls(pipeline_response, None, response_headers)
+
+ create_snapshot.metadata = {'url': '/{shareName}'} # type: ignore
+
+ def create_permission(
+ self,
+ share_permission, # type: "_models.SharePermission"
+ timeout=None, # type: Optional[int]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""Create a permission (a security descriptor).
- :param share_permission: A permission (a security descriptor) at the
- share level.
- :type share_permission:
- ~azure.storage.fileshare.models.SharePermission
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param share_permission: A permission (a security descriptor) at the share level.
+ :type share_permission: ~azure.storage.fileshare.models.SharePermission
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "share"
comp = "filepermission"
+ content_type = kwargs.pop("content_type", "application/json")
+ accept = "application/xml"
# Construct URL
- url = self.create_permission.metadata['url']
+ url = self.create_permission.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['Content-Type'] = 'application/json; charset=utf-8'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct body
- body_content = self._serialize.body(share_permission, 'SharePermission', is_xml=False)
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters, body_content)
+ body_content_kwargs = {} # type: Dict[str, Any]
+ body_content = self._serialize.body(share_permission, 'SharePermission')
+ body_content_kwargs['content'] = body_content
+ request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key'))
if cls:
- response_headers = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-file-permission-key': self._deserialize('str', response.headers.get('x-ms-file-permission-key')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- create_permission.metadata = {'url': '/{shareName}'}
-
- def get_permission(self, file_permission_key, timeout=None, cls=None, **kwargs):
+ return cls(pipeline_response, None, response_headers)
+
+ create_permission.metadata = {'url': '/{shareName}'} # type: ignore
+
+ def get_permission(
+ self,
+ file_permission_key, # type: str
+ timeout=None, # type: Optional[int]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> "_models.SharePermission"
"""Returns the permission (security descriptor) for a given key.
- :param file_permission_key: Key of the permission to be set for the
- directory/file.
+ :param file_permission_key: Key of the permission to be set for the directory/file.
:type file_permission_key: str
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: SharePermission or the result of cls(response)
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: SharePermission, or the result of cls(response)
:rtype: ~azure.storage.fileshare.models.SharePermission
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharePermission"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "share"
comp = "filepermission"
+ accept = "application/json"
# Construct URL
- url = self.get_permission.metadata['url']
+ url = self.get_permission.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/json'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('SharePermission', response)
- header_dict = {
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('SharePermission', pipeline_response)
if cls:
- return cls(response, deserialized, header_dict)
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
- get_permission.metadata = {'url': '/{shareName}'}
-
- def set_properties(self, timeout=None, quota=None, access_tier=None, root_squash=None, lease_access_conditions=None, cls=None, **kwargs):
+ get_permission.metadata = {'url': '/{shareName}'} # type: ignore
+
+ def set_properties(
+ self,
+ timeout=None, # type: Optional[int]
+ quota=None, # type: Optional[int]
+ access_tier=None, # type: Optional[Union[str, "_models.ShareAccessTier"]]
+ root_squash=None, # type: Optional[Union[str, "_models.ShareRootSquash"]]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""Sets properties for the specified share.
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
:param quota: Specifies the maximum size of the share, in gigabytes.
:type quota: int
- :param access_tier: Specifies the access tier of the share. Possible
- values include: 'TransactionOptimized', 'Hot', 'Cool'
- :type access_tier: str or
- ~azure.storage.fileshare.models.ShareAccessTier
- :param root_squash: Root squash to set on the share. Only valid for
- NFS shares. Possible values include: 'NoRootSquash', 'RootSquash',
- 'AllSquash'
- :type root_squash: str or
- ~azure.storage.fileshare.models.ShareRootSquash
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param access_tier: Specifies the access tier of the share.
+ :type access_tier: str or ~azure.storage.fileshare.models.ShareAccessTier
+ :param root_squash: Root squash to set on the share. Only valid for NFS shares.
+ :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
+ _lease_id = lease_access_conditions.lease_id
+ restype = "share"
comp = "properties"
+ accept = "application/xml"
# Construct URL
- url = self.set_properties.metadata['url']
+ url = self.set_properties.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
if quota is not None:
header_parameters['x-ms-share-quota'] = self._serialize.header("quota", quota, 'int', minimum=1)
if access_tier is not None:
header_parameters['x-ms-access-tier'] = self._serialize.header("access_tier", access_tier, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
if root_squash is not None:
- header_parameters['x-ms-root-squash'] = self._serialize.header("root_squash", root_squash, 'ShareRootSquash')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ header_parameters['x-ms-root-squash'] = self._serialize.header("root_squash", root_squash, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_properties.metadata = {'url': '/{shareName}'}
-
- def set_metadata(self, timeout=None, metadata=None, lease_access_conditions=None, cls=None, **kwargs):
+ return cls(pipeline_response, None, response_headers)
+
+ set_properties.metadata = {'url': '/{shareName}'} # type: ignore
+
+ def set_metadata(
+ self,
+ timeout=None, # type: Optional[int]
+ metadata=None, # type: Optional[str]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""Sets one or more user-defined name-value pairs for the specified share.
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param metadata: A name-value pair to associate with a file storage
- object.
+ :param metadata: A name-value pair to associate with a file storage object.
:type metadata: str
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
+ _lease_id = lease_access_conditions.lease_id
+ restype = "share"
comp = "metadata"
+ accept = "application/xml"
# Construct URL
- url = self.set_metadata.metadata['url']
+ url = self.set_metadata.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
if metadata is not None:
header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_metadata.metadata = {'url': '/{shareName}'}
-
- def get_access_policy(self, timeout=None, lease_access_conditions=None, cls=None, **kwargs):
- """Returns information about stored access policies specified on the
- share.
-
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ return cls(pipeline_response, None, response_headers)
+
+ set_metadata.metadata = {'url': '/{shareName}'} # type: ignore
+
+ def get_access_policy(
+ self,
+ timeout=None, # type: Optional[int]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> List["_models.SignedIdentifier"]
+ """Returns information about stored access policies specified on the share.
+
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: list or the result of cls(response)
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: list of SignedIdentifier, or the result of cls(response)
:rtype: list[~azure.storage.fileshare.models.SignedIdentifier]
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType[List["_models.SignedIdentifier"]]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
+ _lease_id = lease_access_conditions.lease_id
+ restype = "share"
comp = "acl"
+ accept = "application/xml"
# Construct URL
- url = self.get_access_policy.metadata['url']
+ url = self.get_access_policy.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('[SignedIdentifier]', response)
- header_dict = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('[SignedIdentifier]', pipeline_response)
if cls:
- return cls(response, deserialized, header_dict)
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
- get_access_policy.metadata = {'url': '/{shareName}'}
-
- def set_access_policy(self, share_acl=None, timeout=None, lease_access_conditions=None, cls=None, **kwargs):
+ get_access_policy.metadata = {'url': '/{shareName}'} # type: ignore
+
+ def set_access_policy(
+ self,
+ timeout=None, # type: Optional[int]
+ share_acl=None, # type: Optional[List["_models.SignedIdentifier"]]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""Sets a stored access policy for use with shared access signatures.
- :param share_acl: The ACL for the share.
- :type share_acl:
- list[~azure.storage.fileshare.models.SignedIdentifier]
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :param share_acl: The ACL for the share.
+ :type share_acl: list[~azure.storage.fileshare.models.SignedIdentifier]
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
+ _lease_id = lease_access_conditions.lease_id
+ restype = "share"
comp = "acl"
+ content_type = kwargs.pop("content_type", "application/xml")
+ accept = "application/xml"
# Construct URL
- url = self.set_access_policy.metadata['url']
+ url = self.set_access_policy.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['Content-Type'] = 'application/xml; charset=utf-8'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct body
- serialization_ctxt = {'xml': {'name': 'SignedIdentifiers', 'itemsName': 'SignedIdentifier', 'wrapped': True}}
+ body_content_kwargs = {} # type: Dict[str, Any]
+ serialization_ctxt = {'xml': {'name': 'SignedIdentifiers', 'wrapped': True}}
if share_acl is not None:
- body_content = self._serialize.body(share_acl, '[SignedIdentifier]', serialization_ctxt=serialization_ctxt)
+ body_content = self._serialize.body(share_acl, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt)
else:
body_content = None
-
- # Construct and send request
- request = self._client.put(url, query_parameters, header_parameters, body_content)
+ body_content_kwargs['content'] = body_content
+ request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- set_access_policy.metadata = {'url': '/{shareName}'}
-
- def get_statistics(self, timeout=None, lease_access_conditions=None, cls=None, **kwargs):
+ return cls(pipeline_response, None, response_headers)
+
+ set_access_policy.metadata = {'url': '/{shareName}'} # type: ignore
+
+ def get_statistics(
+ self,
+ timeout=None, # type: Optional[int]
+ lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> "_models.ShareStats"
"""Retrieves statistics related to the share.
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param lease_access_conditions: Additional parameters for the
- operation
- :type lease_access_conditions:
- ~azure.storage.fileshare.models.LeaseAccessConditions
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: ShareStats or the result of cls(response)
+ :param lease_access_conditions: Parameter group.
+ :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ShareStats, or the result of cls(response)
:rtype: ~azure.storage.fileshare.models.ShareStats
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
- lease_id = None
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareStats"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+
+ _lease_id = None
if lease_access_conditions is not None:
- lease_id = lease_access_conditions.lease_id
-
+ _lease_id = lease_access_conditions.lease_id
+ restype = "share"
comp = "stats"
+ accept = "application/xml"
# Construct URL
- url = self.get_statistics.metadata['url']
+ url = self.get_statistics.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
- header_parameters['Accept'] = 'application/xml'
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if lease_id is not None:
- header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')
+ if _lease_id is not None:
+ header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
-
- header_dict = {}
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize('ShareStats', response)
- header_dict = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
+ deserialized = self._deserialize('ShareStats', pipeline_response)
if cls:
- return cls(response, deserialized, header_dict)
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
- get_statistics.metadata = {'url': '/{shareName}'}
-
- def restore(self, timeout=None, request_id=None, deleted_share_name=None, deleted_share_version=None, cls=None, **kwargs):
+ get_statistics.metadata = {'url': '/{shareName}'} # type: ignore
+
+ def restore(
+ self,
+ timeout=None, # type: Optional[int]
+ request_id_parameter=None, # type: Optional[str]
+ deleted_share_name=None, # type: Optional[str]
+ deleted_share_version=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
"""Restores a previously deleted Share.
- :param timeout: The timeout parameter is expressed in seconds. For
- more information, see Setting
- Timeouts for File Service Operations.
+ :param timeout: The timeout parameter is expressed in seconds. For more information, see
+ :code:`Setting Timeouts for File Service
+ Operations.`.
:type timeout: int
- :param request_id: Provides a client-generated, opaque value with a 1
- KB character limit that is recorded in the analytics logs when storage
- analytics logging is enabled.
- :type request_id: str
- :param deleted_share_name: Specifies the name of the
- preivously-deleted share.
+ :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
+ limit that is recorded in the analytics logs when storage analytics logging is enabled.
+ :type request_id_parameter: str
+ :param deleted_share_name: Specifies the name of the preivously-deleted share.
:type deleted_share_name: str
- :param deleted_share_version: Specifies the version of the
- preivously-deleted share.
+ :param deleted_share_version: Specifies the version of the preivously-deleted share.
:type deleted_share_version: str
- :param callable cls: A custom type or function that will be passed the
- direct response
- :return: None or the result of cls(response)
+ :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
- :raises:
- :class:`StorageErrorException`
+ :raises: ~azure.core.exceptions.HttpResponseError
"""
- error_map = kwargs.pop('error_map', None)
+ cls = kwargs.pop('cls', None) # type: ClsType[None]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ restype = "share"
comp = "undelete"
+ accept = "application/xml"
# Construct URL
- url = self.restore.metadata['url']
+ url = self.restore.metadata['url'] # type: ignore
path_format_arguments = {
- 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
- query_parameters = {}
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['restype'] = self._serialize.query("restype", restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
if timeout is not None:
query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
- query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
- query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
# Construct headers
- header_parameters = {}
+ header_parameters = {} # type: Dict[str, Any]
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
- if request_id is not None:
- header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
+ if request_id_parameter is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str')
if deleted_share_name is not None:
header_parameters['x-ms-deleted-share-name'] = self._serialize.header("deleted_share_name", deleted_share_name, 'str')
if deleted_share_version is not None:
header_parameters['x-ms-deleted-share-version'] = self._serialize.header("deleted_share_version", deleted_share_version, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
- # Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
- raise models.StorageErrorException(response, self._deserialize)
+ error = self._deserialize(_models.StorageError, response)
+ raise HttpResponseError(response=response, model=error)
+
+ response_headers = {}
+ response_headers['ETag']=self._deserialize('str', response.headers.get('ETag'))
+ response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified'))
+ response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id'))
+ response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id'))
+ response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version'))
+ response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
if cls:
- response_headers = {
- 'ETag': self._deserialize('str', response.headers.get('ETag')),
- 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
- 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
- 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
- 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
- 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
- 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
- }
- return cls(response, None, response_headers)
- restore.metadata = {'url': '/{shareName}'}
+ return cls(pipeline_response, None, response_headers)
+
+ restore.metadata = {'url': '/{shareName}'} # type: ignore
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/py.typed b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/py.typed
new file mode 100644
index 000000000000..e5aff4f83af8
--- /dev/null
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/py.typed
@@ -0,0 +1 @@
+# Marker file for PEP 561.
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/version.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/version.py
deleted file mode 100644
index 61ca5b37e14a..000000000000
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/version.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# coding=utf-8
-# --------------------------------------------------------------------------
-# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for
-# license information.
-#
-# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is
-# regenerated.
-# --------------------------------------------------------------------------
-
-VERSION = "2020-04-08"
-
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_lease.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_lease.py
index dd5ebe6a543b..61b1d9061978 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_lease.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_lease.py
@@ -11,9 +11,9 @@
)
from azure.core.tracing.decorator import distributed_trace
+from azure.core.exceptions import HttpResponseError
from ._shared.response_handlers import return_response_headers, process_storage_error
-from ._generated.models import StorageErrorException
from ._generated.operations import FileOperations, ShareOperations
if TYPE_CHECKING:
@@ -92,7 +92,7 @@ def acquire(self, **kwargs):
proposed_lease_id=self.id,
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
self.id = response.get('lease_id') # type: str
self.last_modified = response.get('last_modified') # type: datetime
@@ -124,7 +124,7 @@ def _renew(self, **kwargs):
sharesnapshot=self._snapshot,
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
self.etag = response.get('etag') # type: str
self.id = response.get('lease_id') # type: str
@@ -149,7 +149,7 @@ def release(self, **kwargs):
timeout=kwargs.pop('timeout', None),
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
self.etag = response.get('etag') # type: str
self.id = response.get('lease_id') # type: str
@@ -177,7 +177,7 @@ def change(self, proposed_lease_id, **kwargs):
timeout=kwargs.pop('timeout', None),
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
self.etag = response.get('etag') # type: str
self.id = response.get('lease_id') # type: str
@@ -212,6 +212,6 @@ def break_lease(self, **kwargs):
timeout=kwargs.pop('timeout', None),
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
return response.get('lease_time') # type: ignore
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py
index e72ffdf3ac74..796b43b2e33b 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py
@@ -9,10 +9,10 @@
from enum import Enum
from azure.core.paging import PageIterator
+from azure.core.exceptions import HttpResponseError
from ._parser import _parse_datetime_from_str
from ._shared.response_handlers import return_context_and_deserialized, process_storage_error
from ._shared.models import DictMixin, get_enum_value
-from ._generated.models import StorageErrorException
from ._generated.models import Metrics as GeneratedMetrics
from ._generated.models import RetentionPolicy as GeneratedRetentionPolicy
from ._generated.models import CorsRule as GeneratedCorsRule
@@ -375,8 +375,8 @@ def _from_generated(cls, generated):
props.deleted_time = generated.properties.deleted_time
props.version = generated.version
props.remaining_retention_days = generated.properties.remaining_retention_days
- props.provisioned_egress_mbps = generated.properties.provisioned_egress_mbps
- props.provisioned_ingress_mbps = generated.properties.provisioned_ingress_mbps
+ props.provisioned_egress_mbps = generated.properties.provisioned_egress_m_bps
+ props.provisioned_ingress_mbps = generated.properties.provisioned_ingress_m_bps
props.provisioned_iops = generated.properties.provisioned_iops
props.lease = LeaseProperties._from_generated(generated) # pylint: disable=protected-access
props.protocols = [protocol.strip() for protocol in generated.properties.enabled_protocols.split(',')]\
@@ -428,7 +428,7 @@ def _get_next_cb(self, continuation_token):
prefix=self.prefix,
cls=return_context_and_deserialized,
use_location=self.location_mode)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
def _extract_data_cb(self, get_next_return):
@@ -520,7 +520,7 @@ def _get_next_cb(self, continuation_token):
maxresults=self.results_per_page,
cls=return_context_and_deserialized,
use_location=self.location_mode)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
def _extract_data_cb(self, get_next_return):
@@ -634,7 +634,7 @@ def _get_next_cb(self, continuation_token):
maxresults=self.results_per_page,
cls=return_context_and_deserialized,
use_location=self.location_mode)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
def _extract_data_cb(self, get_next_return):
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py
index 9b1a47f829d1..115843d6384c 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py
@@ -7,6 +7,8 @@
from typing import ( # pylint: disable=unused-import
Optional, Union, Dict, Any, Iterable, TYPE_CHECKING
)
+
+
try:
from urllib.parse import urlparse, quote, unquote
except ImportError:
@@ -14,6 +16,7 @@
from urllib2 import quote, unquote # type: ignore
import six
+from azure.core.exceptions import HttpResponseError
from azure.core.tracing.decorator import distributed_trace
from azure.core.pipeline import Pipeline
from ._shared.base_client import StorageAccountHostsMixin, TransportWrapper, parse_connection_str, parse_query
@@ -23,9 +26,7 @@
process_storage_error,
return_headers_and_deserialized)
from ._generated import AzureFileStorage
-from ._generated.version import VERSION
from ._generated.models import (
- StorageErrorException,
SignedIdentifier,
DeleteSnapshotsOptionType,
SharePermission)
@@ -108,8 +109,9 @@ def __init__( # type: ignore
self._query_str, credential = self._format_query_string(
sas_token, credential, share_snapshot=self.snapshot)
super(ShareClient, self).__init__(parsed_url, service='file-share', credential=credential, **kwargs)
- self._client = AzureFileStorage(version=VERSION, url=self.url, pipeline=self._pipeline)
- self._client._config.version = get_api_version(kwargs, VERSION) # pylint: disable=protected-access
+ self._client = AzureFileStorage(url=self.url, pipeline=self._pipeline)
+ default_api_version = self._client._config.version # pylint: disable=protected-access
+ self._client._config.version = get_api_version(kwargs, default_api_version) # pylint: disable=protected-access
@classmethod
def from_share_url(cls, share_url, # type: str
@@ -359,7 +361,7 @@ def create_share(self, **kwargs):
cls=return_response_headers,
headers=headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -404,7 +406,7 @@ def create_snapshot( # type: ignore
cls=return_response_headers,
headers=headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -440,7 +442,7 @@ def delete_share(
sharesnapshot=self.snapshot,
delete_snapshots=delete_include,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -471,7 +473,7 @@ def get_share_properties(self, **kwargs):
sharesnapshot=self.snapshot,
cls=deserialize_share_properties,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
props.name = self.share_name
props.snapshot = self.snapshot
@@ -507,7 +509,7 @@ def set_share_quota(self, quota, **kwargs):
access_tier=None,
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -556,7 +558,7 @@ def set_share_properties(self, **kwargs):
root_squash=root_squash,
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -594,7 +596,7 @@ def set_share_metadata(self, metadata, **kwargs):
cls=return_response_headers,
headers=headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -614,7 +616,7 @@ def get_share_access_policy(self, **kwargs):
timeout=timeout,
cls=return_headers_and_deserialized,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
return {
'public_access': response.get('share_public_access'),
@@ -656,7 +658,7 @@ def set_share_access_policy(self, signed_identifiers, **kwargs):
timeout=timeout,
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -678,7 +680,7 @@ def get_share_stats(self, **kwargs):
timeout=timeout,
**kwargs)
return stats.share_usage_bytes # type: ignore
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -752,7 +754,7 @@ def create_permission_for_share(self, file_permission, # type: str
options = self._create_permission_for_share_options(file_permission, timeout=timeout, **kwargs)
try:
return self._client.share.create_permission(**options)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -779,7 +781,7 @@ def get_permission_for_share( # type: ignore
cls=deserialize_permission,
timeout=timeout,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_service_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_service_client.py
index d6b240e9efa7..3dfe9937f4c4 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_service_client.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_service_client.py
@@ -9,19 +9,21 @@
Union, Optional, Any, Dict, List,
TYPE_CHECKING
)
+
+
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse # type: ignore
+from azure.core.exceptions import HttpResponseError
from azure.core.paging import ItemPaged
from azure.core.tracing.decorator import distributed_trace
from azure.core.pipeline import Pipeline
from ._shared.base_client import StorageAccountHostsMixin, TransportWrapper, parse_connection_str, parse_query
from ._shared.response_handlers import process_storage_error
from ._generated import AzureFileStorage
-from ._generated.models import StorageErrorException, StorageServiceProperties
-from ._generated.version import VERSION
+from ._generated.models import StorageServiceProperties
from ._share_client import ShareClient
from ._serialize import get_api_version
from ._models import (
@@ -97,8 +99,9 @@ def __init__(
'You need to provide either an account shared key or SAS token when creating a storage service.')
self._query_str, credential = self._format_query_string(sas_token, credential)
super(ShareServiceClient, self).__init__(parsed_url, service='file-share', credential=credential, **kwargs)
- self._client = AzureFileStorage(version=VERSION, url=self.url, pipeline=self._pipeline)
- self._client._config.version = get_api_version(kwargs, VERSION) # pylint: disable=protected-access
+ self._client = AzureFileStorage(url=self.url, pipeline=self._pipeline)
+ default_api_version = self._client._config.version # pylint: disable=protected-access
+ self._client._config.version = get_api_version(kwargs, default_api_version) # pylint: disable=protected-access
def _format_url(self, hostname):
"""Format the endpoint URL according to the current location
@@ -162,7 +165,7 @@ def get_service_properties(self, **kwargs):
try:
service_props = self._client.service.get_properties(timeout=timeout, **kwargs)
return service_properties_deserialize(service_props)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -216,7 +219,7 @@ def set_service_properties(
)
try:
self._client.service.set_properties(storage_service_properties=props, timeout=timeout, **kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -373,7 +376,7 @@ def undelete_share(self, deleted_share_name, deleted_share_version, **kwargs):
deleted_share_version=deleted_share_version,
timeout=kwargs.pop('timeout', None), **kwargs)
return share
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
def get_share_client(self, share, snapshot=None):
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client.py
index 6b647b7afdf6..0483d21c3c33 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client.py
@@ -54,7 +54,6 @@
ExponentialRetry,
)
from .._version import VERSION
-from .._generated.models import StorageErrorException
from .response_handlers import process_storage_error, PartialBatchErrorException
@@ -298,7 +297,7 @@ def _batch_send(
raise error
return iter(parts)
return parts
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
class TransportWrapper(HttpTransport):
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client_async.py
index d252ad063fb6..c1d860a93927 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client_async.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client_async.py
@@ -33,7 +33,6 @@
)
from .policies_async import AsyncStorageResponseHook
-from .._generated.models import StorageErrorException
from .response_handlers import process_storage_error, PartialBatchErrorException
if TYPE_CHECKING:
@@ -151,7 +150,7 @@ async def _batch_send(
raise error
return AsyncList(parts_list)
return parts
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/constants.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/constants.py
index 7fb05b559850..66f9a47d1e3d 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/constants.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/constants.py
@@ -5,10 +5,10 @@
# --------------------------------------------------------------------------
import sys
-from .._generated.version import VERSION
+from .._generated import AzureFileStorage
-X_MS_VERSION = VERSION
+X_MS_VERSION = AzureFileStorage(url="get_api_version")._config.version # pylint: disable=protected-access
# Socket timeout in seconds
CONNECTION_TIMEOUT = 20
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/response_handlers.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/response_handlers.py
index ac526e594161..00ef0c6053a5 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/response_handlers.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/response_handlers.py
@@ -67,7 +67,7 @@ def normalize_headers(headers):
def deserialize_metadata(response, obj, headers): # pylint: disable=unused-argument
- raw_metadata = {k: v for k, v in response.headers.items() if k.startswith("x-ms-meta-")}
+ raw_metadata = {k: v for k, v in response.http_response.headers.items() if k.startswith("x-ms-meta-")}
return {k[10:]: v for k, v in raw_metadata.items()}
@@ -80,7 +80,7 @@ def return_headers_and_deserialized(response, deserialized, response_headers):
def return_context_and_deserialized(response, deserialized, response_headers): # pylint: disable=unused-argument
- return response.location_mode, deserialized
+ return response.http_response.location_mode, deserialized
def process_storage_error(storage_error):
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py
index 29b63969fbfe..0202e629a7d8 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py
@@ -11,6 +11,7 @@
)
from azure.core.async_paging import AsyncItemPaged
+from azure.core.exceptions import HttpResponseError
from azure.core.pipeline import AsyncPipeline
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
@@ -18,8 +19,6 @@
from .._shared.parser import _str
from .._generated.aio import AzureFileStorage
-from .._generated.version import VERSION
-from .._generated.models import StorageErrorException
from .._shared.base_client_async import AsyncStorageAccountHostsMixin, AsyncTransportWrapper
from .._shared.policies_async import ExponentialRetry
from .._shared.request_handlers import add_metadata_headers
@@ -89,8 +88,9 @@ def __init__( # type: ignore
credential=credential,
loop=loop,
**kwargs)
- self._client = AzureFileStorage(version=VERSION, url=self.url, pipeline=self._pipeline, loop=loop)
- self._client._config.version = get_api_version(kwargs, VERSION) # pylint: disable=protected-access
+ self._client = AzureFileStorage(url=self.url, pipeline=self._pipeline, loop=loop)
+ default_api_version = self._client._config.version # pylint: disable=protected-access
+ self._client._config.version = get_api_version(kwargs, default_api_version) # pylint: disable=protected-access
self._loop = loop
def get_file_client(self, file_name, **kwargs):
@@ -178,7 +178,7 @@ async def create_directory(self, **kwargs):
cls=return_response_headers,
headers=headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -203,7 +203,7 @@ async def delete_directory(self, **kwargs):
timeout = kwargs.pop('timeout', None)
try:
await self._client.directory.delete(timeout=timeout, **kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -297,7 +297,7 @@ async def close_handle(self, handle, **kwargs):
'closed_handles_count': response.get('number_of_handles_closed', 0),
'failed_handles_count': response.get('number_of_handles_failed', 0)
}
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -334,7 +334,7 @@ async def close_all_handles(self, recursive=False, **kwargs):
cls=return_response_headers,
**kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
continuation_token = response.get('marker')
try_close = bool(continuation_token)
@@ -365,7 +365,7 @@ async def get_directory_properties(self, **kwargs):
timeout=timeout,
cls=deserialize_directory_properties,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
return response # type: ignore
@@ -395,7 +395,7 @@ async def set_directory_metadata(self, metadata, **kwargs):
cls=return_response_headers,
headers=headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -448,7 +448,7 @@ async def set_http_headers(self, file_attributes="none", # type: Union[str, NTF
timeout=timeout,
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py
index d008e1bc6539..e7ec5bd104d7 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py
@@ -11,6 +11,7 @@
import six
from azure.core.async_paging import AsyncItemPaged
+from azure.core.exceptions import HttpResponseError
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
@@ -18,8 +19,7 @@
from .._shared.parser import _str
from .._generated.aio import AzureFileStorage
-from .._generated.version import VERSION
-from .._generated.models import StorageErrorException, FileHTTPHeaders
+from .._generated.models import FileHTTPHeaders
from .._shared.policies_async import ExponentialRetry
from .._shared.uploads_async import upload_data_chunks, FileChunkUploader, IterStreamer
from .._shared.base_client_async import AsyncStorageAccountHostsMixin
@@ -83,7 +83,7 @@ async def _upload_file_helper(
**kwargs
)
return sorted(responses, key=lambda r: r.get('last_modified'))[-1]
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@@ -135,8 +135,9 @@ def __init__( # type: ignore
account_url, share_name=share_name, file_path=file_path, snapshot=snapshot,
credential=credential, loop=loop, **kwargs
)
- self._client = AzureFileStorage(version=VERSION, url=self.url, pipeline=self._pipeline, loop=loop)
- self._client._config.version = get_api_version(kwargs, VERSION) # pylint: disable=protected-access
+ self._client = AzureFileStorage(url=self.url, pipeline=self._pipeline, loop=loop)
+ default_api_version = self._client._config.version # pylint: disable=protected-access
+ self._client._config.version = get_api_version(kwargs, default_api_version) # pylint: disable=protected-access
self._loop = loop
@distributed_trace_async
@@ -273,7 +274,7 @@ async def create_file( # type: ignore
cls=return_response_headers,
**kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -510,7 +511,7 @@ async def start_copy_from_url(self, source_url, **kwargs):
timeout=timeout,
**kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -549,7 +550,7 @@ async def abort_copy(self, copy_id, **kwargs):
await self._client.file.abort_copy(copy_id=copy_id,
lease_access_conditions=access_conditions,
timeout=timeout, **kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -656,7 +657,7 @@ async def delete_file(self, **kwargs):
timeout = kwargs.pop('timeout', None)
try:
await self._client.file.delete(lease_access_conditions=access_conditions, timeout=timeout, **kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -687,7 +688,7 @@ async def get_file_properties(self, **kwargs):
cls=deserialize_file_properties,
**kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
file_props.name = self.file_name
file_props.share = self.share_name
@@ -770,7 +771,7 @@ async def set_http_headers(self, content_settings, # type: ContentSettings
cls=return_response_headers,
**kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -807,7 +808,7 @@ async def set_file_metadata(self, metadata=None, **kwargs): # type: ignore
metadata=metadata, lease_access_conditions=access_conditions,
timeout=timeout, cls=return_response_headers, headers=headers, **kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -871,7 +872,7 @@ async def upload_range( # type: ignore
cls=return_response_headers,
**kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -922,7 +923,7 @@ async def upload_range_from_url(self, source_url,
)
try:
return await self._client.file.upload_range_from_url(**options) # type: ignore
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -958,7 +959,7 @@ async def get_ranges( # type: ignore
**kwargs)
try:
ranges = await self._client.file.get_range_list(**options)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
return [{'start': file_range.start, 'end': file_range.end} for file_range in ranges.ranges]
@@ -1002,7 +1003,7 @@ async def get_ranges_diff( # type: ignore
**kwargs)
try:
ranges = await self._client.file.get_range_list(**options)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
return get_file_ranges_result(ranges)
@@ -1051,12 +1052,13 @@ async def clear_range( # type: ignore
timeout=timeout,
cls=return_response_headers,
content_length=0,
+ optionalbody=None,
file_range_write="clear",
range=content_range,
lease_access_conditions=access_conditions,
**kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -1092,7 +1094,7 @@ async def resize_file(self, size, **kwargs):
timeout=timeout,
**kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -1149,7 +1151,7 @@ async def close_handle(self, handle, **kwargs):
'closed_handles_count': response.get('number_of_handles_closed', 0),
'failed_handles_count': response.get('number_of_handles_failed', 0)
}
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -1183,7 +1185,7 @@ async def close_all_handles(self, **kwargs):
cls=return_response_headers,
**kwargs
)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
continuation_token = response.get('marker')
try_close = bool(continuation_token)
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_lease_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_lease_async.py
index 4f42fdc4b664..82c1550ac2df 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_lease_async.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_lease_async.py
@@ -9,12 +9,11 @@
TypeVar, TYPE_CHECKING
)
+from azure.core.exceptions import HttpResponseError
from azure.core.tracing.decorator_async import distributed_trace_async
from .._shared.response_handlers import return_response_headers, process_storage_error
-from .._generated.models import (
- StorageErrorException)
-from .._generated.aio.operations_async import FileOperations, ShareOperations
+from .._generated.aio.operations import FileOperations, ShareOperations
from .._lease import ShareLeaseClient as LeaseClientBase
if TYPE_CHECKING:
@@ -84,7 +83,7 @@ async def acquire(self, **kwargs):
proposed_lease_id=self.id,
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
self.id = response.get('lease_id') # type: str
self.last_modified = response.get('last_modified') # type: datetime
@@ -116,7 +115,7 @@ async def _renew(self, **kwargs):
sharesnapshot=self._snapshot,
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
self.etag = response.get('etag') # type: str
self.id = response.get('lease_id') # type: str
@@ -141,7 +140,7 @@ async def release(self, **kwargs):
timeout=kwargs.pop('timeout', None),
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
self.etag = response.get('etag') # type: str
self.id = response.get('lease_id') # type: str
@@ -169,7 +168,7 @@ async def change(self, proposed_lease_id, **kwargs):
timeout=kwargs.pop('timeout', None),
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
self.etag = response.get('etag') # type: str
self.id = response.get('lease_id') # type: str
@@ -204,6 +203,6 @@ async def break_lease(self, **kwargs):
timeout=kwargs.pop('timeout', None),
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
return response.get('lease_time') # type: ignore
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_models.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_models.py
index affee8fb41f4..ceca247f915b 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_models.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_models.py
@@ -7,9 +7,9 @@
# pylint: disable=super-init-not-called, too-many-lines
from azure.core.async_paging import AsyncPageIterator
+from azure.core.exceptions import HttpResponseError
from .._shared.response_handlers import return_context_and_deserialized, process_storage_error
-from .._generated.models import StorageErrorException
from .._generated.models import DirectoryItem
from .._models import Handle, ShareProperties
@@ -61,7 +61,7 @@ async def _get_next_cb(self, continuation_token):
maxresults=self.results_per_page,
cls=return_context_and_deserialized,
use_location=self.location_mode)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
async def _extract_data_cb(self, get_next_return):
@@ -109,7 +109,7 @@ async def _get_next_cb(self, continuation_token):
maxresults=self.results_per_page,
cls=return_context_and_deserialized,
use_location=self.location_mode)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
async def _extract_data_cb(self, get_next_return):
@@ -164,7 +164,7 @@ async def _get_next_cb(self, continuation_token):
maxresults=self.results_per_page,
cls=return_context_and_deserialized,
use_location=self.location_mode)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
async def _extract_data_cb(self, get_next_return):
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py
index fd9d92a19e6c..755f96c6cb14 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py
@@ -8,6 +8,7 @@
Optional, Union, Dict, Any, Iterable, TYPE_CHECKING
)
+from azure.core.exceptions import HttpResponseError
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.pipeline import AsyncPipeline
@@ -19,9 +20,7 @@
process_storage_error,
return_headers_and_deserialized)
from .._generated.aio import AzureFileStorage
-from .._generated.version import VERSION
from .._generated.models import (
- StorageErrorException,
SignedIdentifier,
DeleteSnapshotsOptionType)
from .._deserialize import deserialize_share_properties, deserialize_permission
@@ -84,8 +83,9 @@ def __init__( # type: ignore
credential=credential,
loop=loop,
**kwargs)
- self._client = AzureFileStorage(version=VERSION, url=self.url, pipeline=self._pipeline, loop=loop)
- self._client._config.version = get_api_version(kwargs, VERSION) # pylint: disable=protected-access
+ self._client = AzureFileStorage(url=self.url, pipeline=self._pipeline, loop=loop)
+ default_api_version = self._client._config.version # pylint: disable=protected-access
+ self._client._config.version = get_api_version(kwargs, default_api_version) # pylint: disable=protected-access
self._loop = loop
def get_directory_client(self, directory_path=None):
@@ -228,7 +228,7 @@ async def create_share(self, **kwargs):
cls=return_response_headers,
headers=headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -273,7 +273,7 @@ async def create_snapshot( # type: ignore
cls=return_response_headers,
headers=headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -308,7 +308,7 @@ async def delete_share(
sharesnapshot=self.snapshot,
delete_snapshots=delete_include,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -339,7 +339,7 @@ async def get_share_properties(self, **kwargs):
sharesnapshot=self.snapshot,
cls=deserialize_share_properties,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
props.name = self.share_name
props.snapshot = self.snapshot
@@ -375,7 +375,7 @@ async def set_share_quota(self, quota, **kwargs):
access_tier=None,
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
async def set_share_properties(self, **kwargs):
@@ -423,7 +423,7 @@ async def set_share_properties(self, **kwargs):
root_squash=root_squash,
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -461,7 +461,7 @@ async def set_share_metadata(self, metadata, **kwargs):
cls=return_response_headers,
headers=headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -481,7 +481,7 @@ async def get_share_access_policy(self, **kwargs):
timeout=timeout,
cls=return_headers_and_deserialized,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
return {
'public_access': response.get('share_public_access'),
@@ -524,7 +524,7 @@ async def set_share_access_policy(self, signed_identifiers, **kwargs):
timeout=timeout,
cls=return_response_headers,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -546,7 +546,7 @@ async def get_share_stats(self, **kwargs):
timeout=timeout,
**kwargs)
return stats.share_usage_bytes # type: ignore
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -608,7 +608,7 @@ async def create_permission_for_share(self, file_permission, # type: str
options = self._create_permission_for_share_options(file_permission, timeout=timeout, **kwargs)
try:
return await self._client.share.create_permission(**options)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -635,7 +635,7 @@ async def get_permission_for_share( # type: ignore
cls=deserialize_permission,
timeout=timeout,
**kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_service_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_service_client_async.py
index af67dcd83213..d64f3eb50391 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_service_client_async.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_service_client_async.py
@@ -11,6 +11,7 @@
)
from azure.core.async_paging import AsyncItemPaged
+from azure.core.exceptions import HttpResponseError
from azure.core.tracing.decorator import distributed_trace
from azure.core.pipeline import AsyncPipeline
from azure.core.tracing.decorator_async import distributed_trace_async
@@ -19,8 +20,7 @@
from .._shared.response_handlers import process_storage_error
from .._shared.policies_async import ExponentialRetry
from .._generated.aio import AzureFileStorage
-from .._generated.models import StorageErrorException, StorageServiceProperties
-from .._generated.version import VERSION
+from .._generated.models import StorageServiceProperties
from .._share_service_client import ShareServiceClient as ShareServiceClientBase
from .._serialize import get_api_version
from ._share_client_async import ShareClient
@@ -88,8 +88,9 @@ def __init__(
credential=credential,
loop=loop,
**kwargs)
- self._client = AzureFileStorage(version=VERSION, url=self.url, pipeline=self._pipeline, loop=loop)
- self._client._config.version = get_api_version(kwargs, VERSION) # pylint: disable=protected-access
+ self._client = AzureFileStorage(url=self.url, pipeline=self._pipeline, loop=loop)
+ default_api_version = self._client._config.version # pylint: disable=protected-access
+ self._client._config.version = get_api_version(kwargs, default_api_version) # pylint: disable=protected-access
self._loop = loop
@distributed_trace_async
@@ -117,7 +118,7 @@ async def get_service_properties(self, **kwargs):
try:
service_props = await self._client.service.get_properties(timeout=timeout, **kwargs)
return service_properties_deserialize(service_props)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace_async
@@ -171,7 +172,7 @@ async def set_service_properties(
)
try:
await self._client.service.set_properties(props, timeout=timeout, **kwargs)
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
@distributed_trace
@@ -326,7 +327,7 @@ async def undelete_share(self, deleted_share_name, deleted_share_version, **kwar
deleted_share_version=deleted_share_version,
timeout=kwargs.pop('timeout', None), **kwargs)
return share
- except StorageErrorException as error:
+ except HttpResponseError as error:
process_storage_error(error)
def get_share_client(self, share, snapshot=None):
diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md
index c3b1b787fabf..a73b578aed13 100644
--- a/sdk/storage/azure-storage-file-share/swagger/README.md
+++ b/sdk/storage/azure-storage-file-share/swagger/README.md
@@ -19,7 +19,7 @@ autorest --use=C:/work/autorest.python --version=2.0.4280
### Settings
``` yaml
-input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/storage-dataplane-preview/specification/storage/data-plane/Microsoft.FileStorage/preview/2020-02-10/file.json
+input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/add-api-version-enum/specification/storage/data-plane/Microsoft.FileStorage/preview/2020-04-08/file.json
output-folder: ../azure/storage/fileshare/_generated
namespace: azure.storage.fileshare
no-namespace-folders: true
diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_api_version.py b/sdk/storage/azure-storage-file-share/tests/test_file_api_version.py
index fdf04cca1970..0c7266f68b5f 100644
--- a/sdk/storage/azure-storage-file-share/tests/test_file_api_version.py
+++ b/sdk/storage/azure-storage-file-share/tests/test_file_api_version.py
@@ -7,13 +7,13 @@
from _shared.testcase import StorageTestCase, GlobalStorageAccountPreparer
from azure.core.exceptions import ResourceExistsError
+from azure.storage.fileshare._shared.constants import X_MS_VERSION
from azure.storage.fileshare import (
ShareServiceClient,
ShareClient,
ShareDirectoryClient,
ShareFileClient
)
-from azure.storage.fileshare._generated import __version__ as version
# ------------------------------------------------------------------------------
TEST_FILE_PREFIX = 'file'
@@ -23,7 +23,7 @@ class StorageClientTest(StorageTestCase):
def setUp(self):
super(StorageClientTest, self).setUp()
self.api_version_1 = "2019-02-02"
- self.api_version_2 = version
+ self.api_version_2 = X_MS_VERSION
self.short_byte_data = self.get_random_bytes(1024)
# --Helpers-----------------------------------------------------------------
diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_api_version_async.py b/sdk/storage/azure-storage-file-share/tests/test_file_api_version_async.py
index a1875d7ca912..ae4b856017e5 100644
--- a/sdk/storage/azure-storage-file-share/tests/test_file_api_version_async.py
+++ b/sdk/storage/azure-storage-file-share/tests/test_file_api_version_async.py
@@ -8,13 +8,13 @@
from _shared.asynctestcase import AsyncStorageTestCase
from _shared.testcase import GlobalStorageAccountPreparer
from azure.core.exceptions import ResourceExistsError
+from azure.storage.fileshare._shared.constants import X_MS_VERSION
from azure.storage.fileshare.aio import (
ShareServiceClient,
ShareClient,
ShareDirectoryClient,
ShareFileClient
)
-from azure.storage.fileshare._generated import __version__ as version
# ------------------------------------------------------------------------------
TEST_FILE_PREFIX = 'file'
@@ -24,7 +24,7 @@ class AsyncStorageClientTest(AsyncStorageTestCase):
def setUp(self):
super(AsyncStorageTestCase, self).setUp()
self.api_version_1 = "2019-02-02"
- self.api_version_2 = version
+ self.api_version_2 = X_MS_VERSION
self.short_byte_data = self.get_random_bytes(1024)
# --Helpers-----------------------------------------------------------------