diff --git a/README.rst b/README.rst index d1fffbc..201ec27 100644 --- a/README.rst +++ b/README.rst @@ -17,6 +17,10 @@ Handles multi-API versions of Azure Storage Data Plane originally from https://g Change Log ---------- +1.6.0 +++++++ +* fileshare: Support v2025-07-05(12.22.0) and remove v2025-05-05 + 1.5.0 ++++++ * packaging: Remove unused import, cleanup build pipeline diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/_vendor.py b/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/_vendor.py deleted file mode 100644 index 0dafe0e..0000000 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# 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.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/__init__.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/__init__.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/__init__.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/__init__.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_deserialize.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_deserialize.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_deserialize.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_deserialize.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_directory_client.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_directory_client.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_directory_client.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_directory_client.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_directory_client_helpers.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_directory_client_helpers.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_directory_client_helpers.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_directory_client_helpers.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_download.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_download.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_download.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_download.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_file_client.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_file_client.py similarity index 95% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_file_client.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_file_client.py index e2fc4f1..3ecf241 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_file_client.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_file_client.py @@ -1737,3 +1737,84 @@ def create_hardlink( )) except HttpResponseError as error: process_storage_error(error) + + @distributed_trace + def create_symlink( + self, target: str, + *, + metadata: Optional[Dict[str, str]] = None, + file_creation_time: Optional[Union[str, datetime]] = None, + file_last_write_time: Optional[Union[str, datetime]] = None, + owner: Optional[str] = None, + group: Optional[str] = None, + lease: Optional[Union[ShareLeaseClient, str]] = None, + timeout: Optional[int] = None, + **kwargs: Any + ) -> Dict[str, Any]: + """NFS only. Creates a symbolic link to the specified file. + + :param str target: + Specifies the file path the symbolic link will point to. The file path can be either relative or absolute. + :keyword dict[str, str] metadata: + Name-value pairs associated with the file as metadata. + :keyword file_creation_time: Creation time for the file. + :paramtype file_creation_time: str or ~datetime.datetime + :keyword file_last_write_time: Last write time for the file. + :paramtype file_last_write_time: str or ~datetime.datetime + :keyword str owner: The owner of the file. + :keyword str group: The owning group of the file. + :keyword lease: + Required if the file has an active lease. Value can be a ShareLeaseClient object + or the lease ID as a string. + :paramtype lease: ~azure.storage.fileshare.ShareLeaseClient or str + :keyword int timeout: + Sets the server-side timeout for the operation in seconds. For more details see + https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-file-service-operations. + This value is not tracked or validated on the client. To configure client-side network timeouts + see `here `__. + :returns: File-updated property dict (ETag and last modified). + :rtype: dict[str, Any] + """ + try: + return cast(Dict[str, Any], self._client.file.create_symbolic_link( + link_text=target, + metadata=metadata, + file_creation_time=file_creation_time, + file_last_write_time=file_last_write_time, + owner=owner, + group=group, + lease_access_conditions=lease, + timeout=timeout, + cls=return_response_headers, + **kwargs + )) + except HttpResponseError as error: + process_storage_error(error) + + @distributed_trace + def get_symlink( + self, + *, + timeout: Optional[int] = None, + **kwargs: Any + ) -> Dict[str, Any]: + """NFS only. Gets the symbolic link for the file client. + + :keyword int timeout: + Sets the server-side timeout for the operation in seconds. For more details see + https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-file-service-operations. + This value is not tracked or validated on the client. To configure client-side network timeouts + see `here `__. + :returns: File-updated property dict (ETag and last modified). + :rtype: dict[str, Any] + """ + try: + return cast(Dict[str, Any], self._client.file.get_symbolic_link( + timeout=timeout, + cls=return_response_headers, + **kwargs + )) + except HttpResponseError as error: + process_storage_error(error) diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_file_client_helpers.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_file_client_helpers.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_file_client_helpers.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_file_client_helpers.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/__init__.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/__init__.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/__init__.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/__init__.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/_azure_file_storage.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/_azure_file_storage.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/_azure_file_storage.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/_azure_file_storage.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/_configuration.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/_configuration.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/_configuration.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/_configuration.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/_patch.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/_patch.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/_patch.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/_patch.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/_serialization.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/_serialization.py similarity index 99% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/_serialization.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/_serialization.py index a066e16..7a0232d 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/_serialization.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/_serialization.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. @@ -411,7 +411,7 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) @@ -1361,7 +1361,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/__init__.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/__init__.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/__init__.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/__init__.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/_azure_file_storage.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/_azure_file_storage.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/_azure_file_storage.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/_azure_file_storage.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/_configuration.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/_configuration.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/_configuration.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/_configuration.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/_patch.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/_patch.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/_patch.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/_patch.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/operations/__init__.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/operations/__init__.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/operations/__init__.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/operations/__init__.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/operations/_directory_operations.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/operations/_directory_operations.py similarity index 96% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/operations/_directory_operations.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/operations/_directory_operations.py index 83a8498..e7da037 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/operations/_directory_operations.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/operations/_directory_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -82,12 +82,11 @@ async def create( file_mode: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -222,7 +221,6 @@ async def create( async def get_properties( self, sharesnapshot: Optional[str] = None, timeout: Optional[int] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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. @@ -232,7 +230,7 @@ async def get_properties( :type sharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :return: None or the result of cls(response) @@ -315,13 +313,12 @@ async def get_properties( @distributed_trace_async async def delete(self, timeout: Optional[int] = None, **kwargs: Any) -> None: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :return: None or the result of cls(response) @@ -390,12 +387,11 @@ async def set_properties( file_mode: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Sets properties on the directory. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param file_permission: If specified the permission (security descriptor) shall be set for the @@ -527,12 +523,11 @@ async def set_properties( async def set_metadata( self, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Updates user defined metadata for the specified directory. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -607,7 +602,6 @@ async def list_files_and_directories_segment( include_extended_info: Optional[bool] = None, **kwargs: Any ) -> _models.ListFilesAndDirectoriesSegmentResponse: - # pylint: disable=line-too-long """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. @@ -628,7 +622,7 @@ async def list_files_and_directories_segment( :type maxresults: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param include: Include this parameter to specify one or more datasets to include in the @@ -709,7 +703,6 @@ async def list_handles( recursive: Optional[bool] = None, **kwargs: Any ) -> _models.ListHandlesResponse: - # pylint: disable=line-too-long """Lists handles for directory. :param marker: A string value that identifies the portion of the list to be returned with the @@ -723,7 +716,7 @@ async def list_handles( :type maxresults: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, @@ -801,7 +794,6 @@ async def force_close_handles( recursive: Optional[bool] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Closes all handles open for given directory. :param handle_id: Specifies handle ID opened on the file or directory to be closed. Asterisk @@ -809,7 +801,7 @@ async def force_close_handles( :type handle_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param marker: A string value that identifies the portion of the list to be returned with the @@ -900,7 +892,6 @@ async def rename( copy_file_smb_info: Optional[_models.CopyFileSmbInfo] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Renames a directory. :param rename_source: Required. Specifies the URI-style path of the source file, up to 2 KB in @@ -908,7 +899,7 @@ async def rename( :type rename_source: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param replace_if_exists: Optional. A boolean value for if the destination file already exists, diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/operations/_file_operations.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/operations/_file_operations.py similarity index 96% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/operations/_file_operations.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/operations/_file_operations.py index 93f91f2..e6b6e33 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/operations/_file_operations.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/operations/_file_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -100,14 +100,13 @@ async def create( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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. Required. :type file_content_length: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -281,12 +280,11 @@ async def download( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param range: Return file data only from the specified byte range. Default value is None. @@ -429,7 +427,6 @@ async def get_properties( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not return the content of the file. @@ -438,7 +435,7 @@ async def get_properties( :type sharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param lease_access_conditions: Parameter group. Default value is None. @@ -553,12 +550,11 @@ async def delete( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """removes the file from the storage account. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param lease_access_conditions: Parameter group. Default value is None. @@ -636,12 +632,11 @@ async def set_http_headers( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Sets HTTP headers on the file. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param file_content_length: Resizes a file to the specified size. If the specified byte value @@ -809,12 +804,11 @@ async def set_metadata( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Updates user-defined metadata for the specified file. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -891,13 +885,12 @@ async def acquire_lease( request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """[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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param duration: Specifies the duration of the lease, in seconds, or negative one (-1) for a @@ -977,7 +970,6 @@ async def acquire_lease( async def release_lease( self, lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """[Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. @@ -985,7 +977,7 @@ async def release_lease( :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character @@ -1060,7 +1052,6 @@ async def change_lease( request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """[Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. @@ -1068,7 +1059,7 @@ async def change_lease( :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns @@ -1148,13 +1139,12 @@ async def break_lease( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """[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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character @@ -1242,7 +1232,6 @@ async def upload_range( optionalbody: Optional[IO[bytes]] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 @@ -1257,7 +1246,7 @@ async def upload_range( :type content_length: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param file_range_write: Specify one of the following options: - Update: Writes the bytes @@ -1379,7 +1368,6 @@ async def upload_range_from_url( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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. Required. @@ -1398,7 +1386,7 @@ async def upload_range_from_url( :type content_length: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param source_range: Bytes of source data in the specified range. Default value is None. @@ -1510,7 +1498,6 @@ async def get_range_list( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> _models.ShareFileRangeList: - # pylint: disable=line-too-long """Returns the list of valid ranges for a file. :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, @@ -1521,7 +1508,7 @@ async def get_range_list( :type prevsharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param range: Specifies the range of bytes over which to list ranges, inclusively. Default @@ -1620,7 +1607,6 @@ async def start_copy( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 @@ -1633,7 +1619,7 @@ async def start_copy( :type copy_source: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -1778,7 +1764,6 @@ async def abort_copy( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. @@ -1787,7 +1772,7 @@ async def abort_copy( :type copy_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param lease_access_conditions: Parameter group. Default value is None. @@ -1861,7 +1846,6 @@ async def list_handles( sharesnapshot: Optional[str] = None, **kwargs: Any ) -> _models.ListHandlesResponse: - # pylint: disable=line-too-long """Lists handles for file. :param marker: A string value that identifies the portion of the list to be returned with the @@ -1875,7 +1859,7 @@ async def list_handles( :type maxresults: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, @@ -1948,7 +1932,6 @@ async def force_close_handles( sharesnapshot: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Closes all handles open for given file. :param handle_id: Specifies handle ID opened on the file or directory to be closed. Asterisk @@ -1956,7 +1939,7 @@ async def force_close_handles( :type handle_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param marker: A string value that identifies the portion of the list to be returned with the @@ -2044,7 +2027,6 @@ async def rename( file_http_headers: Optional[_models.FileHTTPHeaders] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Renames a file. :param rename_source: Required. Specifies the URI-style path of the source file, up to 2 KB in @@ -2052,7 +2034,7 @@ async def rename( :type rename_source: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param replace_if_exists: Optional. A boolean value for if the destination file already exists, @@ -2217,7 +2199,6 @@ async def create_symbolic_link( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Creates a symbolic link. :param link_text: NFS only. Required. The path to the original file, the symbolic link is @@ -2227,7 +2208,7 @@ async def create_symbolic_link( :type link_text: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -2339,12 +2320,11 @@ async def get_symbolic_link( request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """get_symbolic_link. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, @@ -2420,7 +2400,6 @@ async def create_hard_link( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Creates a hard link. :param target_file: NFS only. Required. Specifies the path of the target file to which the link @@ -2429,7 +2408,7 @@ async def create_hard_link( :type target_file: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/operations/_patch.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/operations/_patch.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/operations/_patch.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/operations/_patch.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/operations/_service_operations.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/operations/_service_operations.py similarity index 95% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/operations/_service_operations.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/operations/_service_operations.py index 4814e22..a128805 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/operations/_service_operations.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/operations/_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -62,7 +63,6 @@ def __init__(self, *args, **kwargs) -> None: async def set_properties( self, storage_service_properties: _models.StorageServiceProperties, timeout: Optional[int] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Sets properties for a storage account's File service endpoint, including properties for Storage Analytics metrics and CORS (Cross-Origin Resource Sharing) rules. @@ -70,7 +70,7 @@ async def set_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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :return: None or the result of cls(response) @@ -130,13 +130,12 @@ async def set_properties( @distributed_trace_async async def get_properties(self, timeout: Optional[int] = None, **kwargs: Any) -> _models.StorageServiceProperties: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :return: StorageServiceProperties or the result of cls(response) @@ -203,7 +202,6 @@ async def list_shares_segment( timeout: Optional[int] = None, **kwargs: Any ) -> _models.ListSharesResponse: - # pylint: disable=line-too-long """The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. @@ -224,7 +222,7 @@ async def list_shares_segment( :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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :return: ListSharesResponse or the result of cls(response) diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/operations/_share_operations.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/operations/_share_operations.py similarity index 95% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/operations/_share_operations.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/operations/_share_operations.py index 373424e..5e46d6e 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/aio/operations/_share_operations.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/aio/operations/_share_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -91,13 +91,12 @@ async def create( share_provisioned_bandwidth_mibps: Optional[int] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -219,7 +218,6 @@ async def get_properties( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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. @@ -228,7 +226,7 @@ async def get_properties( :type sharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param lease_access_conditions: Parameter group. Default value is None. @@ -354,7 +352,6 @@ async def delete( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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. @@ -363,7 +360,7 @@ async def delete( :type sharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param delete_snapshots: Specifies the option include to delete the base share and all of its @@ -443,13 +440,12 @@ async def acquire_lease( request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param duration: Specifies the duration of the lease, in seconds, or negative one (-1) for a @@ -539,7 +535,6 @@ async def release_lease( request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete share operations. @@ -547,7 +542,7 @@ async def release_lease( :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, @@ -628,7 +623,6 @@ async def change_lease( request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete share operations. @@ -636,7 +630,7 @@ async def change_lease( :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns @@ -722,7 +716,6 @@ async def renew_lease( request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete share operations. @@ -730,7 +723,7 @@ async def renew_lease( :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, @@ -812,13 +805,12 @@ async def break_lease( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param break_period: For a break operation, proposed duration the lease should continue before @@ -910,12 +902,11 @@ async def break_lease( async def create_snapshot( self, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Creates a read-only snapshot of a share. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -985,14 +976,13 @@ async def create_permission( content_type: str = "application/json", **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Create a permission (a security descriptor). :param share_permission: A permission (a security descriptor) at the share level. Required. :type share_permission: ~azure.storage.fileshare.models.SharePermission :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -1012,14 +1002,13 @@ async def create_permission( content_type: str = "application/json", **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Create a permission (a security descriptor). :param share_permission: A permission (a security descriptor) at the share level. Required. :type share_permission: IO[bytes] :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -1034,7 +1023,6 @@ async def create_permission( async def create_permission( self, share_permission: Union[_models.SharePermission, IO[bytes]], timeout: Optional[int] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Create a permission (a security descriptor). :param share_permission: A permission (a security descriptor) at the share level. Is either a @@ -1042,7 +1030,7 @@ async def create_permission( :type share_permission: ~azure.storage.fileshare.models.SharePermission or IO[bytes] :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :return: None or the result of cls(response) @@ -1119,7 +1107,6 @@ async def get_permission( timeout: Optional[int] = None, **kwargs: Any ) -> _models.SharePermission: - # pylint: disable=line-too-long """Returns the permission (security descriptor) for a given key. :param file_permission_key: Key of the permission to be set for the directory/file. Required. @@ -1133,7 +1120,7 @@ async def get_permission( :type file_permission_format: str or ~azure.storage.fileshare.models.FilePermissionFormat :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :return: SharePermission or the result of cls(response) @@ -1209,12 +1196,11 @@ async def set_properties( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Sets properties for the specified share. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param quota: Specifies the maximum size of the share, in gigabytes. Default value is None. @@ -1347,12 +1333,11 @@ async def set_metadata( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -1426,12 +1411,11 @@ async def get_access_policy( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> List[_models.SignedIdentifier]: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param lease_access_conditions: Parameter group. Default value is None. @@ -1506,12 +1490,11 @@ async def set_access_policy( share_acl: Optional[List[_models.SignedIdentifier]] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param lease_access_conditions: Parameter group. Default value is None. @@ -1593,12 +1576,11 @@ async def get_statistics( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> _models.ShareStats: - # pylint: disable=line-too-long """Retrieves statistics related to the share. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param lease_access_conditions: Parameter group. Default value is None. @@ -1674,12 +1656,11 @@ async def restore( deleted_share_version: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Restores a previously deleted Share. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/models/__init__.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/models/__init__.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/models/__init__.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/models/__init__.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/models/_azure_file_storage_enums.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/models/_azure_file_storage_enums.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/models/_azure_file_storage_enums.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/models/_azure_file_storage_enums.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/models/_models_py3.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/models/_models_py3.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/models/_models_py3.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/models/_models_py3.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/models/_patch.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/models/_patch.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/models/_patch.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/models/_patch.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/operations/__init__.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/operations/__init__.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/operations/__init__.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/operations/__init__.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/operations/_directory_operations.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/operations/_directory_operations.py similarity index 97% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/operations/_directory_operations.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/operations/_directory_operations.py index 18e4eab..a7dfa30 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/operations/_directory_operations.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/operations/_directory_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -594,12 +594,11 @@ def create( # pylint: disable=inconsistent-return-statements file_mode: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -734,7 +733,6 @@ def create( # pylint: disable=inconsistent-return-statements def get_properties( # pylint: disable=inconsistent-return-statements self, sharesnapshot: Optional[str] = None, timeout: Optional[int] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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. @@ -744,7 +742,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements :type sharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :return: None or the result of cls(response) @@ -829,13 +827,12 @@ def get_properties( # pylint: disable=inconsistent-return-statements def delete( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :return: None or the result of cls(response) @@ -904,12 +901,11 @@ def set_properties( # pylint: disable=inconsistent-return-statements file_mode: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Sets properties on the directory. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param file_permission: If specified the permission (security descriptor) shall be set for the @@ -1041,12 +1037,11 @@ def set_properties( # pylint: disable=inconsistent-return-statements def set_metadata( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Updates user defined metadata for the specified directory. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -1121,7 +1116,6 @@ def list_files_and_directories_segment( include_extended_info: Optional[bool] = None, **kwargs: Any ) -> _models.ListFilesAndDirectoriesSegmentResponse: - # pylint: disable=line-too-long """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. @@ -1142,7 +1136,7 @@ def list_files_and_directories_segment( :type maxresults: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param include: Include this parameter to specify one or more datasets to include in the @@ -1223,7 +1217,6 @@ def list_handles( recursive: Optional[bool] = None, **kwargs: Any ) -> _models.ListHandlesResponse: - # pylint: disable=line-too-long """Lists handles for directory. :param marker: A string value that identifies the portion of the list to be returned with the @@ -1237,7 +1230,7 @@ def list_handles( :type maxresults: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, @@ -1315,7 +1308,6 @@ def force_close_handles( # pylint: disable=inconsistent-return-statements recursive: Optional[bool] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Closes all handles open for given directory. :param handle_id: Specifies handle ID opened on the file or directory to be closed. Asterisk @@ -1323,7 +1315,7 @@ def force_close_handles( # pylint: disable=inconsistent-return-statements :type handle_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param marker: A string value that identifies the portion of the list to be returned with the @@ -1414,7 +1406,6 @@ def rename( # pylint: disable=inconsistent-return-statements copy_file_smb_info: Optional[_models.CopyFileSmbInfo] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Renames a directory. :param rename_source: Required. Specifies the URI-style path of the source file, up to 2 KB in @@ -1422,7 +1413,7 @@ def rename( # pylint: disable=inconsistent-return-statements :type rename_source: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param replace_if_exists: Optional. A boolean value for if the destination file already exists, diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/operations/_file_operations.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/operations/_file_operations.py similarity index 97% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/operations/_file_operations.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/operations/_file_operations.py index d67f90d..28202b4 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/operations/_file_operations.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/operations/_file_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -1337,14 +1337,13 @@ def create( # pylint: disable=inconsistent-return-statements lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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. Required. :type file_content_length: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -1518,12 +1517,11 @@ def download( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> Iterator[bytes]: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param range: Return file data only from the specified byte range. Default value is None. @@ -1666,7 +1664,6 @@ def get_properties( # pylint: disable=inconsistent-return-statements lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not return the content of the file. @@ -1675,7 +1672,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements :type sharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param lease_access_conditions: Parameter group. Default value is None. @@ -1790,12 +1787,11 @@ def delete( # pylint: disable=inconsistent-return-statements lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """removes the file from the storage account. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param lease_access_conditions: Parameter group. Default value is None. @@ -1873,12 +1869,11 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Sets HTTP headers on the file. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param file_content_length: Resizes a file to the specified size. If the specified byte value @@ -2046,12 +2041,11 @@ def set_metadata( # pylint: disable=inconsistent-return-statements lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Updates user-defined metadata for the specified file. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -2128,13 +2122,12 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """[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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param duration: Specifies the duration of the lease, in seconds, or negative one (-1) for a @@ -2214,7 +2207,6 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements def release_lease( # pylint: disable=inconsistent-return-statements self, lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """[Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. @@ -2222,7 +2214,7 @@ def release_lease( # pylint: disable=inconsistent-return-statements :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character @@ -2297,7 +2289,6 @@ def change_lease( # pylint: disable=inconsistent-return-statements request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """[Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. @@ -2305,7 +2296,7 @@ def change_lease( # pylint: disable=inconsistent-return-statements :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns @@ -2385,13 +2376,12 @@ def break_lease( # pylint: disable=inconsistent-return-statements lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """[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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character @@ -2479,7 +2469,6 @@ def upload_range( # pylint: disable=inconsistent-return-statements optionalbody: Optional[IO[bytes]] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 @@ -2494,7 +2483,7 @@ def upload_range( # pylint: disable=inconsistent-return-statements :type content_length: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param file_range_write: Specify one of the following options: - Update: Writes the bytes @@ -2616,7 +2605,6 @@ def upload_range_from_url( # pylint: disable=inconsistent-return-statements lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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. Required. @@ -2635,7 +2623,7 @@ def upload_range_from_url( # pylint: disable=inconsistent-return-statements :type content_length: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param source_range: Bytes of source data in the specified range. Default value is None. @@ -2747,7 +2735,6 @@ def get_range_list( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> _models.ShareFileRangeList: - # pylint: disable=line-too-long """Returns the list of valid ranges for a file. :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, @@ -2758,7 +2745,7 @@ def get_range_list( :type prevsharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param range: Specifies the range of bytes over which to list ranges, inclusively. Default @@ -2857,7 +2844,6 @@ def start_copy( # pylint: disable=inconsistent-return-statements lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 @@ -2870,7 +2856,7 @@ def start_copy( # pylint: disable=inconsistent-return-statements :type copy_source: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -3015,7 +3001,6 @@ def abort_copy( # pylint: disable=inconsistent-return-statements lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. @@ -3024,7 +3009,7 @@ def abort_copy( # pylint: disable=inconsistent-return-statements :type copy_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param lease_access_conditions: Parameter group. Default value is None. @@ -3098,7 +3083,6 @@ def list_handles( sharesnapshot: Optional[str] = None, **kwargs: Any ) -> _models.ListHandlesResponse: - # pylint: disable=line-too-long """Lists handles for file. :param marker: A string value that identifies the portion of the list to be returned with the @@ -3112,7 +3096,7 @@ def list_handles( :type maxresults: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, @@ -3185,7 +3169,6 @@ def force_close_handles( # pylint: disable=inconsistent-return-statements sharesnapshot: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Closes all handles open for given file. :param handle_id: Specifies handle ID opened on the file or directory to be closed. Asterisk @@ -3193,7 +3176,7 @@ def force_close_handles( # pylint: disable=inconsistent-return-statements :type handle_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param marker: A string value that identifies the portion of the list to be returned with the @@ -3281,7 +3264,6 @@ def rename( # pylint: disable=inconsistent-return-statements file_http_headers: Optional[_models.FileHTTPHeaders] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Renames a file. :param rename_source: Required. Specifies the URI-style path of the source file, up to 2 KB in @@ -3289,7 +3271,7 @@ def rename( # pylint: disable=inconsistent-return-statements :type rename_source: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param replace_if_exists: Optional. A boolean value for if the destination file already exists, @@ -3454,7 +3436,6 @@ def create_symbolic_link( # pylint: disable=inconsistent-return-statements lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Creates a symbolic link. :param link_text: NFS only. Required. The path to the original file, the symbolic link is @@ -3464,7 +3445,7 @@ def create_symbolic_link( # pylint: disable=inconsistent-return-statements :type link_text: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -3576,12 +3557,11 @@ def get_symbolic_link( # pylint: disable=inconsistent-return-statements request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """get_symbolic_link. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, @@ -3657,7 +3637,6 @@ def create_hard_link( # pylint: disable=inconsistent-return-statements lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Creates a hard link. :param target_file: NFS only. Required. Specifies the path of the target file to which the link @@ -3666,7 +3645,7 @@ def create_hard_link( # pylint: disable=inconsistent-return-statements :type target_file: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/operations/_patch.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/operations/_patch.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/operations/_patch.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/operations/_patch.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/operations/_service_operations.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/operations/_service_operations.py similarity index 96% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/operations/_service_operations.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/operations/_service_operations.py index 57e5b24..6654ac5 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/operations/_service_operations.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/operations/_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -188,7 +189,6 @@ def __init__(self, *args, **kwargs): def set_properties( # pylint: disable=inconsistent-return-statements self, storage_service_properties: _models.StorageServiceProperties, timeout: Optional[int] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Sets properties for a storage account's File service endpoint, including properties for Storage Analytics metrics and CORS (Cross-Origin Resource Sharing) rules. @@ -196,7 +196,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements :type storage_service_properties: ~azure.storage.fileshare.models.StorageServiceProperties :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :return: None or the result of cls(response) @@ -256,13 +256,12 @@ def set_properties( # pylint: disable=inconsistent-return-statements @distributed_trace def get_properties(self, timeout: Optional[int] = None, **kwargs: Any) -> _models.StorageServiceProperties: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :return: StorageServiceProperties or the result of cls(response) @@ -329,7 +328,6 @@ def list_shares_segment( timeout: Optional[int] = None, **kwargs: Any ) -> _models.ListSharesResponse: - # pylint: disable=line-too-long """The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. @@ -350,7 +348,7 @@ def list_shares_segment( :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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :return: ListSharesResponse or the result of cls(response) diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/operations/_share_operations.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/operations/_share_operations.py similarity index 97% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/operations/_share_operations.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/operations/_share_operations.py index 920a64e..d5b0e4b 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/operations/_share_operations.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/operations/_share_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -921,13 +921,12 @@ def create( # pylint: disable=inconsistent-return-statements share_provisioned_bandwidth_mibps: Optional[int] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -1049,7 +1048,6 @@ def get_properties( # pylint: disable=inconsistent-return-statements lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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. @@ -1058,7 +1056,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements :type sharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param lease_access_conditions: Parameter group. Default value is None. @@ -1184,7 +1182,6 @@ def delete( # pylint: disable=inconsistent-return-statements lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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. @@ -1193,7 +1190,7 @@ def delete( # pylint: disable=inconsistent-return-statements :type sharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param delete_snapshots: Specifies the option include to delete the base share and all of its @@ -1273,13 +1270,12 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param duration: Specifies the duration of the lease, in seconds, or negative one (-1) for a @@ -1369,7 +1365,6 @@ def release_lease( # pylint: disable=inconsistent-return-statements request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete share operations. @@ -1377,7 +1372,7 @@ def release_lease( # pylint: disable=inconsistent-return-statements :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, @@ -1458,7 +1453,6 @@ def change_lease( # pylint: disable=inconsistent-return-statements request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete share operations. @@ -1466,7 +1460,7 @@ def change_lease( # pylint: disable=inconsistent-return-statements :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns @@ -1552,7 +1546,6 @@ def renew_lease( # pylint: disable=inconsistent-return-statements request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete share operations. @@ -1560,7 +1553,7 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, @@ -1642,13 +1635,12 @@ def break_lease( # pylint: disable=inconsistent-return-statements lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param break_period: For a break operation, proposed duration the lease should continue before @@ -1740,12 +1732,11 @@ def break_lease( # pylint: disable=inconsistent-return-statements def create_snapshot( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Creates a read-only snapshot of a share. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -1815,14 +1806,13 @@ def create_permission( content_type: str = "application/json", **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Create a permission (a security descriptor). :param share_permission: A permission (a security descriptor) at the share level. Required. :type share_permission: ~azure.storage.fileshare.models.SharePermission :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -1842,14 +1832,13 @@ def create_permission( content_type: str = "application/json", **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Create a permission (a security descriptor). :param share_permission: A permission (a security descriptor) at the share level. Required. :type share_permission: IO[bytes] :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -1864,7 +1853,6 @@ def create_permission( def create_permission( # pylint: disable=inconsistent-return-statements self, share_permission: Union[_models.SharePermission, IO[bytes]], timeout: Optional[int] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Create a permission (a security descriptor). :param share_permission: A permission (a security descriptor) at the share level. Is either a @@ -1872,7 +1860,7 @@ def create_permission( # pylint: disable=inconsistent-return-statements :type share_permission: ~azure.storage.fileshare.models.SharePermission or IO[bytes] :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :return: None or the result of cls(response) @@ -1949,7 +1937,6 @@ def get_permission( timeout: Optional[int] = None, **kwargs: Any ) -> _models.SharePermission: - # pylint: disable=line-too-long """Returns the permission (security descriptor) for a given key. :param file_permission_key: Key of the permission to be set for the directory/file. Required. @@ -1963,7 +1950,7 @@ def get_permission( :type file_permission_format: str or ~azure.storage.fileshare.models.FilePermissionFormat :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :return: SharePermission or the result of cls(response) @@ -2039,12 +2026,11 @@ def set_properties( # pylint: disable=inconsistent-return-statements lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Sets properties for the specified share. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param quota: Specifies the maximum size of the share, in gigabytes. Default value is None. @@ -2177,12 +2163,11 @@ def set_metadata( # pylint: disable=inconsistent-return-statements lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. Default value is @@ -2256,12 +2241,11 @@ def get_access_policy( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> List[_models.SignedIdentifier]: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param lease_access_conditions: Parameter group. Default value is None. @@ -2336,12 +2320,11 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements share_acl: Optional[List[_models.SignedIdentifier]] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """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 + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param lease_access_conditions: Parameter group. Default value is None. @@ -2423,12 +2406,11 @@ def get_statistics( lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> _models.ShareStats: - # pylint: disable=line-too-long """Retrieves statistics related to the share. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param lease_access_conditions: Parameter group. Default value is None. @@ -2504,12 +2486,11 @@ def restore( # pylint: disable=inconsistent-return-statements deleted_share_version: Optional[str] = None, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Restores a previously deleted Share. :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting + href="https://learn.microsoft.com/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations">Setting Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/py.typed b/azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/py.typed similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_generated/py.typed rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_generated/py.typed diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_lease.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_lease.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_lease.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_lease.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_models.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_models.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_models.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_models.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_parser.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_parser.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_parser.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_parser.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_serialize.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_serialize.py similarity index 99% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_serialize.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_serialize.py index 4f98931..a936bad 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_serialize.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_serialize.py @@ -48,6 +48,7 @@ '2024-11-04', '2025-01-05', '2025-05-05', + '2025-07-05', ] diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_share_client.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_share_client.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_share_client.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_share_client.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_share_client_helpers.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_share_client_helpers.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_share_client_helpers.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_share_client_helpers.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_share_service_client.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_share_service_client.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_share_service_client.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_share_service_client.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_share_service_client_helpers.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_share_service_client_helpers.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_share_service_client_helpers.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_share_service_client_helpers.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/__init__.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/__init__.py similarity index 79% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/__init__.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/__init__.py index a8b1a27..4dbbb7e 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/__init__.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/__init__.py @@ -11,7 +11,7 @@ try: from urllib.parse import quote, unquote except ImportError: - from urllib2 import quote, unquote # type: ignore + from urllib2 import quote, unquote # type: ignore def url_quote(url): @@ -24,20 +24,20 @@ def url_unquote(url): def encode_base64(data): if isinstance(data, str): - data = data.encode('utf-8') + data = data.encode("utf-8") encoded = base64.b64encode(data) - return encoded.decode('utf-8') + return encoded.decode("utf-8") def decode_base64_to_bytes(data): if isinstance(data, str): - data = data.encode('utf-8') + data = data.encode("utf-8") return base64.b64decode(data) def decode_base64_to_text(data): decoded_bytes = decode_base64_to_bytes(data) - return decoded_bytes.decode('utf-8') + return decoded_bytes.decode("utf-8") def sign_string(key, string_to_sign, key_is_base64=True): @@ -45,9 +45,9 @@ def sign_string(key, string_to_sign, key_is_base64=True): key = decode_base64_to_bytes(key) else: if isinstance(key, str): - key = key.encode('utf-8') + key = key.encode("utf-8") if isinstance(string_to_sign, str): - string_to_sign = string_to_sign.encode('utf-8') + string_to_sign = string_to_sign.encode("utf-8") signed_hmac_sha256 = hmac.HMAC(key, string_to_sign, hashlib.sha256) digest = signed_hmac_sha256.digest() encoded_digest = encode_base64(digest) diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/authentication.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/authentication.py similarity index 77% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/authentication.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/authentication.py index 44c563d..f778dc7 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/authentication.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/authentication.py @@ -27,6 +27,8 @@ logger = logging.getLogger(__name__) + +# fmt: off table_lv0 = [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, @@ -50,6 +52,8 @@ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ] +# fmt: on + def compare(lhs: str, rhs: str) -> int: # pylint:disable=too-many-return-statements tables = [table_lv0, table_lv4] @@ -94,6 +98,7 @@ def _wrap_exception(ex, desired_type): msg = ex.args[0] return desired_type(msg) + # This method attempts to emulate the sorting done by the service def _storage_header_sort(input_headers: List[Tuple[str, str]]) -> List[Tuple[str, str]]: @@ -134,38 +139,42 @@ def __init__(self, account_name, account_key): @staticmethod def _get_headers(request, headers_to_sign): headers = dict((name.lower(), value) for name, value in request.http_request.headers.items() if value) - if 'content-length' in headers and headers['content-length'] == '0': - del headers['content-length'] - return '\n'.join(headers.get(x, '') for x in headers_to_sign) + '\n' + if "content-length" in headers and headers["content-length"] == "0": + del headers["content-length"] + return "\n".join(headers.get(x, "") for x in headers_to_sign) + "\n" @staticmethod def _get_verb(request): - return request.http_request.method + '\n' + return request.http_request.method + "\n" def _get_canonicalized_resource(self, request): uri_path = urlparse(request.http_request.url).path try: - if isinstance(request.context.transport, AioHttpTransport) or \ - isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport) or \ - isinstance(getattr(getattr(request.context.transport, "_transport", None), "_transport", None), - AioHttpTransport): + if ( + isinstance(request.context.transport, AioHttpTransport) + or isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport) + or isinstance( + getattr(getattr(request.context.transport, "_transport", None), "_transport", None), + AioHttpTransport, + ) + ): uri_path = URL(uri_path) - return '/' + self.account_name + str(uri_path) + return "/" + self.account_name + str(uri_path) except TypeError: pass - return '/' + self.account_name + uri_path + return "/" + self.account_name + uri_path @staticmethod def _get_canonicalized_headers(request): - string_to_sign = '' + string_to_sign = "" x_ms_headers = [] for name, value in request.http_request.headers.items(): - if name.startswith('x-ms-'): + if name.startswith("x-ms-"): x_ms_headers.append((name.lower(), value)) x_ms_headers = _storage_header_sort(x_ms_headers) for name, value in x_ms_headers: if value is not None: - string_to_sign += ''.join([name, ':', value, '\n']) + string_to_sign += "".join([name, ":", value, "\n"]) return string_to_sign @staticmethod @@ -173,37 +182,46 @@ def _get_canonicalized_resource_query(request): sorted_queries = list(request.http_request.query.items()) sorted_queries.sort() - string_to_sign = '' + string_to_sign = "" for name, value in sorted_queries: if value is not None: - string_to_sign += '\n' + name.lower() + ':' + unquote(value) + string_to_sign += "\n" + name.lower() + ":" + unquote(value) return string_to_sign def _add_authorization_header(self, request, string_to_sign): try: signature = sign_string(self.account_key, string_to_sign) - auth_string = 'SharedKey ' + self.account_name + ':' + signature - request.http_request.headers['Authorization'] = auth_string + auth_string = "SharedKey " + self.account_name + ":" + signature + request.http_request.headers["Authorization"] = auth_string except Exception as ex: # Wrap any error that occurred as signing error # Doing so will clarify/locate the source of problem raise _wrap_exception(ex, AzureSigningError) from ex def on_request(self, request): - string_to_sign = \ - self._get_verb(request) + \ - self._get_headers( + string_to_sign = ( + self._get_verb(request) + + self._get_headers( request, [ - 'content-encoding', 'content-language', 'content-length', - 'content-md5', 'content-type', 'date', 'if-modified-since', - 'if-match', 'if-none-match', 'if-unmodified-since', 'byte_range' - ] - ) + \ - self._get_canonicalized_headers(request) + \ - self._get_canonicalized_resource(request) + \ - self._get_canonicalized_resource_query(request) + "content-encoding", + "content-language", + "content-length", + "content-md5", + "content-type", + "date", + "if-modified-since", + "if-match", + "if-none-match", + "if-unmodified-since", + "byte_range", + ], + ) + + self._get_canonicalized_headers(request) + + self._get_canonicalized_resource(request) + + self._get_canonicalized_resource_query(request) + ) self._add_authorization_header(request, string_to_sign) # logger.debug("String_to_sign=%s", string_to_sign) @@ -211,7 +229,7 @@ def on_request(self, request): class StorageHttpChallenge(object): def __init__(self, challenge): - """ Parses an HTTP WWW-Authentication Bearer challenge from the Storage service. """ + """Parses an HTTP WWW-Authentication Bearer challenge from the Storage service.""" if not challenge: raise ValueError("Challenge cannot be empty") @@ -220,7 +238,7 @@ def __init__(self, challenge): # name=value pairs either comma or space separated with values possibly being # enclosed in quotes - for item in re.split('[, ]', trimmed_challenge): + for item in re.split("[, ]", trimmed_challenge): comps = item.split("=") if len(comps) == 2: key = comps[0].strip(' "') @@ -229,11 +247,11 @@ def __init__(self, challenge): self._parameters[key] = value # Extract and verify required parameters - self.authorization_uri = self._parameters.get('authorization_uri') + self.authorization_uri = self._parameters.get("authorization_uri") if not self.authorization_uri: raise ValueError("Authorization Uri not found") - self.resource_id = self._parameters.get('resource_id') + self.resource_id = self._parameters.get("resource_id") if not self.resource_id: raise ValueError("Resource id not found") diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/base_client.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/base_client.py similarity index 81% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/base_client.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/base_client.py index 9dc8d2e..217eb21 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/base_client.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/base_client.py @@ -20,7 +20,10 @@ from azure.core.credentials import AzureSasCredential, AzureNamedKeyCredential, TokenCredential from azure.core.exceptions import HttpResponseError from azure.core.pipeline import Pipeline -from azure.core.pipeline.transport import HttpTransport, RequestsTransport # pylint: disable=non-abstract-transport-import, no-name-in-module +from azure.core.pipeline.transport import ( # pylint: disable=non-abstract-transport-import, no-name-in-module + HttpTransport, + RequestsTransport, +) from azure.core.pipeline.policies import ( AzureSasCredentialPolicy, ContentDecodePolicy, @@ -65,27 +68,42 @@ class StorageAccountHostsMixin(object): + _client: Any + _hosts: Dict[str, str] + def __init__( self, parsed_url: Any, service: str, - credential: Optional[Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, "AsyncTokenCredential", TokenCredential]] = None, # pylint: disable=line-too-long - **kwargs: Any + credential: Optional[ + Union[ + str, + Dict[str, str], + AzureNamedKeyCredential, + AzureSasCredential, + "AsyncTokenCredential", + TokenCredential, + ] + ] = None, + **kwargs: Any, ) -> None: self._location_mode = kwargs.get("_location_mode", LocationMode.PRIMARY) - self._hosts = kwargs.get("_hosts") + self._hosts = kwargs.get("_hosts", {}) self.scheme = parsed_url.scheme self._is_localhost = False if service not in ["blob", "queue", "file-share", "dfs"]: raise ValueError(f"Invalid service: {service}") - service_name = service.split('-')[0] + service_name = service.split("-")[0] account = parsed_url.netloc.split(f".{service_name}.core.") self.account_name = account[0] if len(account) > 1 else None - if not self.account_name and parsed_url.netloc.startswith("localhost") \ - or parsed_url.netloc.startswith("127.0.0.1"): + if ( + not self.account_name + and parsed_url.netloc.startswith("localhost") + or parsed_url.netloc.startswith("127.0.0.1") + ): self._is_localhost = True self.account_name = parsed_url.path.strip("/") @@ -93,7 +111,7 @@ def __init__( if self.scheme.lower() != "https" and hasattr(self.credential, "get_token"): raise ValueError("Token credential is only supported with HTTPS.") - secondary_hostname = None + secondary_hostname = "" if hasattr(self.credential, "account_name"): self.account_name = self.credential.account_name secondary_hostname = f"{self.credential.account_name}-secondary.{service_name}.{SERVICE_HOST_BASE}" @@ -103,7 +121,7 @@ def __init__( secondary_hostname = parsed_url.netloc.replace(account[0], account[0] + "-secondary") if kwargs.get("secondary_hostname"): secondary_hostname = kwargs["secondary_hostname"] - primary_hostname = (parsed_url.netloc + parsed_url.path).rstrip('/') + primary_hostname = (parsed_url.netloc + parsed_url.path).rstrip("/") self._hosts = {LocationMode.PRIMARY: primary_hostname, LocationMode.SECONDARY: secondary_hostname} self._sdk_moniker = f"storage-{service}/{VERSION}" @@ -116,70 +134,76 @@ def __enter__(self): def __exit__(self, *args): self._client.__exit__(*args) - def close(self): - """ This method is to close the sockets opened by the client. + def close(self) -> None: + """This method is to close the sockets opened by the client. It need not be used when using with a context manager. """ self._client.close() @property - def url(self): + def url(self) -> str: """The full endpoint URL to this entity, including SAS token if used. This could be either the primary endpoint, or the secondary endpoint depending on the current :func:`location_mode`. - :returns: The full endpoint URL to this entity, including SAS token if used. + + :return: The full endpoint URL to this entity, including SAS token if used. :rtype: str """ - return self._format_url(self._hosts[self._location_mode]) + return self._format_url(self._hosts[self._location_mode]) # type: ignore @property - def primary_endpoint(self): + def primary_endpoint(self) -> str: """The full primary endpoint URL. + :return: The full primary endpoint URL. :rtype: str """ - return self._format_url(self._hosts[LocationMode.PRIMARY]) + return self._format_url(self._hosts[LocationMode.PRIMARY]) # type: ignore @property - def primary_hostname(self): + def primary_hostname(self) -> str: """The hostname of the primary endpoint. + :return: The hostname of the primary endpoint. :rtype: str """ return self._hosts[LocationMode.PRIMARY] @property - def secondary_endpoint(self): + def secondary_endpoint(self) -> str: """The full secondary endpoint URL if configured. If not available a ValueError will be raised. To explicitly specify a secondary hostname, use the optional `secondary_hostname` keyword argument on instantiation. + :return: The full secondary endpoint URL. :rtype: str - :raise ValueError: + :raise ValueError: If no secondary endpoint is configured. """ if not self._hosts[LocationMode.SECONDARY]: raise ValueError("No secondary host configured.") - return self._format_url(self._hosts[LocationMode.SECONDARY]) + return self._format_url(self._hosts[LocationMode.SECONDARY]) # type: ignore @property - def secondary_hostname(self): + def secondary_hostname(self) -> Optional[str]: """The hostname of the secondary endpoint. If not available this will be None. To explicitly specify a secondary hostname, use the optional `secondary_hostname` keyword argument on instantiation. + :return: The hostname of the secondary endpoint, or None if not configured. :rtype: Optional[str] """ return self._hosts[LocationMode.SECONDARY] @property - def location_mode(self): + def location_mode(self) -> str: """The location mode that the client is currently using. By default this will be "primary". Options include "primary" and "secondary". + :return: The current location mode. :rtype: str """ @@ -202,11 +226,16 @@ def api_version(self): return self._client._config.version # pylint: disable=protected-access def _format_query_string( - self, sas_token: Optional[str], - credential: Optional[Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", TokenCredential]], # pylint: disable=line-too-long + self, + sas_token: Optional[str], + credential: Optional[ + Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", TokenCredential] + ], snapshot: Optional[str] = None, - share_snapshot: Optional[str] = None - ) -> Tuple[str, Optional[Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", TokenCredential]]]: # pylint: disable=line-too-long + share_snapshot: Optional[str] = None, + ) -> Tuple[ + str, Optional[Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", TokenCredential]] + ]: query_str = "?" if snapshot: query_str += f"snapshot={snapshot}&" @@ -214,7 +243,8 @@ def _format_query_string( query_str += f"sharesnapshot={share_snapshot}&" if sas_token and isinstance(credential, AzureSasCredential): raise ValueError( - "You cannot use AzureSasCredential when the resource URI also contains a Shared Access Signature.") + "You cannot use AzureSasCredential when the resource URI also contains a Shared Access Signature." + ) if _is_credential_sastoken(credential): credential = cast(str, credential) query_str += credential.lstrip("?") @@ -224,13 +254,16 @@ def _format_query_string( return query_str.rstrip("?&"), credential def _create_pipeline( - self, credential: Optional[Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, TokenCredential]] = None, # pylint: disable=line-too-long - **kwargs: Any + self, + credential: Optional[ + Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, TokenCredential] + ] = None, + **kwargs: Any, ) -> Tuple[StorageConfiguration, Pipeline]: self._credential_policy: Any = None if hasattr(credential, "get_token"): - if kwargs.get('audience'): - audience = str(kwargs.pop('audience')).rstrip('/') + DEFAULT_OAUTH_SCOPE + if kwargs.get("audience"): + audience = str(kwargs.pop("audience")).rstrip("/") + DEFAULT_OAUTH_SCOPE else: audience = STORAGE_OAUTH_SCOPE self._credential_policy = StorageBearerTokenCredentialPolicy(cast(TokenCredential, credential), audience) @@ -264,22 +297,18 @@ def _create_pipeline( config.logging_policy, StorageResponseHook(**kwargs), DistributedTracingPolicy(**kwargs), - HttpLoggingPolicy(**kwargs) + HttpLoggingPolicy(**kwargs), ] if kwargs.get("_additional_pipeline_policies"): policies = policies + kwargs.get("_additional_pipeline_policies") # type: ignore config.transport = transport # type: ignore return config, Pipeline(transport, policies=policies) - def _batch_send( - self, - *reqs: "HttpRequest", - **kwargs: Any - ) -> Iterator["HttpResponse"]: + def _batch_send(self, *reqs: "HttpRequest", **kwargs: Any) -> Iterator["HttpResponse"]: """Given a series of request, do a Storage batch call. :param HttpRequest reqs: A collection of HttpRequest objects. - :returns: An iterator of HttpResponse objects. + :return: An iterator of HttpResponse objects. :rtype: Iterator[HttpResponse] """ # Pop it here, so requests doesn't feel bad about additional kwarg @@ -288,25 +317,21 @@ def _batch_send( request = self._client._client.post( # pylint: disable=protected-access url=( - f'{self.scheme}://{self.primary_hostname}/' + f"{self.scheme}://{self.primary_hostname}/" f"{kwargs.pop('path', '')}?{kwargs.pop('restype', '')}" f"comp=batch{kwargs.pop('sas', '')}{kwargs.pop('timeout', '')}" ), headers={ - 'x-ms-version': self.api_version, - "Content-Type": "multipart/mixed; boundary=" + _get_batch_request_delimiter(batch_id, False, False) - } + "x-ms-version": self.api_version, + "Content-Type": "multipart/mixed; boundary=" + _get_batch_request_delimiter(batch_id, False, False), + }, ) policies = [StorageHeadersPolicy()] if self._credential_policy: policies.append(self._credential_policy) - request.set_multipart_mixed( - *reqs, - policies=policies, - enforce_https=False - ) + request.set_multipart_mixed(*reqs, policies=policies, enforce_https=False) Pipeline._prepare_multipart_mixed_request(request) # pylint: disable=protected-access body = serialize_batch_body(request.multipart_mixed_info[0], batch_id) @@ -314,9 +339,7 @@ def _batch_send( temp = request.multipart_mixed_info request.multipart_mixed_info = None - pipeline_response = self._pipeline.run( - request, **kwargs - ) + pipeline_response = self._pipeline.run(request, **kwargs) response = pipeline_response.http_response request.multipart_mixed_info = temp @@ -328,8 +351,7 @@ def _batch_send( parts = list(response.parts()) if any(p for p in parts if not 200 <= p.status_code < 300): error = PartialBatchErrorException( - message="There is a partial failure in the batch operation.", - response=response, parts=parts + message="There is a partial failure in the batch operation.", response=response, parts=parts ) raise error return iter(parts) @@ -343,6 +365,7 @@ class TransportWrapper(HttpTransport): by a `get_client` method does not close the outer transport for the parent when used in a context manager. """ + def __init__(self, transport): self._transport = transport @@ -364,7 +387,9 @@ def __exit__(self, *args): def _format_shared_key_credential( account_name: Optional[str], - credential: Optional[Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, "AsyncTokenCredential", TokenCredential]] = None # pylint: disable=line-too-long + credential: Optional[ + Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, "AsyncTokenCredential", TokenCredential] + ] = None, ) -> Any: if isinstance(credential, str): if not account_name: @@ -384,8 +409,12 @@ def _format_shared_key_credential( def parse_connection_str( conn_str: str, credential: Optional[Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, TokenCredential]], - service: str -) -> Tuple[str, Optional[str], Optional[Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, TokenCredential]]]: # pylint: disable=line-too-long + service: str, +) -> Tuple[ + str, + Optional[str], + Optional[Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, TokenCredential]], +]: conn_str = conn_str.rstrip(";") conn_settings_list = [s.split("=", 1) for s in conn_str.split(";")] if any(len(tup) != 2 for tup in conn_settings_list): @@ -407,14 +436,11 @@ def parse_connection_str( if endpoints["secondary"] in conn_settings: raise ValueError("Connection string specifies only secondary endpoint.") try: - primary =( + primary = ( f"{conn_settings['DEFAULTENDPOINTSPROTOCOL']}://" f"{conn_settings['ACCOUNTNAME']}.{service}.{conn_settings['ENDPOINTSUFFIX']}" ) - secondary = ( - f"{conn_settings['ACCOUNTNAME']}-secondary." - f"{service}.{conn_settings['ENDPOINTSUFFIX']}" - ) + secondary = f"{conn_settings['ACCOUNTNAME']}-secondary." f"{service}.{conn_settings['ENDPOINTSUFFIX']}" except KeyError: pass @@ -434,7 +460,7 @@ def parse_connection_str( def create_configuration(**kwargs: Any) -> StorageConfiguration: - # Backwards compatibility if someone is not passing sdk_moniker + # Backwards compatibility if someone is not passing sdk_moniker if not kwargs.get("sdk_moniker"): kwargs["sdk_moniker"] = f"storage-{kwargs.pop('storage_sdk')}/{VERSION}" config = StorageConfiguration(**kwargs) diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/base_client_async.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/base_client_async.py similarity index 78% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/base_client_async.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/base_client_async.py index 6186b29..f39a57b 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/base_client_async.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/base_client_async.py @@ -64,18 +64,26 @@ async def __aenter__(self): async def __aexit__(self, *args): await self._client.__aexit__(*args) - async def close(self): - """ This method is to close the sockets opened by the client. + async def close(self) -> None: + """This method is to close the sockets opened by the client. It need not be used when using with a context manager. + + :return: None + :rtype: None """ await self._client.close() def _format_query_string( - self, sas_token: Optional[str], - credential: Optional[Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", AsyncTokenCredential]], # pylint: disable=line-too-long + self, + sas_token: Optional[str], + credential: Optional[ + Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", AsyncTokenCredential] + ], snapshot: Optional[str] = None, - share_snapshot: Optional[str] = None - ) -> Tuple[str, Optional[Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", AsyncTokenCredential]]]: # pylint: disable=line-too-long + share_snapshot: Optional[str] = None, + ) -> Tuple[ + str, Optional[Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", AsyncTokenCredential]] + ]: query_str = "?" if snapshot: query_str += f"snapshot={snapshot}&" @@ -83,7 +91,8 @@ def _format_query_string( query_str += f"sharesnapshot={share_snapshot}&" if sas_token and isinstance(credential, AzureSasCredential): raise ValueError( - "You cannot use AzureSasCredential when the resource URI also contains a Shared Access Signature.") + "You cannot use AzureSasCredential when the resource URI also contains a Shared Access Signature." + ) if _is_credential_sastoken(credential): query_str += credential.lstrip("?") # type: ignore [union-attr] credential = None @@ -92,35 +101,40 @@ def _format_query_string( return query_str.rstrip("?&"), credential def _create_pipeline( - self, credential: Optional[Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, AsyncTokenCredential]] = None, # pylint: disable=line-too-long - **kwargs: Any + self, + credential: Optional[ + Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, AsyncTokenCredential] + ] = None, + **kwargs: Any, ) -> Tuple[StorageConfiguration, AsyncPipeline]: self._credential_policy: Optional[ - Union[AsyncStorageBearerTokenCredentialPolicy, - SharedKeyCredentialPolicy, - AzureSasCredentialPolicy]] = None - if hasattr(credential, 'get_token'): - if kwargs.get('audience'): - audience = str(kwargs.pop('audience')).rstrip('/') + DEFAULT_OAUTH_SCOPE + Union[AsyncStorageBearerTokenCredentialPolicy, SharedKeyCredentialPolicy, AzureSasCredentialPolicy] + ] = None + if hasattr(credential, "get_token"): + if kwargs.get("audience"): + audience = str(kwargs.pop("audience")).rstrip("/") + DEFAULT_OAUTH_SCOPE else: audience = STORAGE_OAUTH_SCOPE self._credential_policy = AsyncStorageBearerTokenCredentialPolicy( - cast(AsyncTokenCredential, credential), audience) + cast(AsyncTokenCredential, credential), audience + ) elif isinstance(credential, SharedKeyCredentialPolicy): self._credential_policy = credential elif isinstance(credential, AzureSasCredential): self._credential_policy = AzureSasCredentialPolicy(credential) elif credential is not None: raise TypeError(f"Unsupported credential: {type(credential)}") - config = kwargs.get('_configuration') or create_configuration(**kwargs) - if kwargs.get('_pipeline'): - return config, kwargs['_pipeline'] - transport = kwargs.get('transport') + config = kwargs.get("_configuration") or create_configuration(**kwargs) + if kwargs.get("_pipeline"): + return config, kwargs["_pipeline"] + transport = kwargs.get("transport") kwargs.setdefault("connection_timeout", CONNECTION_TIMEOUT) kwargs.setdefault("read_timeout", READ_TIMEOUT) if not transport: try: - from azure.core.pipeline.transport import AioHttpTransport # pylint: disable=non-abstract-transport-import + from azure.core.pipeline.transport import ( # pylint: disable=non-abstract-transport-import + AioHttpTransport, + ) except ImportError as exc: raise ImportError("Unable to create async transport. Please check aiohttp is installed.") from exc transport = AioHttpTransport(**kwargs) @@ -143,53 +157,41 @@ def _create_pipeline( HttpLoggingPolicy(**kwargs), ] if kwargs.get("_additional_pipeline_policies"): - policies = policies + kwargs.get("_additional_pipeline_policies") #type: ignore - config.transport = transport #type: ignore - return config, AsyncPipeline(transport, policies=policies) #type: ignore + policies = policies + kwargs.get("_additional_pipeline_policies") # type: ignore + config.transport = transport # type: ignore + return config, AsyncPipeline(transport, policies=policies) # type: ignore - async def _batch_send( - self, - *reqs: "HttpRequest", - **kwargs: Any - ) -> AsyncList["HttpResponse"]: + async def _batch_send(self, *reqs: "HttpRequest", **kwargs: Any) -> AsyncList["HttpResponse"]: """Given a series of request, do a Storage batch call. :param HttpRequest reqs: A collection of HttpRequest objects. - :returns: An AsyncList of HttpResponse objects. + :return: An AsyncList of HttpResponse objects. :rtype: AsyncList[HttpResponse] """ # Pop it here, so requests doesn't feel bad about additional kwarg raise_on_any_failure = kwargs.pop("raise_on_any_failure", True) request = self._client._client.post( # pylint: disable=protected-access url=( - f'{self.scheme}://{self.primary_hostname}/' + f"{self.scheme}://{self.primary_hostname}/" f"{kwargs.pop('path', '')}?{kwargs.pop('restype', '')}" f"comp=batch{kwargs.pop('sas', '')}{kwargs.pop('timeout', '')}" ), - headers={ - 'x-ms-version': self.api_version - } + headers={"x-ms-version": self.api_version}, ) policies = [StorageHeadersPolicy()] if self._credential_policy: policies.append(self._credential_policy) # type: ignore - request.set_multipart_mixed( - *reqs, - policies=policies, - enforce_https=False - ) + request.set_multipart_mixed(*reqs, policies=policies, enforce_https=False) - pipeline_response = await self._pipeline.run( - request, **kwargs - ) + pipeline_response = await self._pipeline.run(request, **kwargs) response = pipeline_response.http_response try: if response.status_code not in [202]: raise HttpResponseError(response=response) - parts = response.parts() # Return an AsyncIterator + parts = response.parts() # Return an AsyncIterator if raise_on_any_failure: parts_list = [] async for part in parts: @@ -197,7 +199,8 @@ async def _batch_send( if any(p for p in parts_list if not 200 <= p.status_code < 300): error = PartialBatchErrorException( message="There is a partial failure in the batch operation.", - response=response, parts=parts_list + response=response, + parts=parts_list, ) raise error return AsyncList(parts_list) @@ -205,11 +208,16 @@ async def _batch_send( except HttpResponseError as error: process_storage_error(error) + def parse_connection_str( conn_str: str, credential: Optional[Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, AsyncTokenCredential]], - service: str -) -> Tuple[str, Optional[str], Optional[Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, AsyncTokenCredential]]]: # pylint: disable=line-too-long + service: str, +) -> Tuple[ + str, + Optional[str], + Optional[Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, AsyncTokenCredential]], +]: conn_str = conn_str.rstrip(";") conn_settings_list = [s.split("=", 1) for s in conn_str.split(";")] if any(len(tup) != 2 for tup in conn_settings_list): @@ -231,14 +239,11 @@ def parse_connection_str( if endpoints["secondary"] in conn_settings: raise ValueError("Connection string specifies only secondary endpoint.") try: - primary =( + primary = ( f"{conn_settings['DEFAULTENDPOINTSPROTOCOL']}://" f"{conn_settings['ACCOUNTNAME']}.{service}.{conn_settings['ENDPOINTSUFFIX']}" ) - secondary = ( - f"{conn_settings['ACCOUNTNAME']}-secondary." - f"{service}.{conn_settings['ENDPOINTSUFFIX']}" - ) + secondary = f"{conn_settings['ACCOUNTNAME']}-secondary." f"{service}.{conn_settings['ENDPOINTSUFFIX']}" except KeyError: pass @@ -256,11 +261,13 @@ def parse_connection_str( secondary = secondary.replace(".blob.", ".dfs.") return primary, secondary, credential + class AsyncTransportWrapper(AsyncHttpTransport): """Wrapper class that ensures that an inner client created by a `get_client` method does not close the outer transport for the parent when used in a context manager. """ + def __init__(self, async_transport): self._transport = async_transport diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/constants.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/constants.py similarity index 93% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/constants.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/constants.py index 0b4b029..0926f04 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/constants.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/constants.py @@ -16,4 +16,4 @@ DEFAULT_OAUTH_SCOPE = "/.default" STORAGE_OAUTH_SCOPE = "https://storage.azure.com/.default" -SERVICE_HOST_BASE = 'core.windows.net' +SERVICE_HOST_BASE = "core.windows.net" diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/models.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/models.py similarity index 80% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/models.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/models.py index 403e6b8..185d588 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/models.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/models.py @@ -22,6 +22,7 @@ def get_enum_value(value): class StorageErrorCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Error codes returned by the service.""" # Generic storage values ACCOUNT_ALREADY_EXISTS = "AccountAlreadyExists" @@ -172,26 +173,26 @@ class StorageErrorCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): CONTAINER_QUOTA_DOWNGRADE_NOT_ALLOWED = "ContainerQuotaDowngradeNotAllowed" # DataLake values - CONTENT_LENGTH_MUST_BE_ZERO = 'ContentLengthMustBeZero' - PATH_ALREADY_EXISTS = 'PathAlreadyExists' - INVALID_FLUSH_POSITION = 'InvalidFlushPosition' - INVALID_PROPERTY_NAME = 'InvalidPropertyName' - INVALID_SOURCE_URI = 'InvalidSourceUri' - UNSUPPORTED_REST_VERSION = 'UnsupportedRestVersion' - FILE_SYSTEM_NOT_FOUND = 'FilesystemNotFound' - PATH_NOT_FOUND = 'PathNotFound' - RENAME_DESTINATION_PARENT_PATH_NOT_FOUND = 'RenameDestinationParentPathNotFound' - SOURCE_PATH_NOT_FOUND = 'SourcePathNotFound' - DESTINATION_PATH_IS_BEING_DELETED = 'DestinationPathIsBeingDeleted' - FILE_SYSTEM_ALREADY_EXISTS = 'FilesystemAlreadyExists' - FILE_SYSTEM_BEING_DELETED = 'FilesystemBeingDeleted' - INVALID_DESTINATION_PATH = 'InvalidDestinationPath' - INVALID_RENAME_SOURCE_PATH = 'InvalidRenameSourcePath' - INVALID_SOURCE_OR_DESTINATION_RESOURCE_TYPE = 'InvalidSourceOrDestinationResourceType' - LEASE_IS_ALREADY_BROKEN = 'LeaseIsAlreadyBroken' - LEASE_NAME_MISMATCH = 'LeaseNameMismatch' - PATH_CONFLICT = 'PathConflict' - SOURCE_PATH_IS_BEING_DELETED = 'SourcePathIsBeingDeleted' + CONTENT_LENGTH_MUST_BE_ZERO = "ContentLengthMustBeZero" + PATH_ALREADY_EXISTS = "PathAlreadyExists" + INVALID_FLUSH_POSITION = "InvalidFlushPosition" + INVALID_PROPERTY_NAME = "InvalidPropertyName" + INVALID_SOURCE_URI = "InvalidSourceUri" + UNSUPPORTED_REST_VERSION = "UnsupportedRestVersion" + FILE_SYSTEM_NOT_FOUND = "FilesystemNotFound" + PATH_NOT_FOUND = "PathNotFound" + RENAME_DESTINATION_PARENT_PATH_NOT_FOUND = "RenameDestinationParentPathNotFound" + SOURCE_PATH_NOT_FOUND = "SourcePathNotFound" + DESTINATION_PATH_IS_BEING_DELETED = "DestinationPathIsBeingDeleted" + FILE_SYSTEM_ALREADY_EXISTS = "FilesystemAlreadyExists" + FILE_SYSTEM_BEING_DELETED = "FilesystemBeingDeleted" + INVALID_DESTINATION_PATH = "InvalidDestinationPath" + INVALID_RENAME_SOURCE_PATH = "InvalidRenameSourcePath" + INVALID_SOURCE_OR_DESTINATION_RESOURCE_TYPE = "InvalidSourceOrDestinationResourceType" + LEASE_IS_ALREADY_BROKEN = "LeaseIsAlreadyBroken" + LEASE_NAME_MISMATCH = "LeaseNameMismatch" + PATH_CONFLICT = "PathConflict" + SOURCE_PATH_IS_BEING_DELETED = "SourcePathIsBeingDeleted" class DictMixin(object): @@ -222,7 +223,7 @@ def __ne__(self, other): return not self.__eq__(other) def __str__(self): - return str({k: v for k, v in self.__dict__.items() if not k.startswith('_')}) + return str({k: v for k, v in self.__dict__.items() if not k.startswith("_")}) def __contains__(self, key): return key in self.__dict__ @@ -234,13 +235,13 @@ def update(self, *args, **kwargs): return self.__dict__.update(*args, **kwargs) def keys(self): - return [k for k in self.__dict__ if not k.startswith('_')] + return [k for k in self.__dict__ if not k.startswith("_")] def values(self): - return [v for k, v in self.__dict__.items() if not k.startswith('_')] + return [v for k, v in self.__dict__.items() if not k.startswith("_")] def items(self): - return [(k, v) for k, v in self.__dict__.items() if not k.startswith('_')] + return [(k, v) for k, v in self.__dict__.items() if not k.startswith("_")] def get(self, key, default=None): if key in self.__dict__: @@ -255,8 +256,8 @@ class LocationMode(object): must use PRIMARY. """ - PRIMARY = 'primary' #: Requests should be sent to the primary location. - SECONDARY = 'secondary' #: Requests should be sent to the secondary location, if possible. + PRIMARY = "primary" #: Requests should be sent to the primary location. + SECONDARY = "secondary" #: Requests should be sent to the secondary location, if possible. class ResourceTypes(object): @@ -281,17 +282,12 @@ class ResourceTypes(object): _str: str def __init__( - self, - service: bool = False, - container: bool = False, - object: bool = False # pylint: disable=redefined-builtin + self, service: bool = False, container: bool = False, object: bool = False # pylint: disable=redefined-builtin ) -> None: self.service = service self.container = container self.object = object - self._str = (('s' if self.service else '') + - ('c' if self.container else '') + - ('o' if self.object else '')) + self._str = ("s" if self.service else "") + ("c" if self.container else "") + ("o" if self.object else "") def __str__(self): return self._str @@ -309,9 +305,9 @@ def from_string(cls, string): :return: A ResourceTypes object :rtype: ~azure.storage.fileshare.ResourceTypes """ - res_service = 's' in string - res_container = 'c' in string - res_object = 'o' in string + res_service = "s" in string + res_container = "c" in string + res_object = "o" in string parsed = cls(res_service, res_container, res_object) parsed._str = string @@ -392,29 +388,30 @@ def __init__( self.write = write self.delete = delete self.delete_previous_version = delete_previous_version - self.permanent_delete = kwargs.pop('permanent_delete', False) + self.permanent_delete = kwargs.pop("permanent_delete", False) self.list = list self.add = add self.create = create self.update = update self.process = process - self.tag = kwargs.pop('tag', False) - self.filter_by_tags = kwargs.pop('filter_by_tags', False) - self.set_immutability_policy = kwargs.pop('set_immutability_policy', False) - self._str = (('r' if self.read else '') + - ('w' if self.write else '') + - ('d' if self.delete else '') + - ('x' if self.delete_previous_version else '') + - ('y' if self.permanent_delete else '') + - ('l' if self.list else '') + - ('a' if self.add else '') + - ('c' if self.create else '') + - ('u' if self.update else '') + - ('p' if self.process else '') + - ('f' if self.filter_by_tags else '') + - ('t' if self.tag else '') + - ('i' if self.set_immutability_policy else '') - ) + self.tag = kwargs.pop("tag", False) + self.filter_by_tags = kwargs.pop("filter_by_tags", False) + self.set_immutability_policy = kwargs.pop("set_immutability_policy", False) + self._str = ( + ("r" if self.read else "") + + ("w" if self.write else "") + + ("d" if self.delete else "") + + ("x" if self.delete_previous_version else "") + + ("y" if self.permanent_delete else "") + + ("l" if self.list else "") + + ("a" if self.add else "") + + ("c" if self.create else "") + + ("u" if self.update else "") + + ("p" if self.process else "") + + ("f" if self.filter_by_tags else "") + + ("t" if self.tag else "") + + ("i" if self.set_immutability_policy else "") + ) def __str__(self): return self._str @@ -432,23 +429,34 @@ def from_string(cls, permission): :return: An AccountSasPermissions object :rtype: ~azure.storage.fileshare.AccountSasPermissions """ - p_read = 'r' in permission - p_write = 'w' in permission - p_delete = 'd' in permission - p_delete_previous_version = 'x' in permission - p_permanent_delete = 'y' in permission - p_list = 'l' in permission - p_add = 'a' in permission - p_create = 'c' in permission - p_update = 'u' in permission - p_process = 'p' in permission - p_tag = 't' in permission - p_filter_by_tags = 'f' in permission - p_set_immutability_policy = 'i' in permission - parsed = cls(read=p_read, write=p_write, delete=p_delete, delete_previous_version=p_delete_previous_version, - list=p_list, add=p_add, create=p_create, update=p_update, process=p_process, tag=p_tag, - filter_by_tags=p_filter_by_tags, set_immutability_policy=p_set_immutability_policy, - permanent_delete=p_permanent_delete) + p_read = "r" in permission + p_write = "w" in permission + p_delete = "d" in permission + p_delete_previous_version = "x" in permission + p_permanent_delete = "y" in permission + p_list = "l" in permission + p_add = "a" in permission + p_create = "c" in permission + p_update = "u" in permission + p_process = "p" in permission + p_tag = "t" in permission + p_filter_by_tags = "f" in permission + p_set_immutability_policy = "i" in permission + parsed = cls( + read=p_read, + write=p_write, + delete=p_delete, + delete_previous_version=p_delete_previous_version, + list=p_list, + add=p_add, + create=p_create, + update=p_update, + process=p_process, + tag=p_tag, + filter_by_tags=p_filter_by_tags, + set_immutability_policy=p_set_immutability_policy, + permanent_delete=p_permanent_delete, + ) return parsed @@ -464,18 +472,11 @@ class Services(object): Access for the `~azure.storage.fileshare.ShareServiceClient`. Default is False. """ - def __init__( - self, *, - blob: bool = False, - queue: bool = False, - fileshare: bool = False - ) -> None: + def __init__(self, *, blob: bool = False, queue: bool = False, fileshare: bool = False) -> None: self.blob = blob self.queue = queue self.fileshare = fileshare - self._str = (('b' if self.blob else '') + - ('q' if self.queue else '') + - ('f' if self.fileshare else '')) + self._str = ("b" if self.blob else "") + ("q" if self.queue else "") + ("f" if self.fileshare else "") def __str__(self): return self._str @@ -493,9 +494,9 @@ def from_string(cls, string): :return: A Services object :rtype: ~azure.storage.fileshare.Services """ - res_blob = 'b' in string - res_queue = 'q' in string - res_file = 'f' in string + res_blob = "b" in string + res_queue = "q" in string + res_file = "f" in string parsed = cls(blob=res_blob, queue=res_queue, fileshare=res_file) parsed._str = string @@ -573,13 +574,13 @@ class StorageConfiguration(Configuration): def __init__(self, **kwargs): super(StorageConfiguration, self).__init__(**kwargs) - self.max_single_put_size = kwargs.pop('max_single_put_size', 64 * 1024 * 1024) + self.max_single_put_size = kwargs.pop("max_single_put_size", 64 * 1024 * 1024) self.copy_polling_interval = 15 - self.max_block_size = kwargs.pop('max_block_size', 4 * 1024 * 1024) - self.min_large_block_upload_threshold = kwargs.get('min_large_block_upload_threshold', 4 * 1024 * 1024 + 1) - self.use_byte_buffer = kwargs.pop('use_byte_buffer', False) - self.max_page_size = kwargs.pop('max_page_size', 4 * 1024 * 1024) - self.min_large_chunk_upload_threshold = kwargs.pop('min_large_chunk_upload_threshold', 100 * 1024 * 1024 + 1) - self.max_single_get_size = kwargs.pop('max_single_get_size', 32 * 1024 * 1024) - self.max_chunk_get_size = kwargs.pop('max_chunk_get_size', 4 * 1024 * 1024) - self.max_range_size = kwargs.pop('max_range_size', 4 * 1024 * 1024) + self.max_block_size = kwargs.pop("max_block_size", 4 * 1024 * 1024) + self.min_large_block_upload_threshold = kwargs.get("min_large_block_upload_threshold", 4 * 1024 * 1024 + 1) + self.use_byte_buffer = kwargs.pop("use_byte_buffer", False) + self.max_page_size = kwargs.pop("max_page_size", 4 * 1024 * 1024) + self.min_large_chunk_upload_threshold = kwargs.pop("min_large_chunk_upload_threshold", 100 * 1024 * 1024 + 1) + self.max_single_get_size = kwargs.pop("max_single_get_size", 32 * 1024 * 1024) + self.max_chunk_get_size = kwargs.pop("max_chunk_get_size", 4 * 1024 * 1024) + self.max_range_size = kwargs.pop("max_range_size", 4 * 1024 * 1024) diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/parser.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/parser.py similarity index 90% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/parser.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/parser.py index 112c198..e4fcb8f 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/parser.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/parser.py @@ -12,14 +12,14 @@ def _to_utc_datetime(value: datetime) -> str: - return value.strftime('%Y-%m-%dT%H:%M:%SZ') + return value.strftime("%Y-%m-%dT%H:%M:%SZ") def _rfc_1123_to_datetime(rfc_1123: str) -> Optional[datetime]: """Converts an RFC 1123 date string to a UTC datetime. :param str rfc_1123: The time and date in RFC 1123 format. - :returns: The time and date in UTC datetime format. + :return: The time and date in UTC datetime format. :rtype: datetime """ if not rfc_1123: @@ -33,7 +33,7 @@ def _filetime_to_datetime(filetime: str) -> Optional[datetime]: If parsing MS Filetime fails, tries RFC 1123 as backup. :param str filetime: The time and date in MS filetime format. - :returns: The time and date in UTC datetime format. + :return: The time and date in UTC datetime format. :rtype: datetime """ if not filetime: diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/policies.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/policies.py similarity index 69% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/policies.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/policies.py index ee75cd5..a08fee7 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/policies.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/policies.py @@ -28,7 +28,7 @@ HTTPPolicy, NetworkTraceLoggingPolicy, RequestHistory, - SansIOHTTPPolicy + SansIOHTTPPolicy, ) from .authentication import AzureSigningError, StorageHttpChallenge @@ -39,7 +39,7 @@ from azure.core.credentials import TokenCredential from azure.core.pipeline.transport import ( # pylint: disable=non-abstract-transport-import PipelineRequest, - PipelineResponse + PipelineResponse, ) @@ -48,14 +48,14 @@ def encode_base64(data): if isinstance(data, str): - data = data.encode('utf-8') + data = data.encode("utf-8") encoded = base64.b64encode(data) - return encoded.decode('utf-8') + return encoded.decode("utf-8") # Are we out of retries? def is_exhausted(settings): - retry_counts = (settings['total'], settings['connect'], settings['read'], settings['status']) + retry_counts = (settings["total"], settings["connect"], settings["read"], settings["status"]) retry_counts = list(filter(None, retry_counts)) if not retry_counts: return False @@ -63,8 +63,8 @@ def is_exhausted(settings): def retry_hook(settings, **kwargs): - if settings['hook']: - settings['hook'](retry_count=settings['count'] - 1, location_mode=settings['mode'], **kwargs) + if settings["hook"]: + settings["hook"](retry_count=settings["count"] - 1, location_mode=settings["mode"], **kwargs) # Is this method/status code retryable? (Based on allowlists and control @@ -95,40 +95,39 @@ def is_retry(response, mode): def is_checksum_retry(response): # retry if invalid content md5 - if response.context.get('validate_content', False) and response.http_response.headers.get('content-md5'): - computed_md5 = response.http_request.headers.get('content-md5', None) or \ - encode_base64(StorageContentValidation.get_content_md5(response.http_response.body())) - if response.http_response.headers['content-md5'] != computed_md5: + if response.context.get("validate_content", False) and response.http_response.headers.get("content-md5"): + computed_md5 = response.http_request.headers.get("content-md5", None) or encode_base64( + StorageContentValidation.get_content_md5(response.http_response.body()) + ) + if response.http_response.headers["content-md5"] != computed_md5: return True return False def urljoin(base_url, stub_url): parsed = urlparse(base_url) - parsed = parsed._replace(path=parsed.path + '/' + stub_url) + parsed = parsed._replace(path=parsed.path + "/" + stub_url) return parsed.geturl() class QueueMessagePolicy(SansIOHTTPPolicy): def on_request(self, request): - message_id = request.context.options.pop('queue_message_id', None) + message_id = request.context.options.pop("queue_message_id", None) if message_id: - request.http_request.url = urljoin( - request.http_request.url, - message_id) + request.http_request.url = urljoin(request.http_request.url, message_id) class StorageHeadersPolicy(HeadersPolicy): - request_id_header_name = 'x-ms-client-request-id' + request_id_header_name = "x-ms-client-request-id" def on_request(self, request: "PipelineRequest") -> None: super(StorageHeadersPolicy, self).on_request(request) current_time = format_date_time(time()) - request.http_request.headers['x-ms-date'] = current_time + request.http_request.headers["x-ms-date"] = current_time - custom_id = request.context.options.pop('client_request_id', None) - request.http_request.headers['x-ms-client-request-id'] = custom_id or str(uuid.uuid1()) + custom_id = request.context.options.pop("client_request_id", None) + request.http_request.headers["x-ms-client-request-id"] = custom_id or str(uuid.uuid1()) # def on_response(self, request, response): # # raise exception if the echoed client request id from the service is not identical to the one we sent @@ -153,7 +152,7 @@ def __init__(self, hosts=None, **kwargs): # pylint: disable=unused-argument super(StorageHosts, self).__init__() def on_request(self, request: "PipelineRequest") -> None: - request.context.options['hosts'] = self.hosts + request.context.options["hosts"] = self.hosts parsed_url = urlparse(request.http_request.url) # Detect what location mode we're currently requesting with @@ -163,10 +162,10 @@ def on_request(self, request: "PipelineRequest") -> None: location_mode = key # See if a specific location mode has been specified, and if so, redirect - use_location = request.context.options.pop('use_location', None) + use_location = request.context.options.pop("use_location", None) if use_location: # Lock retries to the specific location - request.context.options['retry_to_secondary'] = False + request.context.options["retry_to_secondary"] = False if use_location not in self.hosts: raise ValueError(f"Attempting to use undefined host location {use_location}") if use_location != location_mode: @@ -175,7 +174,7 @@ def on_request(self, request: "PipelineRequest") -> None: request.http_request.url = updated.geturl() location_mode = use_location - request.context.options['location_mode'] = location_mode + request.context.options["location_mode"] = location_mode class StorageLoggingPolicy(NetworkTraceLoggingPolicy): @@ -200,19 +199,19 @@ def on_request(self, request: "PipelineRequest") -> None: try: log_url = http_request.url query_params = http_request.query - if 'sig' in query_params: - log_url = log_url.replace(query_params['sig'], "sig=*****") + if "sig" in query_params: + log_url = log_url.replace(query_params["sig"], "sig=*****") _LOGGER.debug("Request URL: %r", log_url) _LOGGER.debug("Request method: %r", http_request.method) _LOGGER.debug("Request headers:") for header, value in http_request.headers.items(): - if header.lower() == 'authorization': - value = '*****' - elif header.lower() == 'x-ms-copy-source' and 'sig' in value: + if header.lower() == "authorization": + value = "*****" + elif header.lower() == "x-ms-copy-source" and "sig" in value: # take the url apart and scrub away the signed signature scheme, netloc, path, params, query, fragment = urlparse(value) parsed_qs = dict(parse_qsl(query)) - parsed_qs['sig'] = '*****' + parsed_qs["sig"] = "*****" # the SAS needs to be put back together value = urlunparse((scheme, netloc, path, params, urlencode(parsed_qs), fragment)) @@ -242,11 +241,11 @@ def on_response(self, request: "PipelineRequest", response: "PipelineResponse") # We don't want to log binary data if the response is a file. _LOGGER.debug("Response content:") pattern = re.compile(r'attachment; ?filename=["\w.]+', re.IGNORECASE) - header = response.http_response.headers.get('content-disposition') + header = response.http_response.headers.get("content-disposition") resp_content_type = response.http_response.headers.get("content-type", "") if header and pattern.match(header): - filename = header.partition('=')[2] + filename = header.partition("=")[2] _LOGGER.debug("File attachments: %s", filename) elif resp_content_type.endswith("octet-stream"): _LOGGER.debug("Body contains binary data.") @@ -268,11 +267,11 @@ def on_response(self, request: "PipelineRequest", response: "PipelineResponse") class StorageRequestHook(SansIOHTTPPolicy): def __init__(self, **kwargs): - self._request_callback = kwargs.get('raw_request_hook') + self._request_callback = kwargs.get("raw_request_hook") super(StorageRequestHook, self).__init__() def on_request(self, request: "PipelineRequest") -> None: - request_callback = request.context.options.pop('raw_request_hook', self._request_callback) + request_callback = request.context.options.pop("raw_request_hook", self._request_callback) if request_callback: request_callback(request) @@ -280,49 +279,50 @@ def on_request(self, request: "PipelineRequest") -> None: class StorageResponseHook(HTTPPolicy): def __init__(self, **kwargs): - self._response_callback = kwargs.get('raw_response_hook') + self._response_callback = kwargs.get("raw_response_hook") super(StorageResponseHook, self).__init__() def send(self, request: "PipelineRequest") -> "PipelineResponse": # Values could be 0 - data_stream_total = request.context.get('data_stream_total') + data_stream_total = request.context.get("data_stream_total") if data_stream_total is None: - data_stream_total = request.context.options.pop('data_stream_total', None) - download_stream_current = request.context.get('download_stream_current') + data_stream_total = request.context.options.pop("data_stream_total", None) + download_stream_current = request.context.get("download_stream_current") if download_stream_current is None: - download_stream_current = request.context.options.pop('download_stream_current', None) - upload_stream_current = request.context.get('upload_stream_current') + download_stream_current = request.context.options.pop("download_stream_current", None) + upload_stream_current = request.context.get("upload_stream_current") if upload_stream_current is None: - upload_stream_current = request.context.options.pop('upload_stream_current', None) + upload_stream_current = request.context.options.pop("upload_stream_current", None) - response_callback = request.context.get('response_callback') or \ - request.context.options.pop('raw_response_hook', self._response_callback) + response_callback = request.context.get("response_callback") or request.context.options.pop( + "raw_response_hook", self._response_callback + ) response = self.next.send(request) - will_retry = is_retry(response, request.context.options.get('mode')) or is_checksum_retry(response) + will_retry = is_retry(response, request.context.options.get("mode")) or is_checksum_retry(response) # Auth error could come from Bearer challenge, in which case this request will be made again is_auth_error = response.http_response.status_code == 401 should_update_counts = not (will_retry or is_auth_error) if should_update_counts and download_stream_current is not None: - download_stream_current += int(response.http_response.headers.get('Content-Length', 0)) + download_stream_current += int(response.http_response.headers.get("Content-Length", 0)) if data_stream_total is None: - content_range = response.http_response.headers.get('Content-Range') + content_range = response.http_response.headers.get("Content-Range") if content_range: - data_stream_total = int(content_range.split(' ', 1)[1].split('/', 1)[1]) + data_stream_total = int(content_range.split(" ", 1)[1].split("/", 1)[1]) else: data_stream_total = download_stream_current elif should_update_counts and upload_stream_current is not None: - upload_stream_current += int(response.http_request.headers.get('Content-Length', 0)) + upload_stream_current += int(response.http_request.headers.get("Content-Length", 0)) for pipeline_obj in [request, response]: - if hasattr(pipeline_obj, 'context'): - pipeline_obj.context['data_stream_total'] = data_stream_total - pipeline_obj.context['download_stream_current'] = download_stream_current - pipeline_obj.context['upload_stream_current'] = upload_stream_current + if hasattr(pipeline_obj, "context"): + pipeline_obj.context["data_stream_total"] = data_stream_total + pipeline_obj.context["download_stream_current"] = download_stream_current + pipeline_obj.context["upload_stream_current"] = upload_stream_current if response_callback: response_callback(response) - request.context['response_callback'] = response_callback + request.context["response_callback"] = response_callback return response @@ -332,7 +332,8 @@ class StorageContentValidation(SansIOHTTPPolicy): This will overwrite any headers already defined in the request. """ - header_name = 'Content-MD5' + + header_name = "Content-MD5" def __init__(self, **kwargs: Any) -> None: # pylint: disable=unused-argument super(StorageContentValidation, self).__init__() @@ -342,10 +343,10 @@ def get_content_md5(data): # Since HTTP does not differentiate between no content and empty content, # we have to perform a None check. data = data or b"" - md5 = hashlib.md5() # nosec + md5 = hashlib.md5() # nosec if isinstance(data, bytes): md5.update(data) - elif hasattr(data, 'read'): + elif hasattr(data, "read"): pos = 0 try: pos = data.tell() @@ -363,22 +364,25 @@ def get_content_md5(data): return md5.digest() def on_request(self, request: "PipelineRequest") -> None: - validate_content = request.context.options.pop('validate_content', False) - if validate_content and request.http_request.method != 'GET': + validate_content = request.context.options.pop("validate_content", False) + if validate_content and request.http_request.method != "GET": computed_md5 = encode_base64(StorageContentValidation.get_content_md5(request.http_request.data)) request.http_request.headers[self.header_name] = computed_md5 - request.context['validate_content_md5'] = computed_md5 - request.context['validate_content'] = validate_content + request.context["validate_content_md5"] = computed_md5 + request.context["validate_content"] = validate_content def on_response(self, request: "PipelineRequest", response: "PipelineResponse") -> None: - if response.context.get('validate_content', False) and response.http_response.headers.get('content-md5'): - computed_md5 = request.context.get('validate_content_md5') or \ - encode_base64(StorageContentValidation.get_content_md5(response.http_response.body())) - if response.http_response.headers['content-md5'] != computed_md5: - raise AzureError(( - f"MD5 mismatch. Expected value is '{response.http_response.headers['content-md5']}', " - f"computed value is '{computed_md5}'."), - response=response.http_response + if response.context.get("validate_content", False) and response.http_response.headers.get("content-md5"): + computed_md5 = request.context.get("validate_content_md5") or encode_base64( + StorageContentValidation.get_content_md5(response.http_response.body()) + ) + if response.http_response.headers["content-md5"] != computed_md5: + raise AzureError( + ( + f"MD5 mismatch. Expected value is '{response.http_response.headers['content-md5']}', " + f"computed value is '{computed_md5}'." + ), + response=response.http_response, ) @@ -399,33 +403,41 @@ class StorageRetryPolicy(HTTPPolicy): """Whether the secondary endpoint should be retried.""" def __init__(self, **kwargs: Any) -> None: - self.total_retries = kwargs.pop('retry_total', 10) - self.connect_retries = kwargs.pop('retry_connect', 3) - self.read_retries = kwargs.pop('retry_read', 3) - self.status_retries = kwargs.pop('retry_status', 3) - self.retry_to_secondary = kwargs.pop('retry_to_secondary', False) + self.total_retries = kwargs.pop("retry_total", 10) + self.connect_retries = kwargs.pop("retry_connect", 3) + self.read_retries = kwargs.pop("retry_read", 3) + self.status_retries = kwargs.pop("retry_status", 3) + self.retry_to_secondary = kwargs.pop("retry_to_secondary", False) super(StorageRetryPolicy, self).__init__() def _set_next_host_location(self, settings: Dict[str, Any], request: "PipelineRequest") -> None: """ A function which sets the next host location on the request, if applicable. - :param Dict[str, Any]] settings: The configurable values pertaining to the next host location. + :param Dict[str, Any] settings: The configurable values pertaining to the next host location. :param PipelineRequest request: A pipeline request object. """ - if settings['hosts'] and all(settings['hosts'].values()): + if settings["hosts"] and all(settings["hosts"].values()): url = urlparse(request.url) # If there's more than one possible location, retry to the alternative - if settings['mode'] == LocationMode.PRIMARY: - settings['mode'] = LocationMode.SECONDARY + if settings["mode"] == LocationMode.PRIMARY: + settings["mode"] = LocationMode.SECONDARY else: - settings['mode'] = LocationMode.PRIMARY - updated = url._replace(netloc=settings['hosts'].get(settings['mode'])) + settings["mode"] = LocationMode.PRIMARY + updated = url._replace(netloc=settings["hosts"].get(settings["mode"])) request.url = updated.geturl() def configure_retries(self, request: "PipelineRequest") -> Dict[str, Any]: + """ + Configure the retry settings for the request. + + :param request: A pipeline request object. + :type request: ~azure.core.pipeline.PipelineRequest + :return: A dictionary containing the retry settings. + :rtype: Dict[str, Any] + """ body_position = None - if hasattr(request.http_request.body, 'read'): + if hasattr(request.http_request.body, "read"): try: body_position = request.http_request.body.tell() except (AttributeError, UnsupportedOperation): @@ -433,129 +445,140 @@ def configure_retries(self, request: "PipelineRequest") -> Dict[str, Any]: pass options = request.context.options return { - 'total': options.pop("retry_total", self.total_retries), - 'connect': options.pop("retry_connect", self.connect_retries), - 'read': options.pop("retry_read", self.read_retries), - 'status': options.pop("retry_status", self.status_retries), - 'retry_secondary': options.pop("retry_to_secondary", self.retry_to_secondary), - 'mode': options.pop("location_mode", LocationMode.PRIMARY), - 'hosts': options.pop("hosts", None), - 'hook': options.pop("retry_hook", None), - 'body_position': body_position, - 'count': 0, - 'history': [] + "total": options.pop("retry_total", self.total_retries), + "connect": options.pop("retry_connect", self.connect_retries), + "read": options.pop("retry_read", self.read_retries), + "status": options.pop("retry_status", self.status_retries), + "retry_secondary": options.pop("retry_to_secondary", self.retry_to_secondary), + "mode": options.pop("location_mode", LocationMode.PRIMARY), + "hosts": options.pop("hosts", None), + "hook": options.pop("retry_hook", None), + "body_position": body_position, + "count": 0, + "history": [], } def get_backoff_time(self, settings: Dict[str, Any]) -> float: # pylint: disable=unused-argument - """ Formula for computing the current backoff. + """Formula for computing the current backoff. Should be calculated by child class. :param Dict[str, Any] settings: The configurable values pertaining to the backoff time. - :returns: The backoff time. + :return: The backoff time. :rtype: float """ return 0 def sleep(self, settings, transport): + """Sleep for the backoff time. + + :param Dict[str, Any] settings: The configurable values pertaining to the sleep operation. + :param transport: The transport to use for sleeping. + :type transport: + ~azure.core.pipeline.transport.AsyncioBaseTransport or + ~azure.core.pipeline.transport.BaseTransport + """ backoff = self.get_backoff_time(settings) if not backoff or backoff < 0: return transport.sleep(backoff) def increment( - self, settings: Dict[str, Any], + self, + settings: Dict[str, Any], request: "PipelineRequest", response: Optional["PipelineResponse"] = None, - error: Optional[AzureError] = None + error: Optional[AzureError] = None, ) -> bool: """Increment the retry counters. :param Dict[str, Any] settings: The configurable values pertaining to the increment operation. - :param PipelineRequest request: A pipeline request object. - :param Optional[PipelineResponse] response: A pipeline response object. - :param Optional[AzureError] error: An error encountered during the request, or + :param request: A pipeline request object. + :type request: ~azure.core.pipeline.PipelineRequest + :param response: A pipeline response object. + :type response: ~azure.core.pipeline.PipelineResponse or None + :param error: An error encountered during the request, or None if the response was received successfully. - :returns: Whether the retry attempts are exhausted. + :type error: ~azure.core.exceptions.AzureError or None + :return: Whether the retry attempts are exhausted. :rtype: bool """ - settings['total'] -= 1 + settings["total"] -= 1 if error and isinstance(error, ServiceRequestError): # Errors when we're fairly sure that the server did not receive the # request, so it should be safe to retry. - settings['connect'] -= 1 - settings['history'].append(RequestHistory(request, error=error)) + settings["connect"] -= 1 + settings["history"].append(RequestHistory(request, error=error)) elif error and isinstance(error, ServiceResponseError): # Errors that occur after the request has been started, so we should # assume that the server began processing it. - settings['read'] -= 1 - settings['history'].append(RequestHistory(request, error=error)) + settings["read"] -= 1 + settings["history"].append(RequestHistory(request, error=error)) else: # Incrementing because of a server error like a 500 in # status_forcelist and a the given method is in the allowlist if response: - settings['status'] -= 1 - settings['history'].append(RequestHistory(request, http_response=response)) + settings["status"] -= 1 + settings["history"].append(RequestHistory(request, http_response=response)) if not is_exhausted(settings): - if request.method not in ['PUT'] and settings['retry_secondary']: + if request.method not in ["PUT"] and settings["retry_secondary"]: self._set_next_host_location(settings, request) # rewind the request body if it is a stream - if request.body and hasattr(request.body, 'read'): + if request.body and hasattr(request.body, "read"): # no position was saved, then retry would not work - if settings['body_position'] is None: + if settings["body_position"] is None: return False try: # attempt to rewind the body to the initial position - request.body.seek(settings['body_position'], SEEK_SET) + request.body.seek(settings["body_position"], SEEK_SET) except (UnsupportedOperation, ValueError): # if body is not seekable, then retry would not work return False - settings['count'] += 1 + settings["count"] += 1 return True return False def send(self, request): + """Send the request with retry logic. + + :param request: A pipeline request object. + :type request: ~azure.core.pipeline.PipelineRequest + :return: A pipeline response object. + :rtype: ~azure.core.pipeline.PipelineResponse + """ retries_remaining = True response = None retry_settings = self.configure_retries(request) while retries_remaining: try: response = self.next.send(request) - if is_retry(response, retry_settings['mode']) or is_checksum_retry(response): + if is_retry(response, retry_settings["mode"]) or is_checksum_retry(response): retries_remaining = self.increment( - retry_settings, - request=request.http_request, - response=response.http_response) + retry_settings, request=request.http_request, response=response.http_response + ) if retries_remaining: retry_hook( - retry_settings, - request=request.http_request, - response=response.http_response, - error=None) + retry_settings, request=request.http_request, response=response.http_response, error=None + ) self.sleep(retry_settings, request.context.transport) continue break except AzureError as err: if isinstance(err, AzureSigningError): raise - retries_remaining = self.increment( - retry_settings, request=request.http_request, error=err) + retries_remaining = self.increment(retry_settings, request=request.http_request, error=err) if retries_remaining: - retry_hook( - retry_settings, - request=request.http_request, - response=None, - error=err) + retry_hook(retry_settings, request=request.http_request, response=None, error=err) self.sleep(retry_settings, request.context.transport) continue raise err - if retry_settings['history']: - response.context['history'] = retry_settings['history'] - response.http_response.location_mode = retry_settings['mode'] + if retry_settings["history"]: + response.context["history"] = retry_settings["history"] + response.http_response.location_mode = retry_settings["mode"] return response @@ -571,12 +594,13 @@ class ExponentialRetry(StorageRetryPolicy): """A number in seconds which indicates a range to jitter/randomize for the back-off interval.""" def __init__( - self, initial_backoff: int = 15, + self, + initial_backoff: int = 15, increment_base: int = 3, retry_total: int = 3, retry_to_secondary: bool = False, random_jitter_range: int = 3, - **kwargs: Any + **kwargs: Any, ) -> None: """ Constructs an Exponential retry object. The initial_backoff is used for @@ -601,21 +625,20 @@ def __init__( self.initial_backoff = initial_backoff self.increment_base = increment_base self.random_jitter_range = random_jitter_range - super(ExponentialRetry, self).__init__( - retry_total=retry_total, retry_to_secondary=retry_to_secondary, **kwargs) + super(ExponentialRetry, self).__init__(retry_total=retry_total, retry_to_secondary=retry_to_secondary, **kwargs) def get_backoff_time(self, settings: Dict[str, Any]) -> float: """ Calculates how long to sleep before retrying. - :param Dict[str, Any]] settings: The configurable values pertaining to get backoff time. - :returns: + :param Dict[str, Any] settings: The configurable values pertaining to get backoff time. + :return: A float indicating how long to wait before retrying the request, or None to indicate no retry should be performed. :rtype: float """ random_generator = random.Random() - backoff = self.initial_backoff + (0 if settings['count'] == 0 else pow(self.increment_base, settings['count'])) + backoff = self.initial_backoff + (0 if settings["count"] == 0 else pow(self.increment_base, settings["count"])) random_range_start = backoff - self.random_jitter_range if backoff > self.random_jitter_range else 0 random_range_end = backoff + self.random_jitter_range return random_generator.uniform(random_range_start, random_range_end) @@ -630,11 +653,12 @@ class LinearRetry(StorageRetryPolicy): """A number in seconds which indicates a range to jitter/randomize for the back-off interval.""" def __init__( - self, backoff: int = 15, + self, + backoff: int = 15, retry_total: int = 3, retry_to_secondary: bool = False, random_jitter_range: int = 3, - **kwargs: Any + **kwargs: Any, ) -> None: """ Constructs a Linear retry object. @@ -653,15 +677,14 @@ def __init__( """ self.backoff = backoff self.random_jitter_range = random_jitter_range - super(LinearRetry, self).__init__( - retry_total=retry_total, retry_to_secondary=retry_to_secondary, **kwargs) + super(LinearRetry, self).__init__(retry_total=retry_total, retry_to_secondary=retry_to_secondary, **kwargs) def get_backoff_time(self, settings: Dict[str, Any]) -> float: """ Calculates how long to sleep before retrying. - :param Dict[str, Any]] settings: The configurable values pertaining to the backoff time. - :returns: + :param Dict[str, Any] settings: The configurable values pertaining to the backoff time. + :return: A float indicating how long to wait before retrying the request, or None to indicate no retry should be performed. :rtype: float @@ -669,19 +692,27 @@ def get_backoff_time(self, settings: Dict[str, Any]) -> float: random_generator = random.Random() # the backoff interval normally does not change, however there is the possibility # that it was modified by accessing the property directly after initializing the object - random_range_start = self.backoff - self.random_jitter_range \ - if self.backoff > self.random_jitter_range else 0 + random_range_start = self.backoff - self.random_jitter_range if self.backoff > self.random_jitter_range else 0 random_range_end = self.backoff + self.random_jitter_range return random_generator.uniform(random_range_start, random_range_end) class StorageBearerTokenCredentialPolicy(BearerTokenCredentialPolicy): - """ Custom Bearer token credential policy for following Storage Bearer challenges """ + """Custom Bearer token credential policy for following Storage Bearer challenges""" def __init__(self, credential: "TokenCredential", audience: str, **kwargs: Any) -> None: super(StorageBearerTokenCredentialPolicy, self).__init__(credential, audience, **kwargs) def on_challenge(self, request: "PipelineRequest", response: "PipelineResponse") -> bool: + """Handle the challenge from the service and authorize the request. + + :param request: The request object. + :type request: ~azure.core.pipeline.PipelineRequest + :param response: The response object. + :type response: ~azure.core.pipeline.PipelineResponse + :return: True if the request was authorized, False otherwise. + :rtype: bool + """ try: auth_header = response.http_response.headers.get("WWW-Authenticate") challenge = StorageHttpChallenge(auth_header) diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/policies_async.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/policies_async.py similarity index 72% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/policies_async.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/policies_async.py index 1c030a8..4cb32f2 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/policies_async.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/policies_async.py @@ -5,7 +5,7 @@ # -------------------------------------------------------------------------- # pylint: disable=invalid-overridden-method -import asyncio +import asyncio # pylint: disable=do-not-import-asyncio import logging import random from typing import Any, Dict, TYPE_CHECKING @@ -21,7 +21,7 @@ from azure.core.credentials_async import AsyncTokenCredential from azure.core.pipeline.transport import ( # pylint: disable=non-abstract-transport-import PipelineRequest, - PipelineResponse + PipelineResponse, ) @@ -29,29 +29,25 @@ async def retry_hook(settings, **kwargs): - if settings['hook']: - if asyncio.iscoroutine(settings['hook']): - await settings['hook']( - retry_count=settings['count'] - 1, - location_mode=settings['mode'], - **kwargs) + if settings["hook"]: + if asyncio.iscoroutine(settings["hook"]): + await settings["hook"](retry_count=settings["count"] - 1, location_mode=settings["mode"], **kwargs) else: - settings['hook']( - retry_count=settings['count'] - 1, - location_mode=settings['mode'], - **kwargs) + settings["hook"](retry_count=settings["count"] - 1, location_mode=settings["mode"], **kwargs) async def is_checksum_retry(response): # retry if invalid content md5 - if response.context.get('validate_content', False) and response.http_response.headers.get('content-md5'): - try: - await response.http_response.load_body() # Load the body in memory and close the socket - except (StreamClosedError, StreamConsumedError): - pass - computed_md5 = response.http_request.headers.get('content-md5', None) or \ - encode_base64(StorageContentValidation.get_content_md5(response.http_response.body())) - if response.http_response.headers['content-md5'] != computed_md5: + if response.context.get("validate_content", False) and response.http_response.headers.get("content-md5"): + if hasattr(response.http_response, "load_body"): + try: + await response.http_response.load_body() # Load the body in memory and close the socket + except (StreamClosedError, StreamConsumedError): + pass + computed_md5 = response.http_request.headers.get("content-md5", None) or encode_base64( + StorageContentValidation.get_content_md5(response.http_response.body()) + ) + if response.http_response.headers["content-md5"] != computed_md5: return True return False @@ -59,54 +55,56 @@ async def is_checksum_retry(response): class AsyncStorageResponseHook(AsyncHTTPPolicy): def __init__(self, **kwargs): - self._response_callback = kwargs.get('raw_response_hook') + self._response_callback = kwargs.get("raw_response_hook") super(AsyncStorageResponseHook, self).__init__() async def send(self, request: "PipelineRequest") -> "PipelineResponse": # Values could be 0 - data_stream_total = request.context.get('data_stream_total') + data_stream_total = request.context.get("data_stream_total") if data_stream_total is None: - data_stream_total = request.context.options.pop('data_stream_total', None) - download_stream_current = request.context.get('download_stream_current') + data_stream_total = request.context.options.pop("data_stream_total", None) + download_stream_current = request.context.get("download_stream_current") if download_stream_current is None: - download_stream_current = request.context.options.pop('download_stream_current', None) - upload_stream_current = request.context.get('upload_stream_current') + download_stream_current = request.context.options.pop("download_stream_current", None) + upload_stream_current = request.context.get("upload_stream_current") if upload_stream_current is None: - upload_stream_current = request.context.options.pop('upload_stream_current', None) + upload_stream_current = request.context.options.pop("upload_stream_current", None) - response_callback = request.context.get('response_callback') or \ - request.context.options.pop('raw_response_hook', self._response_callback) + response_callback = request.context.get("response_callback") or request.context.options.pop( + "raw_response_hook", self._response_callback + ) response = await self.next.send(request) + will_retry = is_retry(response, request.context.options.get("mode")) or await is_checksum_retry(response) - will_retry = is_retry(response, request.context.options.get('mode')) or await is_checksum_retry(response) # Auth error could come from Bearer challenge, in which case this request will be made again is_auth_error = response.http_response.status_code == 401 should_update_counts = not (will_retry or is_auth_error) if should_update_counts and download_stream_current is not None: - download_stream_current += int(response.http_response.headers.get('Content-Length', 0)) + download_stream_current += int(response.http_response.headers.get("Content-Length", 0)) if data_stream_total is None: - content_range = response.http_response.headers.get('Content-Range') + content_range = response.http_response.headers.get("Content-Range") if content_range: - data_stream_total = int(content_range.split(' ', 1)[1].split('/', 1)[1]) + data_stream_total = int(content_range.split(" ", 1)[1].split("/", 1)[1]) else: data_stream_total = download_stream_current elif should_update_counts and upload_stream_current is not None: - upload_stream_current += int(response.http_request.headers.get('Content-Length', 0)) + upload_stream_current += int(response.http_request.headers.get("Content-Length", 0)) for pipeline_obj in [request, response]: - if hasattr(pipeline_obj, 'context'): - pipeline_obj.context['data_stream_total'] = data_stream_total - pipeline_obj.context['download_stream_current'] = download_stream_current - pipeline_obj.context['upload_stream_current'] = upload_stream_current + if hasattr(pipeline_obj, "context"): + pipeline_obj.context["data_stream_total"] = data_stream_total + pipeline_obj.context["download_stream_current"] = download_stream_current + pipeline_obj.context["upload_stream_current"] = upload_stream_current if response_callback: if asyncio.iscoroutine(response_callback): - await response_callback(response) # type: ignore + await response_callback(response) # type: ignore else: response_callback(response) - request.context['response_callback'] = response_callback + request.context["response_callback"] = response_callback return response + class AsyncStorageRetryPolicy(StorageRetryPolicy): """ The base class for Exponential and Linear retries containing shared code. @@ -125,37 +123,29 @@ async def send(self, request): while retries_remaining: try: response = await self.next.send(request) - if is_retry(response, retry_settings['mode']) or await is_checksum_retry(response): + if is_retry(response, retry_settings["mode"]) or await is_checksum_retry(response): retries_remaining = self.increment( - retry_settings, - request=request.http_request, - response=response.http_response) + retry_settings, request=request.http_request, response=response.http_response + ) if retries_remaining: await retry_hook( - retry_settings, - request=request.http_request, - response=response.http_response, - error=None) + retry_settings, request=request.http_request, response=response.http_response, error=None + ) await self.sleep(retry_settings, request.context.transport) continue break except AzureError as err: if isinstance(err, AzureSigningError): raise - retries_remaining = self.increment( - retry_settings, request=request.http_request, error=err) + retries_remaining = self.increment(retry_settings, request=request.http_request, error=err) if retries_remaining: - await retry_hook( - retry_settings, - request=request.http_request, - response=None, - error=err) + await retry_hook(retry_settings, request=request.http_request, response=None, error=err) await self.sleep(retry_settings, request.context.transport) continue raise err - if retry_settings['history']: - response.context['history'] = retry_settings['history'] - response.http_response.location_mode = retry_settings['mode'] + if retry_settings["history"]: + response.context["history"] = retry_settings["history"] + response.http_response.location_mode = retry_settings["mode"] return response @@ -176,7 +166,8 @@ def __init__( increment_base: int = 3, retry_total: int = 3, retry_to_secondary: bool = False, - random_jitter_range: int = 3, **kwargs + random_jitter_range: int = 3, + **kwargs ) -> None: """ Constructs an Exponential retry object. The initial_backoff is used for @@ -203,8 +194,7 @@ def __init__( self.initial_backoff = initial_backoff self.increment_base = increment_base self.random_jitter_range = random_jitter_range - super(ExponentialRetry, self).__init__( - retry_total=retry_total, retry_to_secondary=retry_to_secondary, **kwargs) + super(ExponentialRetry, self).__init__(retry_total=retry_total, retry_to_secondary=retry_to_secondary, **kwargs) def get_backoff_time(self, settings: Dict[str, Any]) -> float: """ @@ -217,7 +207,7 @@ def get_backoff_time(self, settings: Dict[str, Any]) -> float: :rtype: int or None """ random_generator = random.Random() - backoff = self.initial_backoff + (0 if settings['count'] == 0 else pow(self.increment_base, settings['count'])) + backoff = self.initial_backoff + (0 if settings["count"] == 0 else pow(self.increment_base, settings["count"])) random_range_start = backoff - self.random_jitter_range if backoff > self.random_jitter_range else 0 random_range_end = backoff + self.random_jitter_range return random_generator.uniform(random_range_start, random_range_end) @@ -232,7 +222,8 @@ class LinearRetry(AsyncStorageRetryPolicy): """A number in seconds which indicates a range to jitter/randomize for the back-off interval.""" def __init__( - self, backoff: int = 15, + self, + backoff: int = 15, retry_total: int = 3, retry_to_secondary: bool = False, random_jitter_range: int = 3, @@ -255,8 +246,7 @@ def __init__( """ self.backoff = backoff self.random_jitter_range = random_jitter_range - super(LinearRetry, self).__init__( - retry_total=retry_total, retry_to_secondary=retry_to_secondary, **kwargs) + super(LinearRetry, self).__init__(retry_total=retry_total, retry_to_secondary=retry_to_secondary, **kwargs) def get_backoff_time(self, settings: Dict[str, Any]) -> float: """ @@ -271,14 +261,13 @@ def get_backoff_time(self, settings: Dict[str, Any]) -> float: random_generator = random.Random() # the backoff interval normally does not change, however there is the possibility # that it was modified by accessing the property directly after initializing the object - random_range_start = self.backoff - self.random_jitter_range \ - if self.backoff > self.random_jitter_range else 0 + random_range_start = self.backoff - self.random_jitter_range if self.backoff > self.random_jitter_range else 0 random_range_end = self.backoff + self.random_jitter_range return random_generator.uniform(random_range_start, random_range_end) class AsyncStorageBearerTokenCredentialPolicy(AsyncBearerTokenCredentialPolicy): - """ Custom Bearer token credential policy for following Storage Bearer challenges """ + """Custom Bearer token credential policy for following Storage Bearer challenges""" def __init__(self, credential: "AsyncTokenCredential", audience: str, **kwargs: Any) -> None: super(AsyncStorageBearerTokenCredentialPolicy, self).__init__(credential, audience, **kwargs) diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/request_handlers.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/request_handlers.py similarity index 77% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/request_handlers.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/request_handlers.py index 54927cc..b23f658 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/request_handlers.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/request_handlers.py @@ -6,7 +6,7 @@ import logging import stat -from io import (SEEK_END, SEEK_SET, UnsupportedOperation) +from io import SEEK_END, SEEK_SET, UnsupportedOperation from os import fstat from typing import Dict, Optional @@ -37,12 +37,13 @@ def serialize_iso(attr): raise OverflowError("Hit max or min date") date = f"{utc.tm_year:04}-{utc.tm_mon:02}-{utc.tm_mday:02}T{utc.tm_hour:02}:{utc.tm_min:02}:{utc.tm_sec:02}" - return date + 'Z' + return date + "Z" except (ValueError, OverflowError) as err: raise ValueError("Unable to serialize datetime object.") from err except AttributeError as err: raise TypeError("ISO-8601 object must be valid datetime object.") from err + def get_length(data): length = None # Check if object implements the __len__ method, covers most input cases such as bytearray. @@ -62,7 +63,7 @@ def get_length(data): try: mode = fstat(fileno).st_mode if stat.S_ISREG(mode) or stat.S_ISLNK(mode): - #st_size only meaningful if regular file or symlink, other types + # st_size only meaningful if regular file or symlink, other types # e.g. sockets may return misleading sizes like 0 return fstat(fileno).st_size except OSError: @@ -84,13 +85,13 @@ def get_length(data): def read_length(data): try: - if hasattr(data, 'read'): - read_data = b'' + if hasattr(data, "read"): + read_data = b"" for chunk in iter(lambda: data.read(4096), b""): read_data += chunk return len(read_data), read_data - if hasattr(data, '__iter__'): - read_data = b'' + if hasattr(data, "__iter__"): + read_data = b"" for chunk in data: read_data += chunk return len(read_data), read_data @@ -100,8 +101,13 @@ def read_length(data): def validate_and_format_range_headers( - start_range, end_range, start_range_required=True, - end_range_required=True, check_content_md5=False, align_to_page=False): + start_range, + end_range, + start_range_required=True, + end_range_required=True, + check_content_md5=False, + align_to_page=False, +): # If end range is provided, start range must be provided if (start_range_required or end_range is not None) and start_range is None: raise ValueError("start_range value cannot be None.") @@ -111,16 +117,18 @@ def validate_and_format_range_headers( # Page ranges must be 512 aligned if align_to_page: if start_range is not None and start_range % 512 != 0: - raise ValueError(f"Invalid page blob start_range: {start_range}. " - "The size must be aligned to a 512-byte boundary.") + raise ValueError( + f"Invalid page blob start_range: {start_range}. " "The size must be aligned to a 512-byte boundary." + ) if end_range is not None and end_range % 512 != 511: - raise ValueError(f"Invalid page blob end_range: {end_range}. " - "The size must be aligned to a 512-byte boundary.") + raise ValueError( + f"Invalid page blob end_range: {end_range}. " "The size must be aligned to a 512-byte boundary." + ) # Format based on whether end_range is present range_header = None if end_range is not None: - range_header = f'bytes={start_range}-{end_range}' + range_header = f"bytes={start_range}-{end_range}" elif start_range is not None: range_header = f"bytes={start_range}-" @@ -131,17 +139,16 @@ def validate_and_format_range_headers( raise ValueError("Both start and end range required for MD5 content validation.") if end_range - start_range > 4 * 1024 * 1024: raise ValueError("Getting content MD5 for a range greater than 4MB is not supported.") - range_validation = 'true' + range_validation = "true" return range_header, range_validation -def add_metadata_headers(metadata=None): - # type: (Optional[Dict[str, str]]) -> Dict[str, str] +def add_metadata_headers(metadata: Optional[Dict[str, str]] = None) -> Dict[str, str]: headers = {} if metadata: for key, value in metadata.items(): - headers[f'x-ms-meta-{key.strip()}'] = value.strip() if value else value + headers[f"x-ms-meta-{key.strip()}"] = value.strip() if value else value return headers @@ -159,29 +166,26 @@ def serialize_batch_body(requests, batch_id): a list of sub-request for the batch request :param str batch_id: to be embedded in batch sub-request delimiter - :returns: The body bytes for this batch. + :return: The body bytes for this batch. :rtype: bytes """ if requests is None or len(requests) == 0: - raise ValueError('Please provide sub-request(s) for this batch request') + raise ValueError("Please provide sub-request(s) for this batch request") - delimiter_bytes = (_get_batch_request_delimiter(batch_id, True, False) + _HTTP_LINE_ENDING).encode('utf-8') - newline_bytes = _HTTP_LINE_ENDING.encode('utf-8') + delimiter_bytes = (_get_batch_request_delimiter(batch_id, True, False) + _HTTP_LINE_ENDING).encode("utf-8") + newline_bytes = _HTTP_LINE_ENDING.encode("utf-8") batch_body = [] content_index = 0 for request in requests: - request.headers.update({ - "Content-ID": str(content_index), - "Content-Length": str(0) - }) + request.headers.update({"Content-ID": str(content_index), "Content-Length": str(0)}) batch_body.append(delimiter_bytes) batch_body.append(_make_body_from_sub_request(request)) batch_body.append(newline_bytes) content_index += 1 - batch_body.append(_get_batch_request_delimiter(batch_id, True, True).encode('utf-8')) + batch_body.append(_get_batch_request_delimiter(batch_id, True, True).encode("utf-8")) # final line of body MUST have \r\n at the end, or it will not be properly read by the service batch_body.append(newline_bytes) @@ -198,35 +202,35 @@ def _get_batch_request_delimiter(batch_id, is_prepend_dashes=False, is_append_da Whether to include the starting dashes. Used in the body, but non on defining the delimiter. :param bool is_append_dashes: Whether to include the ending dashes. Used in the body on the closing delimiter only. - :returns: The delimiter, WITHOUT a trailing newline. + :return: The delimiter, WITHOUT a trailing newline. :rtype: str """ - prepend_dashes = '--' if is_prepend_dashes else '' - append_dashes = '--' if is_append_dashes else '' + prepend_dashes = "--" if is_prepend_dashes else "" + append_dashes = "--" if is_append_dashes else "" return prepend_dashes + _REQUEST_DELIMITER_PREFIX + batch_id + append_dashes def _make_body_from_sub_request(sub_request): """ - Content-Type: application/http - Content-ID: - Content-Transfer-Encoding: (if present) + Content-Type: application/http + Content-ID: + Content-Transfer-Encoding: (if present) - HTTP/ -
:
(repeated as necessary) - Content-Length: - (newline if content length > 0) - (if content length > 0) + HTTP/ +
:
(repeated as necessary) + Content-Length: + (newline if content length > 0) + (if content length > 0) - Serializes an http request. + Serializes an http request. - :param ~azure.core.pipeline.transport.HttpRequest sub_request: - Request to serialize. - :returns: The serialized sub-request in bytes - :rtype: bytes - """ + :param ~azure.core.pipeline.transport.HttpRequest sub_request: + Request to serialize. + :return: The serialized sub-request in bytes + :rtype: bytes + """ # put the sub-request's headers into a list for efficient str concatenation sub_request_body = [] @@ -250,9 +254,9 @@ def _make_body_from_sub_request(sub_request): # append HTTP verb and path and query and HTTP version sub_request_body.append(sub_request.method) - sub_request_body.append(' ') + sub_request_body.append(" ") sub_request_body.append(sub_request.url) - sub_request_body.append(' ') + sub_request_body.append(" ") sub_request_body.append(_HTTP1_1_IDENTIFIER) sub_request_body.append(_HTTP_LINE_ENDING) @@ -267,4 +271,4 @@ def _make_body_from_sub_request(sub_request): # append blank line sub_request_body.append(_HTTP_LINE_ENDING) - return ''.join(sub_request_body).encode() + return "".join(sub_request_body).encode() diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/response_handlers.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/response_handlers.py similarity index 69% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/response_handlers.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/response_handlers.py index af9a2fc..bcfa414 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/response_handlers.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/response_handlers.py @@ -46,23 +46,23 @@ def parse_length_from_content_range(content_range): # First, split in space and take the second half: '1-3/65537' # Next, split on slash and take the second half: '65537' # Finally, convert to an int: 65537 - return int(content_range.split(' ', 1)[1].split('/', 1)[1]) + return int(content_range.split(" ", 1)[1].split("/", 1)[1]) def normalize_headers(headers): normalized = {} for key, value in headers.items(): - if key.startswith('x-ms-'): + if key.startswith("x-ms-"): key = key[5:] - normalized[key.lower().replace('-', '_')] = get_enum_value(value) + normalized[key.lower().replace("-", "_")] = get_enum_value(value) return normalized def deserialize_metadata(response, obj, headers): # pylint: disable=unused-argument try: - raw_metadata = {k: v for k, v in response.http_response.headers.items() if k.lower().startswith('x-ms-meta-')} + raw_metadata = {k: v for k, v in response.http_response.headers.items() if k.lower().startswith("x-ms-meta-")} except AttributeError: - raw_metadata = {k: v for k, v in response.headers.items() if k.lower().startswith('x-ms-meta-')} + raw_metadata = {k: v for k, v in response.headers.items() if k.lower().startswith("x-ms-meta-")} return {k[10:]: v for k, v in raw_metadata.items()} @@ -82,19 +82,23 @@ def return_raw_deserialized(response, *_): return response.http_response.location_mode, response.context[ContentDecodePolicy.CONTEXT_NAME] -def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements, too-many-branches +def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements, too-many-branches raise_error = HttpResponseError serialized = False if isinstance(storage_error, AzureSigningError): - storage_error.message = storage_error.message + \ - '. This is likely due to an invalid shared key. Please check your shared key and try again.' + storage_error.message = ( + storage_error.message + + ". This is likely due to an invalid shared key. Please check your shared key and try again." + ) if not storage_error.response or storage_error.response.status_code in [200, 204]: raise storage_error # If it is one of those three then it has been serialized prior by the generated layer. - if isinstance(storage_error, (PartialBatchErrorException, - ClientAuthenticationError, ResourceNotFoundError, ResourceExistsError)): + if isinstance( + storage_error, + (PartialBatchErrorException, ClientAuthenticationError, ResourceNotFoundError, ResourceExistsError), + ): serialized = True - error_code = storage_error.response.headers.get('x-ms-error-code') + error_code = storage_error.response.headers.get("x-ms-error-code") error_message = storage_error.message additional_data = {} error_dict = {} @@ -104,27 +108,25 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py if error_body is None or len(error_body) == 0: error_body = storage_error.response.reason except AttributeError: - error_body = '' + error_body = "" # If it is an XML response if isinstance(error_body, Element): - error_dict = { - child.tag.lower(): child.text - for child in error_body - } + error_dict = {child.tag.lower(): child.text for child in error_body} # If it is a JSON response elif isinstance(error_body, dict): - error_dict = error_body.get('error', {}) + error_dict = error_body.get("error", {}) elif not error_code: _LOGGER.warning( - 'Unexpected return type %s from ContentDecodePolicy.deserialize_from_http_generics.', type(error_body)) - error_dict = {'message': str(error_body)} + "Unexpected return type %s from ContentDecodePolicy.deserialize_from_http_generics.", type(error_body) + ) + error_dict = {"message": str(error_body)} # If we extracted from a Json or XML response # There is a chance error_dict is just a string if error_dict and isinstance(error_dict, dict): - error_code = error_dict.get('code') - error_message = error_dict.get('message') - additional_data = {k: v for k, v in error_dict.items() if k not in {'code', 'message'}} + error_code = error_dict.get("code") + error_message = error_dict.get("message") + additional_data = {k: v for k, v in error_dict.items() if k not in {"code", "message"}} except DecodeError: pass @@ -132,31 +134,33 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # This check would be unnecessary if we have already serialized the error if error_code and not serialized: error_code = StorageErrorCode(error_code) - if error_code in [StorageErrorCode.condition_not_met, - StorageErrorCode.blob_overwritten]: + if error_code in [StorageErrorCode.condition_not_met, StorageErrorCode.blob_overwritten]: raise_error = ResourceModifiedError - if error_code in [StorageErrorCode.invalid_authentication_info, - StorageErrorCode.authentication_failed]: + if error_code in [StorageErrorCode.invalid_authentication_info, StorageErrorCode.authentication_failed]: raise_error = ClientAuthenticationError - if error_code in [StorageErrorCode.resource_not_found, - StorageErrorCode.cannot_verify_copy_source, - StorageErrorCode.blob_not_found, - StorageErrorCode.queue_not_found, - StorageErrorCode.container_not_found, - StorageErrorCode.parent_not_found, - StorageErrorCode.share_not_found]: + if error_code in [ + StorageErrorCode.resource_not_found, + StorageErrorCode.cannot_verify_copy_source, + StorageErrorCode.blob_not_found, + StorageErrorCode.queue_not_found, + StorageErrorCode.container_not_found, + StorageErrorCode.parent_not_found, + StorageErrorCode.share_not_found, + ]: raise_error = ResourceNotFoundError - if error_code in [StorageErrorCode.account_already_exists, - StorageErrorCode.account_being_created, - StorageErrorCode.resource_already_exists, - StorageErrorCode.resource_type_mismatch, - StorageErrorCode.blob_already_exists, - StorageErrorCode.queue_already_exists, - StorageErrorCode.container_already_exists, - StorageErrorCode.container_being_deleted, - StorageErrorCode.queue_being_deleted, - StorageErrorCode.share_already_exists, - StorageErrorCode.share_being_deleted]: + if error_code in [ + StorageErrorCode.account_already_exists, + StorageErrorCode.account_being_created, + StorageErrorCode.resource_already_exists, + StorageErrorCode.resource_type_mismatch, + StorageErrorCode.blob_already_exists, + StorageErrorCode.queue_already_exists, + StorageErrorCode.container_already_exists, + StorageErrorCode.container_being_deleted, + StorageErrorCode.queue_being_deleted, + StorageErrorCode.share_already_exists, + StorageErrorCode.share_being_deleted, + ]: raise_error = ResourceExistsError except ValueError: # Got an unknown error code @@ -183,7 +187,7 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py error.args = (error.message,) try: # `from None` prevents us from double printing the exception (suppresses generated layer error context) - exec("raise error from None") # pylint: disable=exec-used # nosec + exec("raise error from None") # pylint: disable=exec-used # nosec except SyntaxError as exc: raise error from exc diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/shared_access_signature.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/shared_access_signature.py similarity index 76% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/shared_access_signature.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/shared_access_signature.py index 2ef9921..959a5ac 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/shared_access_signature.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/shared_access_signature.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +# pylint: disable=docstring-keyword-should-match-keyword-only from datetime import date @@ -10,42 +11,45 @@ from .constants import X_MS_VERSION from . import sign_string, url_quote + # cspell:ignoreRegExp rsc. # cspell:ignoreRegExp s..?id class QueryStringConstants(object): - SIGNED_SIGNATURE = 'sig' - SIGNED_PERMISSION = 'sp' - SIGNED_START = 'st' - SIGNED_EXPIRY = 'se' - SIGNED_RESOURCE = 'sr' - SIGNED_IDENTIFIER = 'si' - SIGNED_IP = 'sip' - SIGNED_PROTOCOL = 'spr' - SIGNED_VERSION = 'sv' - SIGNED_CACHE_CONTROL = 'rscc' - SIGNED_CONTENT_DISPOSITION = 'rscd' - SIGNED_CONTENT_ENCODING = 'rsce' - SIGNED_CONTENT_LANGUAGE = 'rscl' - SIGNED_CONTENT_TYPE = 'rsct' - START_PK = 'spk' - START_RK = 'srk' - END_PK = 'epk' - END_RK = 'erk' - SIGNED_RESOURCE_TYPES = 'srt' - SIGNED_SERVICES = 'ss' - SIGNED_OID = 'skoid' - SIGNED_TID = 'sktid' - SIGNED_KEY_START = 'skt' - SIGNED_KEY_EXPIRY = 'ske' - SIGNED_KEY_SERVICE = 'sks' - SIGNED_KEY_VERSION = 'skv' - SIGNED_ENCRYPTION_SCOPE = 'ses' + SIGNED_SIGNATURE = "sig" + SIGNED_PERMISSION = "sp" + SIGNED_START = "st" + SIGNED_EXPIRY = "se" + SIGNED_RESOURCE = "sr" + SIGNED_IDENTIFIER = "si" + SIGNED_IP = "sip" + SIGNED_PROTOCOL = "spr" + SIGNED_VERSION = "sv" + SIGNED_CACHE_CONTROL = "rscc" + SIGNED_CONTENT_DISPOSITION = "rscd" + SIGNED_CONTENT_ENCODING = "rsce" + SIGNED_CONTENT_LANGUAGE = "rscl" + SIGNED_CONTENT_TYPE = "rsct" + START_PK = "spk" + START_RK = "srk" + END_PK = "epk" + END_RK = "erk" + SIGNED_RESOURCE_TYPES = "srt" + SIGNED_SERVICES = "ss" + SIGNED_OID = "skoid" + SIGNED_TID = "sktid" + SIGNED_KEY_START = "skt" + SIGNED_KEY_EXPIRY = "ske" + SIGNED_KEY_SERVICE = "sks" + SIGNED_KEY_VERSION = "skv" + SIGNED_ENCRYPTION_SCOPE = "ses" + SIGNED_KEY_DELEGATED_USER_TID = "skdutid" + SIGNED_DELEGATED_USER_OID = "sduoid" # for ADLS - SIGNED_AUTHORIZED_OID = 'saoid' - SIGNED_UNAUTHORIZED_OID = 'suoid' - SIGNED_CORRELATION_ID = 'scid' - SIGNED_DIRECTORY_DEPTH = 'sdd' + SIGNED_AUTHORIZED_OID = "saoid" + SIGNED_UNAUTHORIZED_OID = "suoid" + SIGNED_CORRELATION_ID = "scid" + SIGNED_DIRECTORY_DEPTH = "sdd" @staticmethod def to_list(): @@ -77,6 +81,8 @@ def to_list(): QueryStringConstants.SIGNED_KEY_SERVICE, QueryStringConstants.SIGNED_KEY_VERSION, QueryStringConstants.SIGNED_ENCRYPTION_SCOPE, + QueryStringConstants.SIGNED_KEY_DELEGATED_USER_TID, + QueryStringConstants.SIGNED_DELEGATED_USER_OID, # for ADLS QueryStringConstants.SIGNED_AUTHORIZED_OID, QueryStringConstants.SIGNED_UNAUTHORIZED_OID, @@ -86,37 +92,30 @@ def to_list(): class SharedAccessSignature(object): - ''' + """ Provides a factory for creating account access signature tokens with an account name and account key. Users can either use the factory or can construct the appropriate service and use the generate_*_shared_access_signature method directly. - ''' + """ def __init__(self, account_name, account_key, x_ms_version=X_MS_VERSION): - ''' + """ :param str account_name: The storage account name used to generate the shared access signatures. :param str account_key: The access key to generate the shares access signatures. :param str x_ms_version: The service version used to generate the shared access signatures. - ''' + """ self.account_name = account_name self.account_key = account_key self.x_ms_version = x_ms_version def generate_account( - self, services, - resource_types, - permission, - expiry, - start=None, - ip=None, - protocol=None, - sts_hook=None + self, services, resource_types, permission, expiry, start=None, ip=None, protocol=None, sts_hook=None ) -> str: - ''' + """ Generates a shared access signature for the account. Use the returned signature with the sas_token parameter of the service or to create a new account object. @@ -160,9 +159,9 @@ def generate_account( For debugging purposes only. If provided, the hook is called with the string to sign that was used to generate the SAS. :type sts_hook: Optional[Callable[[str], None]] - :returns: The generated SAS token for the account. + :return: The generated SAS token for the account. :rtype: str - ''' + """ sas = _SharedAccessHelper() sas.add_base(permission, expiry, start, ip, protocol, self.x_ms_version) sas.add_account(services, resource_types) @@ -207,11 +206,9 @@ def add_account(self, services, resource_types): self._add_query(QueryStringConstants.SIGNED_SERVICES, services) self._add_query(QueryStringConstants.SIGNED_RESOURCE_TYPES, resource_types) - def add_override_response_headers(self, cache_control, - content_disposition, - content_encoding, - content_language, - content_type): + def add_override_response_headers( + self, cache_control, content_disposition, content_encoding, content_language, content_type + ): self._add_query(QueryStringConstants.SIGNED_CACHE_CONTROL, cache_control) self._add_query(QueryStringConstants.SIGNED_CONTENT_DISPOSITION, content_disposition) self._add_query(QueryStringConstants.SIGNED_CONTENT_ENCODING, content_encoding) @@ -220,24 +217,24 @@ def add_override_response_headers(self, cache_control, def add_account_signature(self, account_name, account_key): def get_value_to_append(query): - return_value = self.query_dict.get(query) or '' - return return_value + '\n' - - self.string_to_sign = \ - (account_name + '\n' + - get_value_to_append(QueryStringConstants.SIGNED_PERMISSION) + - get_value_to_append(QueryStringConstants.SIGNED_SERVICES) + - get_value_to_append(QueryStringConstants.SIGNED_RESOURCE_TYPES) + - get_value_to_append(QueryStringConstants.SIGNED_START) + - get_value_to_append(QueryStringConstants.SIGNED_EXPIRY) + - get_value_to_append(QueryStringConstants.SIGNED_IP) + - get_value_to_append(QueryStringConstants.SIGNED_PROTOCOL) + - get_value_to_append(QueryStringConstants.SIGNED_VERSION) + - '\n' # Signed Encryption Scope - always empty for fileshare - ) - - self._add_query(QueryStringConstants.SIGNED_SIGNATURE, - sign_string(account_key, self.string_to_sign)) + return_value = self.query_dict.get(query) or "" + return return_value + "\n" + + self.string_to_sign = ( + account_name + + "\n" + + get_value_to_append(QueryStringConstants.SIGNED_PERMISSION) + + get_value_to_append(QueryStringConstants.SIGNED_SERVICES) + + get_value_to_append(QueryStringConstants.SIGNED_RESOURCE_TYPES) + + get_value_to_append(QueryStringConstants.SIGNED_START) + + get_value_to_append(QueryStringConstants.SIGNED_EXPIRY) + + get_value_to_append(QueryStringConstants.SIGNED_IP) + + get_value_to_append(QueryStringConstants.SIGNED_PROTOCOL) + + get_value_to_append(QueryStringConstants.SIGNED_VERSION) + + "\n" # Signed Encryption Scope - always empty for fileshare + ) + + self._add_query(QueryStringConstants.SIGNED_SIGNATURE, sign_string(account_key, self.string_to_sign)) def get_token(self) -> str: - return '&'.join([f'{n}={url_quote(v)}' for n, v in self.query_dict.items() if v is not None]) + return "&".join([f"{n}={url_quote(v)}" for n, v in self.query_dict.items() if v is not None]) diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/uploads.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/uploads.py similarity index 91% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/uploads.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/uploads.py index b31cfb3..7a5fb3f 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/uploads.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/uploads.py @@ -12,7 +12,7 @@ from azure.core.tracing.common import with_current_context -from .import encode_base64, url_quote +from . import encode_base64, url_quote from .request_handlers import get_length from .response_handlers import return_response_headers @@ -41,20 +41,21 @@ def _parallel_uploads(executor, uploader, pending, running): def upload_data_chunks( - service=None, - uploader_class=None, - total_size=None, - chunk_size=None, - max_concurrency=None, - stream=None, - validate_content=None, - progress_hook=None, - **kwargs): + service=None, + uploader_class=None, + total_size=None, + chunk_size=None, + max_concurrency=None, + stream=None, + validate_content=None, + progress_hook=None, + **kwargs, +): parallel = max_concurrency > 1 - if parallel and 'modified_access_conditions' in kwargs: + if parallel and "modified_access_conditions" in kwargs: # Access conditions do not work with parallelism - kwargs['modified_access_conditions'] = None + kwargs["modified_access_conditions"] = None uploader = uploader_class( service=service, @@ -64,7 +65,8 @@ def upload_data_chunks( parallel=parallel, validate_content=validate_content, progress_hook=progress_hook, - **kwargs) + **kwargs, + ) if parallel: with futures.ThreadPoolExecutor(max_concurrency) as executor: upload_tasks = uploader.get_chunk_streams() @@ -81,18 +83,19 @@ def upload_data_chunks( def upload_substream_blocks( - service=None, - uploader_class=None, - total_size=None, - chunk_size=None, - max_concurrency=None, - stream=None, - progress_hook=None, - **kwargs): + service=None, + uploader_class=None, + total_size=None, + chunk_size=None, + max_concurrency=None, + stream=None, + progress_hook=None, + **kwargs, +): parallel = max_concurrency > 1 - if parallel and 'modified_access_conditions' in kwargs: + if parallel and "modified_access_conditions" in kwargs: # Access conditions do not work with parallelism - kwargs['modified_access_conditions'] = None + kwargs["modified_access_conditions"] = None uploader = uploader_class( service=service, total_size=total_size, @@ -100,7 +103,8 @@ def upload_substream_blocks( stream=stream, parallel=parallel, progress_hook=progress_hook, - **kwargs) + **kwargs, + ) if parallel: with futures.ThreadPoolExecutor(max_concurrency) as executor: @@ -120,15 +124,17 @@ def upload_substream_blocks( class _ChunkUploader(object): # pylint: disable=too-many-instance-attributes def __init__( - self, service, - total_size, - chunk_size, - stream, - parallel, - encryptor=None, - padder=None, - progress_hook=None, - **kwargs): + self, + service, + total_size, + chunk_size, + stream, + parallel, + encryptor=None, + padder=None, + progress_hook=None, + **kwargs, + ): self.service = service self.total_size = total_size self.chunk_size = chunk_size @@ -253,7 +259,7 @@ def __init__(self, *args, **kwargs): def _upload_chunk(self, chunk_offset, chunk_data): # TODO: This is incorrect, but works with recording. - index = f'{chunk_offset:032d}' + index = f"{chunk_offset:032d}" block_id = encode_base64(url_quote(encode_base64(index))) self.service.stage_block( block_id, @@ -261,20 +267,20 @@ def _upload_chunk(self, chunk_offset, chunk_data): chunk_data, data_stream_total=self.total_size, upload_stream_current=self.progress_total, - **self.request_options + **self.request_options, ) return index, block_id def _upload_substream_block(self, index, block_stream): try: - block_id = f'BlockId{(index//self.chunk_size):05}' + block_id = f"BlockId{(index//self.chunk_size):05}" self.service.stage_block( block_id, len(block_stream), block_stream, data_stream_total=self.total_size, upload_stream_current=self.progress_total, - **self.request_options + **self.request_options, ) finally: block_stream.close() @@ -302,11 +308,11 @@ def _upload_chunk(self, chunk_offset, chunk_data): cls=return_response_headers, data_stream_total=self.total_size, upload_stream_current=self.progress_total, - **self.request_options + **self.request_options, ) - if not self.parallel and self.request_options.get('modified_access_conditions'): - self.request_options['modified_access_conditions'].if_match = self.response_headers['etag'] + if not self.parallel and self.request_options.get("modified_access_conditions"): + self.request_options["modified_access_conditions"].if_match = self.response_headers["etag"] def _upload_substream_block(self, index, block_stream): pass @@ -326,19 +332,20 @@ def _upload_chunk(self, chunk_offset, chunk_data): cls=return_response_headers, data_stream_total=self.total_size, upload_stream_current=self.progress_total, - **self.request_options + **self.request_options, ) self.current_length = int(self.response_headers["blob_append_offset"]) else: - self.request_options['append_position_access_conditions'].append_position = \ + self.request_options["append_position_access_conditions"].append_position = ( self.current_length + chunk_offset + ) self.response_headers = self.service.append_block( body=chunk_data, content_length=len(chunk_data), cls=return_response_headers, data_stream_total=self.total_size, upload_stream_current=self.progress_total, - **self.request_options + **self.request_options, ) def _upload_substream_block(self, index, block_stream): @@ -356,11 +363,11 @@ def _upload_chunk(self, chunk_offset, chunk_data): cls=return_response_headers, data_stream_total=self.total_size, upload_stream_current=self.progress_total, - **self.request_options + **self.request_options, ) - if not self.parallel and self.request_options.get('modified_access_conditions'): - self.request_options['modified_access_conditions'].if_match = self.response_headers['etag'] + if not self.parallel and self.request_options.get("modified_access_conditions"): + self.request_options["modified_access_conditions"].if_match = self.response_headers["etag"] def _upload_substream_block(self, index, block_stream): try: @@ -371,7 +378,7 @@ def _upload_substream_block(self, index, block_stream): cls=return_response_headers, data_stream_total=self.total_size, upload_stream_current=self.progress_total, - **self.request_options + **self.request_options, ) finally: block_stream.close() @@ -388,9 +395,9 @@ def _upload_chunk(self, chunk_offset, chunk_data): length, data_stream_total=self.total_size, upload_stream_current=self.progress_total, - **self.request_options + **self.request_options, ) - return f'bytes={chunk_offset}-{chunk_end}', response + return f"bytes={chunk_offset}-{chunk_end}", response # TODO: Implement this method. def _upload_substream_block(self, index, block_stream): diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/uploads_async.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/uploads_async.py similarity index 85% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/uploads_async.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/uploads_async.py index 3e102ec..6ed5ba1 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared/uploads_async.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared/uploads_async.py @@ -4,16 +4,15 @@ # license information. # -------------------------------------------------------------------------- -import asyncio +import asyncio # pylint: disable=do-not-import-asyncio import inspect import threading -from asyncio import Lock from io import UnsupportedOperation from itertools import islice from math import ceil from typing import AsyncGenerator, Union -from .import encode_base64, url_quote +from . import encode_base64, url_quote from .request_handlers import get_length from .response_handlers import return_response_headers from .uploads import SubStream, IterStreamer # pylint: disable=unused-import @@ -60,19 +59,20 @@ async def _parallel_uploads(uploader, pending, running): async def upload_data_chunks( - service=None, - uploader_class=None, - total_size=None, - chunk_size=None, - max_concurrency=None, - stream=None, - progress_hook=None, - **kwargs): + service=None, + uploader_class=None, + total_size=None, + chunk_size=None, + max_concurrency=None, + stream=None, + progress_hook=None, + **kwargs, +): parallel = max_concurrency > 1 - if parallel and 'modified_access_conditions' in kwargs: + if parallel and "modified_access_conditions" in kwargs: # Access conditions do not work with parallelism - kwargs['modified_access_conditions'] = None + kwargs["modified_access_conditions"] = None uploader = uploader_class( service=service, @@ -81,7 +81,8 @@ async def upload_data_chunks( stream=stream, parallel=parallel, progress_hook=progress_hook, - **kwargs) + **kwargs, + ) if parallel: upload_tasks = uploader.get_chunk_streams() @@ -105,18 +106,19 @@ async def upload_data_chunks( async def upload_substream_blocks( - service=None, - uploader_class=None, - total_size=None, - chunk_size=None, - max_concurrency=None, - stream=None, - progress_hook=None, - **kwargs): + service=None, + uploader_class=None, + total_size=None, + chunk_size=None, + max_concurrency=None, + stream=None, + progress_hook=None, + **kwargs, +): parallel = max_concurrency > 1 - if parallel and 'modified_access_conditions' in kwargs: + if parallel and "modified_access_conditions" in kwargs: # Access conditions do not work with parallelism - kwargs['modified_access_conditions'] = None + kwargs["modified_access_conditions"] = None uploader = uploader_class( service=service, total_size=total_size, @@ -124,13 +126,13 @@ async def upload_substream_blocks( stream=stream, parallel=parallel, progress_hook=progress_hook, - **kwargs) + **kwargs, + ) if parallel: upload_tasks = uploader.get_substream_blocks() running_futures = [ - asyncio.ensure_future(uploader.process_substream_block(u)) - for u in islice(upload_tasks, 0, max_concurrency) + asyncio.ensure_future(uploader.process_substream_block(u)) for u in islice(upload_tasks, 0, max_concurrency) ] range_ids = await _parallel_uploads(uploader.process_substream_block, upload_tasks, running_futures) else: @@ -145,15 +147,17 @@ async def upload_substream_blocks( class _ChunkUploader(object): # pylint: disable=too-many-instance-attributes def __init__( - self, service, - total_size, - chunk_size, - stream, - parallel, - encryptor=None, - padder=None, - progress_hook=None, - **kwargs): + self, + service, + total_size, + chunk_size, + stream, + parallel, + encryptor=None, + padder=None, + progress_hook=None, + **kwargs, + ): self.service = service self.total_size = total_size self.chunk_size = chunk_size @@ -165,7 +169,7 @@ def __init__( # Progress feedback self.progress_total = 0 - self.progress_lock = Lock() if parallel else None + self.progress_lock = asyncio.Lock() if parallel else None self.progress_hook = progress_hook # Encryption @@ -179,7 +183,7 @@ def __init__( async def get_chunk_streams(self): index = 0 while True: - data = b'' + data = b"" read_size = self.chunk_size # Buffer until we either reach the end of the stream or get a whole chunk. @@ -190,12 +194,12 @@ async def get_chunk_streams(self): if inspect.isawaitable(temp): temp = await temp if not isinstance(temp, bytes): - raise TypeError('Blob data should be of type bytes.') + raise TypeError("Blob data should be of type bytes.") data += temp or b"" # We have read an empty string and so are at the end # of the buffer or we have read a full chunk. - if temp == b'' or len(data) == self.chunk_size: + if temp == b"" or len(data) == self.chunk_size: break if len(data) == self.chunk_size: @@ -274,13 +278,13 @@ def set_response_properties(self, resp): class BlockBlobChunkUploader(_ChunkUploader): def __init__(self, *args, **kwargs): - kwargs.pop('modified_access_conditions', None) + kwargs.pop("modified_access_conditions", None) super(BlockBlobChunkUploader, self).__init__(*args, **kwargs) self.current_length = None async def _upload_chunk(self, chunk_offset, chunk_data): # TODO: This is incorrect, but works with recording. - index = f'{chunk_offset:032d}' + index = f"{chunk_offset:032d}" block_id = encode_base64(url_quote(encode_base64(index))) await self.service.stage_block( block_id, @@ -288,19 +292,21 @@ async def _upload_chunk(self, chunk_offset, chunk_data): body=chunk_data, data_stream_total=self.total_size, upload_stream_current=self.progress_total, - **self.request_options) + **self.request_options, + ) return index, block_id async def _upload_substream_block(self, index, block_stream): try: - block_id = f'BlockId{(index//self.chunk_size):05}' + block_id = f"BlockId{(index//self.chunk_size):05}" await self.service.stage_block( block_id, len(block_stream), block_stream, data_stream_total=self.total_size, upload_stream_current=self.progress_total, - **self.request_options) + **self.request_options, + ) finally: block_stream.close() return block_id @@ -312,7 +318,7 @@ def _is_chunk_empty(self, chunk_data): # read until non-zero byte is encountered # if reached the end without returning, then chunk_data is all 0's for each_byte in chunk_data: - if each_byte not in [0, b'\x00']: + if each_byte not in [0, b"\x00"]: return False return True @@ -320,7 +326,7 @@ async def _upload_chunk(self, chunk_offset, chunk_data): # avoid uploading the empty pages if not self._is_chunk_empty(chunk_data): chunk_end = chunk_offset + len(chunk_data) - 1 - content_range = f'bytes={chunk_offset}-{chunk_end}' + content_range = f"bytes={chunk_offset}-{chunk_end}" computed_md5 = None self.response_headers = await self.service.upload_pages( body=chunk_data, @@ -330,10 +336,11 @@ async def _upload_chunk(self, chunk_offset, chunk_data): cls=return_response_headers, data_stream_total=self.total_size, upload_stream_current=self.progress_total, - **self.request_options) + **self.request_options, + ) - if not self.parallel and self.request_options.get('modified_access_conditions'): - self.request_options['modified_access_conditions'].if_match = self.response_headers['etag'] + if not self.parallel and self.request_options.get("modified_access_conditions"): + self.request_options["modified_access_conditions"].if_match = self.response_headers["etag"] async def _upload_substream_block(self, index, block_stream): pass @@ -353,18 +360,21 @@ async def _upload_chunk(self, chunk_offset, chunk_data): cls=return_response_headers, data_stream_total=self.total_size, upload_stream_current=self.progress_total, - **self.request_options) - self.current_length = int(self.response_headers['blob_append_offset']) + **self.request_options, + ) + self.current_length = int(self.response_headers["blob_append_offset"]) else: - self.request_options['append_position_access_conditions'].append_position = \ + self.request_options["append_position_access_conditions"].append_position = ( self.current_length + chunk_offset + ) self.response_headers = await self.service.append_block( body=chunk_data, content_length=len(chunk_data), cls=return_response_headers, data_stream_total=self.total_size, upload_stream_current=self.progress_total, - **self.request_options) + **self.request_options, + ) async def _upload_substream_block(self, index, block_stream): pass @@ -380,11 +390,11 @@ async def _upload_chunk(self, chunk_offset, chunk_data): cls=return_response_headers, data_stream_total=self.total_size, upload_stream_current=self.progress_total, - **self.request_options + **self.request_options, ) - if not self.parallel and self.request_options.get('modified_access_conditions'): - self.request_options['modified_access_conditions'].if_match = self.response_headers['etag'] + if not self.parallel and self.request_options.get("modified_access_conditions"): + self.request_options["modified_access_conditions"].if_match = self.response_headers["etag"] async def _upload_substream_block(self, index, block_stream): try: @@ -395,7 +405,7 @@ async def _upload_substream_block(self, index, block_stream): cls=return_response_headers, data_stream_total=self.total_size, upload_stream_current=self.progress_total, - **self.request_options + **self.request_options, ) finally: block_stream.close() @@ -412,9 +422,9 @@ async def _upload_chunk(self, chunk_offset, chunk_data): length, data_stream_total=self.total_size, upload_stream_current=self.progress_total, - **self.request_options + **self.request_options, ) - range_id = f'bytes={chunk_offset}-{chunk_end}' + range_id = f"bytes={chunk_offset}-{chunk_end}" return range_id, response # TODO: Implement this method. @@ -422,10 +432,11 @@ async def _upload_substream_block(self, index, block_stream): pass -class AsyncIterStreamer(): +class AsyncIterStreamer: """ File-like streaming object for AsyncGenerators. """ + def __init__(self, generator: AsyncGenerator[Union[bytes, str], None], encoding: str = "UTF-8"): self.iterator = generator.__aiter__() self.leftover = b"" diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_shared_access_signature.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_shared_access_signature.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_shared_access_signature.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_shared_access_signature.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/_version.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/_version.py similarity index 93% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/_version.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/_version.py index 79adcbe..4611321 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/_version.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/_version.py @@ -4,4 +4,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "12.21.0" +VERSION = "12.22.0" diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/aio/__init__.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/aio/__init__.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/aio/__init__.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/aio/__init__.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/aio/_directory_client_async.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/aio/_directory_client_async.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/aio/_directory_client_async.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/aio/_directory_client_async.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/aio/_download_async.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/aio/_download_async.py similarity index 98% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/aio/_download_async.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/aio/_download_async.py index 278c5e0..90f5e91 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/aio/_download_async.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/aio/_download_async.py @@ -6,7 +6,7 @@ # pylint: disable=invalid-overridden-method # mypy: disable-error-code=override -import asyncio +import asyncio # pylint: disable=do-not-import-asyncio import sys import warnings from io import BytesIO @@ -33,8 +33,9 @@ async def process_content(data: Any) -> bytes: raise ValueError("Response cannot be None.") try: - await data.response.load_body() - return cast(bytes, data.response.body()) + if hasattr(data.response, "is_stream_consumed") and data.response.is_stream_consumed: + return data.response.content + return b"".join([d async for d in data]) except Exception as error: raise HttpResponseError(message="Download stream interrupted.", response=data.response, error=error) from error diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/aio/_file_client_async.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/aio/_file_client_async.py similarity index 95% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/aio/_file_client_async.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/aio/_file_client_async.py index 6272949..6b4ddc0 100644 --- a/azure/multiapi/storagev2/fileshare/v2025_05_05/aio/_file_client_async.py +++ b/azure/multiapi/storagev2/fileshare/v2025_07_05/aio/_file_client_async.py @@ -1738,3 +1738,84 @@ async def create_hardlink( )) except HttpResponseError as error: process_storage_error(error) + + @distributed_trace_async + async def create_symlink( + self, target: str, + *, + metadata: Optional[Dict[str, str]] = None, + file_creation_time: Optional[Union[str, datetime]] = None, + file_last_write_time: Optional[Union[str, datetime]] = None, + owner: Optional[str] = None, + group: Optional[str] = None, + lease: Optional[Union[ShareLeaseClient, str]] = None, + timeout: Optional[int] = None, + **kwargs: Any + ) -> Dict[str, Any]: + """NFS only. Creates a symbolic link to the specified file. + + :param str target: + Specifies the file path the symbolic link will point to. The file path can be either relative or absolute. + :keyword dict[str, str] metadata: + Name-value pairs associated with the file as metadata. + :keyword file_creation_time: Creation time for the file. + :paramtype file_creation_time: str or ~datetime.datetime + :keyword file_last_write_time: Last write time for the file. + :paramtype file_last_write_time: str or ~datetime.datetime + :keyword str owner: The owner of the file. + :keyword str group: The owning group of the file. + :keyword lease: + Required if the file has an active lease. Value can be a ShareLeaseClient object + or the lease ID as a string. + :paramtype lease: ~azure.storage.fileshare.ShareLeaseClient or str + :keyword int timeout: + Sets the server-side timeout for the operation in seconds. For more details see + https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-file-service-operations. + This value is not tracked or validated on the client. To configure client-side network timesouts + see `here `__. + :returns: File-updated property dict (ETag and last modified). + :rtype: dict[str, Any] + """ + try: + return cast(Dict[str, Any], await self._client.file.create_symbolic_link( + link_text=target, + metadata=metadata, + file_creation_time=file_creation_time, + file_last_write_time=file_last_write_time, + owner=owner, + group=group, + lease_access_conditions=lease, + timeout=timeout, + cls=return_response_headers, + **kwargs + )) + except HttpResponseError as error: + process_storage_error(error) + + @distributed_trace_async + async def get_symlink( + self, + *, + timeout: Optional[int] = None, + **kwargs: Any + ) -> Dict[str, Any]: + """NFS only. Gets the symbolic link for the file client. + + :keyword int timeout: + Sets the server-side timeout for the operation in seconds. For more details see + https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-file-service-operations. + This value is not tracked or validated on the client. To configure client-side network timeouts + see `here `__. + :returns: File-updated property dict (ETag and last modified). + :rtype: dict[str, Any] + """ + try: + return cast(Dict[str, Any], await self._client.file.get_symbolic_link( + timeout=timeout, + cls=return_response_headers, + **kwargs + )) + except HttpResponseError as error: + process_storage_error(error) diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/aio/_lease_async.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/aio/_lease_async.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/aio/_lease_async.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/aio/_lease_async.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/aio/_models.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/aio/_models.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/aio/_models.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/aio/_models.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/aio/_share_client_async.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/aio/_share_client_async.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/aio/_share_client_async.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/aio/_share_client_async.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/aio/_share_service_client_async.py b/azure/multiapi/storagev2/fileshare/v2025_07_05/aio/_share_service_client_async.py similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/aio/_share_service_client_async.py rename to azure/multiapi/storagev2/fileshare/v2025_07_05/aio/_share_service_client_async.py diff --git a/azure/multiapi/storagev2/fileshare/v2025_05_05/py.typed b/azure/multiapi/storagev2/fileshare/v2025_07_05/py.typed similarity index 100% rename from azure/multiapi/storagev2/fileshare/v2025_05_05/py.typed rename to azure/multiapi/storagev2/fileshare/v2025_07_05/py.typed diff --git a/setup.py b/setup.py index f8fac13..98a3ebb 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ setup( name='azure-multiapi-storage', - version='1.5.0', + version='1.6.0', description='Microsoft Azure Storage Client Library for Python with multi API version support.', long_description=open('README.rst', 'r').read(), license='MIT',