diff --git a/sdk/storage/azure-storage-file-share/assets.json b/sdk/storage/azure-storage-file-share/assets.json index 5e68b66154eb..411cd5b01d1d 100644 --- a/sdk/storage/azure-storage-file-share/assets.json +++ b/sdk/storage/azure-storage-file-share/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-file-share", - "Tag": "python/storage/azure-storage-file-share_9c32ba27e3" + "Tag": "python/storage/azure-storage-file-share_36a6ac44cc" } diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_directory_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_directory_client.py index 85af4243b8f7..0d9facbf365d 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_directory_client.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_directory_client.py @@ -342,6 +342,16 @@ def create_directory(self, **kwargs: Any) -> Dict[str, Any]: NFS only. The owning group of the directory. :keyword str file_mode: NFS only. The file mode of the directory. + :keyword file_property_semantics: + SMB only. Specifies permissions to be configured. Default value is None. + If not specified or None is passed, New will be the default. Possible values are: + + New - forcefully add the ARCHIVE attribute flag and alter the permissions specified in + x-ms-file-permission to inherit missing permissions from the parent. + + Restore - apply changes without further modification. + + :paramtype file_property_semantics: Literal["New", "Restore"] :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. diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py index 1a7d07b70885..f35c7aa5c149 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py @@ -438,6 +438,18 @@ def create_file( NFS only. The owning group of the file. :keyword str file_mode: NFS only. The file mode of the file. + :keyword file_property_semantics: + SMB only. Specifies permissions to be configured. Default value is None. + If not specified or None is passed, New will be the default. Possible values are: + + New - forcefully add the ARCHIVE attribute flag and alter the permissions specified in + x-ms-file-permission to inherit missing permissions from the parent. + + Restore - apply changes without further modification. + + :paramtype file_property_semantics: Literal["New", "Restore"] + :keyword IO[bytes] data: Initial data to upload. The limit is 4MB. + :keyword int length: Specifies the number of bytes being uploaded in the initial data. :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. @@ -485,6 +497,8 @@ def create_file( file_permission=file_permission, file_permission_key=permission_key, file_http_headers=file_http_headers, + optionalbody=kwargs.pop('data', None), + content_length=kwargs.pop('length', None), lease_access_conditions=access_conditions, headers=headers, timeout=timeout, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py index 4c3a844b955d..3807bbe8402e 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py @@ -45,7 +45,7 @@ class AzureFileStorage: # pylint: disable=client-accepts-api-version-keyword URI. Default value is None. :type allow_source_trailing_dot: bool :keyword version: Specifies the version of the operation to use for this request. Default value - is "2025-11-05". Note that overriding this default value may result in unsupported behavior. + is "2026-02-06". Note that overriding this default value may result in unsupported behavior. :paramtype version: str :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes downloaded from the source url into the specified range. Default value is "update". Note that diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py index e90ae1628a76..827328f9ffe3 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py @@ -33,7 +33,7 @@ class AzureFileStorageConfiguration: # pylint: disable=too-many-instance-attrib URI. Default value is None. :type allow_source_trailing_dot: bool :keyword version: Specifies the version of the operation to use for this request. Default value - is "2025-11-05". Note that overriding this default value may result in unsupported behavior. + is "2026-02-06". Note that overriding this default value may result in unsupported behavior. :paramtype version: str :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes downloaded from the source url into the specified range. Default value is "update". Note that @@ -49,7 +49,7 @@ def __init__( allow_source_trailing_dot: Optional[bool] = None, **kwargs: Any ) -> None: - version: Literal["2025-11-05"] = kwargs.pop("version", "2025-11-05") + version: Literal["2026-02-06"] = kwargs.pop("version", "2026-02-06") file_range_write_from_url: Literal["update"] = kwargs.pop("file_range_write_from_url", "update") if url is None: diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py index 74e276b84bda..dce7ddfcba82 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py @@ -45,7 +45,7 @@ class AzureFileStorage: # pylint: disable=client-accepts-api-version-keyword URI. Default value is None. :type allow_source_trailing_dot: bool :keyword version: Specifies the version of the operation to use for this request. Default value - is "2025-11-05". Note that overriding this default value may result in unsupported behavior. + is "2026-02-06". Note that overriding this default value may result in unsupported behavior. :paramtype version: str :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes downloaded from the source url into the specified range. Default value is "update". Note that diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py index b50c3c5ed68c..e61a4ca5cf27 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py @@ -33,7 +33,7 @@ class AzureFileStorageConfiguration: # pylint: disable=too-many-instance-attrib URI. Default value is None. :type allow_source_trailing_dot: bool :keyword version: Specifies the version of the operation to use for this request. Default value - is "2025-11-05". Note that overriding this default value may result in unsupported behavior. + is "2026-02-06". Note that overriding this default value may result in unsupported behavior. :paramtype version: str :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes downloaded from the source url into the specified range. Default value is "update". Note that @@ -49,7 +49,7 @@ def __init__( allow_source_trailing_dot: Optional[bool] = None, **kwargs: Any ) -> None: - version: Literal["2025-11-05"] = kwargs.pop("version", "2025-11-05") + version: Literal["2026-02-06"] = kwargs.pop("version", "2026-02-06") file_range_write_from_url: Literal["update"] = kwargs.pop("file_range_write_from_url", "update") if url is None: diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py index c138a52d6d8a..612a99189f35 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py @@ -76,6 +76,7 @@ async def create( owner: Optional[str] = None, group: Optional[str] = None, file_mode: Optional[str] = None, + file_property_semantics: Optional[Union[str, _models.FilePropertySemantics]] = None, **kwargs: Any ) -> None: """Creates a new directory under the specified share or parent directory. @@ -126,6 +127,11 @@ async def create( :param file_mode: Optional, NFS only. The file mode of the file or directory. Default value is None. :type file_mode: str + :param file_property_semantics: SMB only, default value is New. New will forcefully add the + ARCHIVE attribute flag and alter the permissions specified in x-ms-file-permission to inherit + missing permissions from the parent. Restore will apply changes without further modification. + Known values are: "New" and "Restore". Default value is None. + :type file_property_semantics: str or ~azure.storage.fileshare.models.FilePropertySemantics :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -158,6 +164,7 @@ async def create( owner=owner, group=group, file_mode=file_mode, + file_property_semantics=file_property_semantics, allow_trailing_dot=self._config.allow_trailing_dot, file_request_intent=self._config.file_request_intent, restype=restype, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py index e7d0e7ca4a73..61167fb171e7 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py @@ -92,8 +92,12 @@ async def create( group: Optional[str] = None, file_mode: Optional[str] = None, nfs_file_type: Optional[Union[str, _models.NfsFileType]] = None, + content_md5: Optional[bytes] = None, + file_property_semantics: Optional[Union[str, _models.FilePropertySemantics]] = None, + content_length: Optional[int] = None, file_http_headers: Optional[_models.FileHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, + optionalbody: Optional[IO[bytes]] = None, **kwargs: Any ) -> None: """Creates a new file or replaces a file. Note it only initializes the file with no content. @@ -149,10 +153,26 @@ async def create( :param nfs_file_type: Optional, NFS only. Type of the file or directory. Known values are: "Regular", "Directory", and "SymLink". Default value is None. :type nfs_file_type: str or ~azure.storage.fileshare.models.NfsFileType + :param content_md5: An MD5 hash of the content. This hash is used to verify the integrity of + the data during transport. When the Content-MD5 header is specified, the File service compares + the hash of the content that has arrived with the header value that was sent. If the two hashes + do not match, the operation will fail with error code 400 (Bad Request). Default value is None. + :type content_md5: bytes + :param file_property_semantics: SMB only, default value is New. New will forcefully add the + ARCHIVE attribute flag and alter the permissions specified in x-ms-file-permission to inherit + missing permissions from the parent. Restore will apply changes without further modification. + Known values are: "New" and "Restore". Default value is None. + :type file_property_semantics: str or ~azure.storage.fileshare.models.FilePropertySemantics + :param content_length: Specifies the number of bytes being transmitted in the request body. + When the x-ms-write header is set to clear, the value of this header must be set to zero. + Default value is None. + :type content_length: int :param file_http_headers: Parameter group. Default value is None. :type file_http_headers: ~azure.storage.fileshare.models.FileHTTPHeaders :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :param optionalbody: Initial data. Default value is None. + :type optionalbody: IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -169,6 +189,7 @@ async def create( _params = kwargs.pop("params", {}) or {} file_type_constant: Literal["file"] = kwargs.pop("file_type_constant", _headers.pop("x-ms-type", "file")) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) cls: ClsType[None] = kwargs.pop("cls", None) _file_content_type = None @@ -187,6 +208,7 @@ async def create( _file_content_type = file_http_headers.file_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id + _content = optionalbody _request = build_create_request( url=self._config.url, @@ -211,10 +233,15 @@ async def create( group=group, file_mode=file_mode, nfs_file_type=nfs_file_type, + content_md5=content_md5, + file_property_semantics=file_property_semantics, + content_length=content_length, allow_trailing_dot=self._config.allow_trailing_dot, file_request_intent=self._config.file_request_intent, file_type_constant=file_type_constant, + content_type=content_type, version=self._config.version, + content=_content, headers=_headers, params=_params, ) @@ -262,6 +289,8 @@ async def create( response_headers["x-ms-owner"] = self._deserialize("str", response.headers.get("x-ms-owner")) response_headers["x-ms-group"] = self._deserialize("str", response.headers.get("x-ms-group")) response_headers["x-ms-file-file-type"] = self._deserialize("str", response.headers.get("x-ms-file-file-type")) + response_headers["Content-MD5"] = self._deserialize("bytearray", response.headers.get("Content-MD5")) + response_headers["Content-Length"] = self._deserialize("int", response.headers.get("Content-Length")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/apiview-properties.json b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/apiview-properties.json new file mode 100644 index 000000000000..59173062eb29 --- /dev/null +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/apiview-properties.json @@ -0,0 +1,157 @@ +{ + "CrossLanguagePackageId": null, + "CrossLanguageDefinitionId": { + "azure.storage.fileshare.models.AccessPolicy": null, + "azure.storage.fileshare.models.ClearRange": null, + "azure.storage.fileshare.models.CopyFileSmbInfo": null, + "azure.storage.fileshare.models.CorsRule": null, + "azure.storage.fileshare.models.DestinationLeaseAccessConditions": null, + "azure.storage.fileshare.models.DirectoryItem": null, + "azure.storage.fileshare.models.FileHTTPHeaders": null, + "azure.storage.fileshare.models.FileItem": null, + "azure.storage.fileshare.models.FileProperty": null, + "azure.storage.fileshare.models.FileRange": null, + "azure.storage.fileshare.models.FilesAndDirectoriesListSegment": null, + "azure.storage.fileshare.models.HandleItem": null, + "azure.storage.fileshare.models.LeaseAccessConditions": null, + "azure.storage.fileshare.models.ListFilesAndDirectoriesSegmentResponse": null, + "azure.storage.fileshare.models.ListHandlesResponse": null, + "azure.storage.fileshare.models.ListSharesResponse": null, + "azure.storage.fileshare.models.Metrics": null, + "azure.storage.fileshare.models.RetentionPolicy": null, + "azure.storage.fileshare.models.ShareFileRangeList": null, + "azure.storage.fileshare.models.ShareItemInternal": null, + "azure.storage.fileshare.models.SharePermission": null, + "azure.storage.fileshare.models.SharePropertiesInternal": null, + "azure.storage.fileshare.models.ShareProtocolSettings": null, + "azure.storage.fileshare.models.ShareSmbSettings": null, + "azure.storage.fileshare.models.ShareStats": null, + "azure.storage.fileshare.models.SignedIdentifier": null, + "azure.storage.fileshare.models.SmbMultichannel": null, + "azure.storage.fileshare.models.SourceLeaseAccessConditions": null, + "azure.storage.fileshare.models.SourceModifiedAccessConditions": null, + "azure.storage.fileshare.models.StorageError": null, + "azure.storage.fileshare.models.StorageServiceProperties": null, + "azure.storage.fileshare.models.StringEncoded": null, + "azure.storage.fileshare.models.ListSharesIncludeType": null, + "azure.storage.fileshare.models.LeaseStatusType": null, + "azure.storage.fileshare.models.LeaseStateType": null, + "azure.storage.fileshare.models.LeaseDurationType": null, + "azure.storage.fileshare.models.ShareRootSquash": null, + "azure.storage.fileshare.models.ListFilesIncludeType": null, + "azure.storage.fileshare.models.AccessRight": null, + "azure.storage.fileshare.models.ShareTokenIntent": null, + "azure.storage.fileshare.models.ShareAccessTier": null, + "azure.storage.fileshare.models.FilePropertySemantics": null, + "azure.storage.fileshare.models.NfsFileType": null, + "azure.storage.fileshare.models.StorageErrorCode": null, + "azure.storage.fileshare.models.PermissionCopyModeType": null, + "azure.storage.fileshare.models.FilePermissionFormat": null, + "azure.storage.fileshare.models.DeleteSnapshotsOptionType": null, + "azure.storage.fileshare.models.CopyStatusType": null, + "azure.storage.fileshare.models.FileRangeWriteType": null, + "azure.storage.fileshare.models.FileLastWrittenMode": null, + "azure.storage.fileshare.models.ModeCopyMode": null, + "azure.storage.fileshare.models.OwnerCopyMode": null, + "azure.storage.fileshare.operations.ServiceOperations.set_properties": null, + "azure.storage.fileshare.aio.operations.ServiceOperations.set_properties": null, + "azure.storage.fileshare.operations.ServiceOperations.get_properties": null, + "azure.storage.fileshare.aio.operations.ServiceOperations.get_properties": null, + "azure.storage.fileshare.operations.ServiceOperations.list_shares_segment": null, + "azure.storage.fileshare.aio.operations.ServiceOperations.list_shares_segment": null, + "azure.storage.fileshare.operations.ShareOperations.create": null, + "azure.storage.fileshare.aio.operations.ShareOperations.create": null, + "azure.storage.fileshare.operations.ShareOperations.get_properties": null, + "azure.storage.fileshare.aio.operations.ShareOperations.get_properties": null, + "azure.storage.fileshare.operations.ShareOperations.delete": null, + "azure.storage.fileshare.aio.operations.ShareOperations.delete": null, + "azure.storage.fileshare.operations.ShareOperations.acquire_lease": null, + "azure.storage.fileshare.aio.operations.ShareOperations.acquire_lease": null, + "azure.storage.fileshare.operations.ShareOperations.release_lease": null, + "azure.storage.fileshare.aio.operations.ShareOperations.release_lease": null, + "azure.storage.fileshare.operations.ShareOperations.change_lease": null, + "azure.storage.fileshare.aio.operations.ShareOperations.change_lease": null, + "azure.storage.fileshare.operations.ShareOperations.renew_lease": null, + "azure.storage.fileshare.aio.operations.ShareOperations.renew_lease": null, + "azure.storage.fileshare.operations.ShareOperations.break_lease": null, + "azure.storage.fileshare.aio.operations.ShareOperations.break_lease": null, + "azure.storage.fileshare.operations.ShareOperations.create_snapshot": null, + "azure.storage.fileshare.aio.operations.ShareOperations.create_snapshot": null, + "azure.storage.fileshare.operations.ShareOperations.create_permission": null, + "azure.storage.fileshare.aio.operations.ShareOperations.create_permission": null, + "azure.storage.fileshare.operations.ShareOperations.get_permission": null, + "azure.storage.fileshare.aio.operations.ShareOperations.get_permission": null, + "azure.storage.fileshare.operations.ShareOperations.set_properties": null, + "azure.storage.fileshare.aio.operations.ShareOperations.set_properties": null, + "azure.storage.fileshare.operations.ShareOperations.set_metadata": null, + "azure.storage.fileshare.aio.operations.ShareOperations.set_metadata": null, + "azure.storage.fileshare.operations.ShareOperations.get_access_policy": null, + "azure.storage.fileshare.aio.operations.ShareOperations.get_access_policy": null, + "azure.storage.fileshare.operations.ShareOperations.set_access_policy": null, + "azure.storage.fileshare.aio.operations.ShareOperations.set_access_policy": null, + "azure.storage.fileshare.operations.ShareOperations.get_statistics": null, + "azure.storage.fileshare.aio.operations.ShareOperations.get_statistics": null, + "azure.storage.fileshare.operations.ShareOperations.restore": null, + "azure.storage.fileshare.aio.operations.ShareOperations.restore": null, + "azure.storage.fileshare.operations.DirectoryOperations.create": null, + "azure.storage.fileshare.aio.operations.DirectoryOperations.create": null, + "azure.storage.fileshare.operations.DirectoryOperations.get_properties": null, + "azure.storage.fileshare.aio.operations.DirectoryOperations.get_properties": null, + "azure.storage.fileshare.operations.DirectoryOperations.delete": null, + "azure.storage.fileshare.aio.operations.DirectoryOperations.delete": null, + "azure.storage.fileshare.operations.DirectoryOperations.set_properties": null, + "azure.storage.fileshare.aio.operations.DirectoryOperations.set_properties": null, + "azure.storage.fileshare.operations.DirectoryOperations.set_metadata": null, + "azure.storage.fileshare.aio.operations.DirectoryOperations.set_metadata": null, + "azure.storage.fileshare.operations.DirectoryOperations.list_files_and_directories_segment": null, + "azure.storage.fileshare.aio.operations.DirectoryOperations.list_files_and_directories_segment": null, + "azure.storage.fileshare.operations.DirectoryOperations.list_handles": null, + "azure.storage.fileshare.aio.operations.DirectoryOperations.list_handles": null, + "azure.storage.fileshare.operations.DirectoryOperations.force_close_handles": null, + "azure.storage.fileshare.aio.operations.DirectoryOperations.force_close_handles": null, + "azure.storage.fileshare.operations.DirectoryOperations.rename": null, + "azure.storage.fileshare.aio.operations.DirectoryOperations.rename": null, + "azure.storage.fileshare.operations.FileOperations.create": null, + "azure.storage.fileshare.aio.operations.FileOperations.create": null, + "azure.storage.fileshare.operations.FileOperations.download": null, + "azure.storage.fileshare.aio.operations.FileOperations.download": null, + "azure.storage.fileshare.operations.FileOperations.get_properties": null, + "azure.storage.fileshare.aio.operations.FileOperations.get_properties": null, + "azure.storage.fileshare.operations.FileOperations.delete": null, + "azure.storage.fileshare.aio.operations.FileOperations.delete": null, + "azure.storage.fileshare.operations.FileOperations.set_http_headers": null, + "azure.storage.fileshare.aio.operations.FileOperations.set_http_headers": null, + "azure.storage.fileshare.operations.FileOperations.set_metadata": null, + "azure.storage.fileshare.aio.operations.FileOperations.set_metadata": null, + "azure.storage.fileshare.operations.FileOperations.acquire_lease": null, + "azure.storage.fileshare.aio.operations.FileOperations.acquire_lease": null, + "azure.storage.fileshare.operations.FileOperations.release_lease": null, + "azure.storage.fileshare.aio.operations.FileOperations.release_lease": null, + "azure.storage.fileshare.operations.FileOperations.change_lease": null, + "azure.storage.fileshare.aio.operations.FileOperations.change_lease": null, + "azure.storage.fileshare.operations.FileOperations.break_lease": null, + "azure.storage.fileshare.aio.operations.FileOperations.break_lease": null, + "azure.storage.fileshare.operations.FileOperations.upload_range": null, + "azure.storage.fileshare.aio.operations.FileOperations.upload_range": null, + "azure.storage.fileshare.operations.FileOperations.upload_range_from_url": null, + "azure.storage.fileshare.aio.operations.FileOperations.upload_range_from_url": null, + "azure.storage.fileshare.operations.FileOperations.get_range_list": null, + "azure.storage.fileshare.aio.operations.FileOperations.get_range_list": null, + "azure.storage.fileshare.operations.FileOperations.start_copy": null, + "azure.storage.fileshare.aio.operations.FileOperations.start_copy": null, + "azure.storage.fileshare.operations.FileOperations.abort_copy": null, + "azure.storage.fileshare.aio.operations.FileOperations.abort_copy": null, + "azure.storage.fileshare.operations.FileOperations.list_handles": null, + "azure.storage.fileshare.aio.operations.FileOperations.list_handles": null, + "azure.storage.fileshare.operations.FileOperations.force_close_handles": null, + "azure.storage.fileshare.aio.operations.FileOperations.force_close_handles": null, + "azure.storage.fileshare.operations.FileOperations.rename": null, + "azure.storage.fileshare.aio.operations.FileOperations.rename": null, + "azure.storage.fileshare.operations.FileOperations.create_symbolic_link": null, + "azure.storage.fileshare.aio.operations.FileOperations.create_symbolic_link": null, + "azure.storage.fileshare.operations.FileOperations.get_symbolic_link": null, + "azure.storage.fileshare.aio.operations.FileOperations.get_symbolic_link": null, + "azure.storage.fileshare.operations.FileOperations.create_hard_link": null, + "azure.storage.fileshare.aio.operations.FileOperations.create_hard_link": null + } +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/__init__.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/__init__.py index cb14cb305ba5..bf3a941538ae 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/__init__.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/__init__.py @@ -54,6 +54,7 @@ DeleteSnapshotsOptionType, FileLastWrittenMode, FilePermissionFormat, + FilePropertySemantics, FileRangeWriteType, LeaseDurationType, LeaseStateType, @@ -111,6 +112,7 @@ "DeleteSnapshotsOptionType", "FileLastWrittenMode", "FilePermissionFormat", + "FilePropertySemantics", "FileRangeWriteType", "LeaseDurationType", "LeaseStateType", diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py index 75b0c467b4a2..550ebe4ff758 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py @@ -48,6 +48,13 @@ class FilePermissionFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): BINARY = "Binary" +class FilePropertySemantics(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """FilePropertySemantics.""" + + NEW = "New" + RESTORE = "Restore" + + class FileRangeWriteType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """FileRangeWriteType.""" diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py index ba7d7a8b3c0b..987bb6c32382 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py @@ -49,6 +49,7 @@ def build_create_request( owner: Optional[str] = None, group: Optional[str] = None, file_mode: Optional[str] = None, + file_property_semantics: Optional[Union[str, _models.FilePropertySemantics]] = None, allow_trailing_dot: Optional[bool] = None, file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, **kwargs: Any @@ -57,7 +58,7 @@ def build_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -103,6 +104,10 @@ def build_create_request( _headers["x-ms-group"] = _SERIALIZER.header("group", group, "str") if file_mode is not None: _headers["x-ms-mode"] = _SERIALIZER.header("file_mode", file_mode, "str") + if file_property_semantics is not None: + _headers["x-ms-file-property-semantics"] = _SERIALIZER.header( + "file_property_semantics", file_property_semantics, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -121,7 +126,7 @@ def build_get_properties_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -162,7 +167,7 @@ def build_delete_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -212,7 +217,7 @@ def build_set_properties_request( restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -276,7 +281,7 @@ def build_set_metadata_request( restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -325,7 +330,7 @@ def build_list_files_and_directories_segment_request( # pylint: disable=name-to restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -381,7 +386,7 @@ def build_list_handles_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["listhandles"] = kwargs.pop("comp", _params.pop("comp", "listhandles")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -432,7 +437,7 @@ def build_force_close_handles_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["forceclosehandles"] = kwargs.pop("comp", _params.pop("comp", "forceclosehandles")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -493,7 +498,7 @@ def build_rename_request( restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) comp: Literal["rename"] = kwargs.pop("comp", _params.pop("comp", "rename")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -588,6 +593,7 @@ def create( # pylint: disable=inconsistent-return-statements owner: Optional[str] = None, group: Optional[str] = None, file_mode: Optional[str] = None, + file_property_semantics: Optional[Union[str, _models.FilePropertySemantics]] = None, **kwargs: Any ) -> None: """Creates a new directory under the specified share or parent directory. @@ -638,6 +644,11 @@ def create( # pylint: disable=inconsistent-return-statements :param file_mode: Optional, NFS only. The file mode of the file or directory. Default value is None. :type file_mode: str + :param file_property_semantics: SMB only, default value is New. New will forcefully add the + ARCHIVE attribute flag and alter the permissions specified in x-ms-file-permission to inherit + missing permissions from the parent. Restore will apply changes without further modification. + Known values are: "New" and "Restore". Default value is None. + :type file_property_semantics: str or ~azure.storage.fileshare.models.FilePropertySemantics :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -670,6 +681,7 @@ def create( # pylint: disable=inconsistent-return-statements owner=owner, group=group, file_mode=file_mode, + file_property_semantics=file_property_semantics, allow_trailing_dot=self._config.allow_trailing_dot, file_request_intent=self._config.file_request_intent, restype=restype, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py index 1557b083cce8..ad3435f86264 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py @@ -60,6 +60,10 @@ def build_create_request( group: Optional[str] = None, file_mode: Optional[str] = None, nfs_file_type: Optional[Union[str, _models.NfsFileType]] = None, + content_md5: Optional[bytes] = None, + file_property_semantics: Optional[Union[str, _models.FilePropertySemantics]] = None, + content_length: Optional[int] = None, + content: Optional[IO[bytes]] = None, allow_trailing_dot: Optional[bool] = None, file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, **kwargs: Any @@ -68,7 +72,8 @@ def build_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) file_type_constant: Literal["file"] = kwargs.pop("file_type_constant", _headers.pop("x-ms-type", "file")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -133,9 +138,19 @@ def build_create_request( _headers["x-ms-mode"] = _SERIALIZER.header("file_mode", file_mode, "str") if nfs_file_type is not None: _headers["x-ms-file-file-type"] = _SERIALIZER.header("nfs_file_type", nfs_file_type, "str") + if content_md5 is not None: + _headers["Content-MD5"] = _SERIALIZER.header("content_md5", content_md5, "bytearray") + if file_property_semantics is not None: + _headers["x-ms-file-property-semantics"] = _SERIALIZER.header( + "file_property_semantics", file_property_semantics, "str" + ) + if content_length is not None: + _headers["Content-Length"] = _SERIALIZER.header("content_length", content_length, "int") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, content=content, **kwargs) def build_download_request( @@ -153,7 +168,7 @@ def build_download_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -202,7 +217,7 @@ def build_get_properties_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -244,7 +259,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -302,7 +317,7 @@ def build_set_http_headers_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -383,7 +398,7 @@ def build_set_metadata_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -430,7 +445,7 @@ def build_acquire_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -479,7 +494,7 @@ def build_release_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -526,7 +541,7 @@ def build_change_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -574,7 +589,7 @@ def build_break_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -628,7 +643,7 @@ def build_upload_range_request( comp: Literal["range"] = kwargs.pop("comp", _params.pop("comp", "range")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -700,7 +715,7 @@ def build_upload_range_from_url_request( file_range_write_from_url: Literal["update"] = kwargs.pop( "file_range_write_from_url", _headers.pop("x-ms-write", "update") ) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -776,7 +791,7 @@ def build_get_range_list_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["rangelist"] = kwargs.pop("comp", _params.pop("comp", "rangelist")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -843,7 +858,7 @@ def build_start_copy_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -931,7 +946,7 @@ def build_abort_copy_request( copy_action_abort_constant: Literal["abort"] = kwargs.pop( "copy_action_abort_constant", _headers.pop("x-ms-copy-action", "abort") ) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -977,7 +992,7 @@ def build_list_handles_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["listhandles"] = kwargs.pop("comp", _params.pop("comp", "listhandles")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1025,7 +1040,7 @@ def build_force_close_handles_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["forceclosehandles"] = kwargs.pop("comp", _params.pop("comp", "forceclosehandles")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1084,7 +1099,7 @@ def build_rename_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["rename"] = kwargs.pop("comp", _params.pop("comp", "rename")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1165,7 +1180,7 @@ def build_create_symbolic_link_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["symboliclink"] = kwargs.pop("restype", _params.pop("restype", "symboliclink")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1218,7 +1233,7 @@ def build_get_symbolic_link_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["symboliclink"] = kwargs.pop("restype", _params.pop("restype", "symboliclink")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1262,7 +1277,7 @@ def build_create_hard_link_request( restype: Literal["hardlink"] = kwargs.pop("restype", _params.pop("restype", "hardlink")) file_type_constant: Literal["file"] = kwargs.pop("file_type_constant", _headers.pop("x-ms-type", "file")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1329,8 +1344,12 @@ def create( # pylint: disable=inconsistent-return-statements group: Optional[str] = None, file_mode: Optional[str] = None, nfs_file_type: Optional[Union[str, _models.NfsFileType]] = None, + content_md5: Optional[bytes] = None, + file_property_semantics: Optional[Union[str, _models.FilePropertySemantics]] = None, + content_length: Optional[int] = None, file_http_headers: Optional[_models.FileHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, + optionalbody: Optional[IO[bytes]] = None, **kwargs: Any ) -> None: """Creates a new file or replaces a file. Note it only initializes the file with no content. @@ -1386,10 +1405,26 @@ def create( # pylint: disable=inconsistent-return-statements :param nfs_file_type: Optional, NFS only. Type of the file or directory. Known values are: "Regular", "Directory", and "SymLink". Default value is None. :type nfs_file_type: str or ~azure.storage.fileshare.models.NfsFileType + :param content_md5: An MD5 hash of the content. This hash is used to verify the integrity of + the data during transport. When the Content-MD5 header is specified, the File service compares + the hash of the content that has arrived with the header value that was sent. If the two hashes + do not match, the operation will fail with error code 400 (Bad Request). Default value is None. + :type content_md5: bytes + :param file_property_semantics: SMB only, default value is New. New will forcefully add the + ARCHIVE attribute flag and alter the permissions specified in x-ms-file-permission to inherit + missing permissions from the parent. Restore will apply changes without further modification. + Known values are: "New" and "Restore". Default value is None. + :type file_property_semantics: str or ~azure.storage.fileshare.models.FilePropertySemantics + :param content_length: Specifies the number of bytes being transmitted in the request body. + When the x-ms-write header is set to clear, the value of this header must be set to zero. + Default value is None. + :type content_length: int :param file_http_headers: Parameter group. Default value is None. :type file_http_headers: ~azure.storage.fileshare.models.FileHTTPHeaders :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :param optionalbody: Initial data. Default value is None. + :type optionalbody: IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1406,6 +1441,7 @@ def create( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} file_type_constant: Literal["file"] = kwargs.pop("file_type_constant", _headers.pop("x-ms-type", "file")) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) cls: ClsType[None] = kwargs.pop("cls", None) _file_content_type = None @@ -1424,6 +1460,7 @@ def create( # pylint: disable=inconsistent-return-statements _file_content_type = file_http_headers.file_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id + _content = optionalbody _request = build_create_request( url=self._config.url, @@ -1448,10 +1485,15 @@ def create( # pylint: disable=inconsistent-return-statements group=group, file_mode=file_mode, nfs_file_type=nfs_file_type, + content_md5=content_md5, + file_property_semantics=file_property_semantics, + content_length=content_length, allow_trailing_dot=self._config.allow_trailing_dot, file_request_intent=self._config.file_request_intent, file_type_constant=file_type_constant, + content_type=content_type, version=self._config.version, + content=_content, headers=_headers, params=_params, ) @@ -1499,6 +1541,8 @@ def create( # pylint: disable=inconsistent-return-statements response_headers["x-ms-owner"] = self._deserialize("str", response.headers.get("x-ms-owner")) response_headers["x-ms-group"] = self._deserialize("str", response.headers.get("x-ms-group")) response_headers["x-ms-file-file-type"] = self._deserialize("str", response.headers.get("x-ms-file-file-type")) + response_headers["Content-MD5"] = self._deserialize("bytearray", response.headers.get("Content-MD5")) + response_headers["Content-Length"] = self._deserialize("int", response.headers.get("Content-Length")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py index 3d15c54f8b4d..8c5190b2013c 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py @@ -48,7 +48,7 @@ def build_set_properties_request( restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -88,7 +88,7 @@ def build_get_properties_request( restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -129,7 +129,7 @@ def build_list_shares_segment_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py index 160b11e3bf13..6d42e4b22f8d 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py @@ -57,7 +57,7 @@ def build_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -129,7 +129,7 @@ def build_get_properties_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -172,7 +172,7 @@ def build_delete_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -220,7 +220,7 @@ def build_acquire_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -271,7 +271,7 @@ def build_release_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -320,7 +320,7 @@ def build_change_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -370,7 +370,7 @@ def build_renew_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -419,7 +419,7 @@ def build_break_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -467,7 +467,7 @@ def build_create_snapshot_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["snapshot"] = kwargs.pop("comp", _params.pop("comp", "snapshot")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -508,7 +508,7 @@ def build_create_permission_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["filepermission"] = kwargs.pop("comp", _params.pop("comp", "filepermission")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -550,7 +550,7 @@ def build_get_permission_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["filepermission"] = kwargs.pop("comp", _params.pop("comp", "filepermission")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -603,7 +603,7 @@ def build_set_properties_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -675,7 +675,7 @@ def build_set_metadata_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -718,7 +718,7 @@ def build_get_access_policy_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -761,7 +761,7 @@ def build_set_access_policy_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -804,7 +804,7 @@ def build_get_statistics_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["stats"] = kwargs.pop("comp", _params.pop("comp", "stats")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -847,7 +847,7 @@ def build_restore_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["undelete"] = kwargs.pop("comp", _params.pop("comp", "undelete")) - version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05")) + version: Literal["2026-02-06"] = kwargs.pop("version", _headers.pop("x-ms-version", "2026-02-06")) accept = _headers.pop("Accept", "application/xml") # Construct URL diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py index 9f4626c8421d..8b2e9c7c18b7 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py @@ -978,6 +978,16 @@ def create_directory(self, directory_name: str, **kwargs: Any) -> ShareDirectory NFS only. The owning group of the directory. :keyword str file_mode: NFS only. The file mode of the directory. + :keyword file_property_semantics: + SMB only. Specifies permissions to be configured. Default value is None. + If not specified or None is passed, New will be the default. Possible values are: + + New - forcefully add the ARCHIVE attribute flag and alter the permissions specified in + x-ms-file-permission to inherit missing permissions from the parent. + + Restore - apply changes without further modification. + + :paramtype file_property_semantics: Literal["New", "Restore"] :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. diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py index aefaa444565c..6220c1b56c10 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py @@ -348,6 +348,16 @@ async def create_directory(self, **kwargs: Any) -> Dict[str, Any]: NFS only. The owning group of the directory. :keyword str file_mode: NFS only. The file mode of the directory. + :keyword file_property_semantics: + SMB only. Specifies permissions to be configured. Default value is None. + If not specified or None is passed, New will be the default. Possible values are: + + New - forcefully add the ARCHIVE attribute flag and alter the permissions specified in + x-ms-file-permission to inherit missing permissions from the parent. + + Restore - apply changes without further modification. + + :paramtype file_property_semantics: Literal["New", "Restore"] :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. diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py index 398e62bfb7c8..7d1055620373 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py @@ -432,6 +432,18 @@ async def create_file( NFS only. The owning group of the file. :keyword str file_mode: NFS only. The file mode of the file. + :keyword file_property_semantics: + SMB only. Specifies permissions to be configured. Default value is None. + If not specified or None is passed, New will be the default. Possible values are: + + New - forcefully add the ARCHIVE attribute flag and alter the permissions specified in + x-ms-file-permission to inherit missing permissions from the parent. + + Restore - apply changes without further modification. + + :paramtype file_property_semantics: Literal["New", "Restore"] + :keyword IO[bytes] data: Initial data to upload. The limit is 4MB. + :keyword int length: Specifies the number of bytes being uploaded in the initial data. :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. @@ -479,6 +491,8 @@ async def create_file( file_permission=file_permission, file_permission_key=permission_key, file_http_headers=file_http_headers, + optionalbody=kwargs.pop('data', None), + content_length=kwargs.pop('length', None), lease_access_conditions=access_conditions, headers=headers, timeout=timeout, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py index a82ca45642c8..3aa786dd5ec3 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py @@ -974,6 +974,16 @@ async def create_directory(self, directory_name: str, **kwargs: Any) -> ShareDir NFS only. The owning group of the directory. :keyword str file_mode: NFS only. The file mode of the directory. + :keyword file_property_semantics: + SMB only. Specifies permissions to be configured. Default value is None. + If not specified or None is passed, New will be the default. Possible values are: + + New - forcefully add the ARCHIVE attribute flag and alter the permissions specified in + x-ms-file-permission to inherit missing permissions from the parent. + + Restore - apply changes without further modification. + + :paramtype file_property_semantics: Literal["New", "Restore"] :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. diff --git a/sdk/storage/azure-storage-file-share/tests/test_directory.py b/sdk/storage/azure-storage-file-share/tests/test_directory.py index 391438bec752..0c67c0096c3c 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_directory.py +++ b/sdk/storage/azure-storage-file-share/tests/test_directory.py @@ -944,7 +944,7 @@ def test_list_subdirectories_and_files_with_snapshot(self, **kwargs): directory.create_subdirectory("subdir1") directory.create_subdirectory("subdir2") directory.upload_file("file1", "data1") - + snapshot = share_client.create_snapshot() directory.create_subdirectory("subdir3") directory.upload_file("file2", "data2") @@ -1453,6 +1453,29 @@ def test_file_permission_format_directory(self, **kwargs): new_directory_client.delete_directory() + @FileSharePreparer() + @recorded_by_proxy + def test_create_directory_semantics(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + share_client = self.fsc.get_share_client(self.share_name) + + directory = share_client.create_directory('dir1', file_property_semantics=None) + props = directory.get_directory_properties() + assert props is not None + + directory = share_client.create_directory('dir2', file_property_semantics='New') + props = directory.get_directory_properties() + assert props is not None + + directory = share_client.create_directory( + 'dir3', file_property_semantics='Restore', file_permission=TEST_FILE_PERMISSIONS + ) + props = directory.get_directory_properties() + assert props is not None + # ------------------------------------------------------------------------------ if __name__ == '__main__': unittest.main() diff --git a/sdk/storage/azure-storage-file-share/tests/test_directory_async.py b/sdk/storage/azure-storage-file-share/tests/test_directory_async.py index 4648df892090..dfb823361e5a 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_directory_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_directory_async.py @@ -1554,4 +1554,27 @@ async def test_file_permission_format_directory(self, **kwargs): await new_directory_client.delete_directory() + @FileSharePreparer() + @recorded_by_proxy_async + async def test_create_directory_semantics(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + await self._setup(storage_account_name, storage_account_key) + share_client = self.fsc.get_share_client(self.share_name) + + directory = await share_client.create_directory('dir1', file_property_semantics=None) + props = await directory.get_directory_properties() + assert props is not None + + directory = await share_client.create_directory('dir2', file_property_semantics='New') + props = await directory.get_directory_properties() + assert props is not None + + directory = await share_client.create_directory( + 'dir3', file_property_semantics='Restore', file_permission=TEST_FILE_PERMISSIONS + ) + props = await directory.get_directory_properties() + assert props is not None + # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-file-share/tests/test_file.py b/sdk/storage/azure-storage-file-share/tests/test_file.py index 819b6293c14d..c698126f6fc8 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file.py @@ -472,6 +472,45 @@ def test_create_file_with_invalid_file_permission(self, **kwargs): with pytest.raises(HttpResponseError): file_name.create_file(1024, file_permission="abcde") + @FileSharePreparer() + @recorded_by_proxy + def test_create_file_semantics(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + file_name = self._get_file_reference() + + file1 = ShareFileClient( + self.account_url(storage_account_name, "file"), + share_name=self.share_name, + file_path=file_name + "file1", + credential=storage_account_key + ) + file1.create_file(1024, file_property_semantics=None) + props = file1.get_file_properties() + assert props is not None + + file2 = ShareFileClient( + self.account_url(storage_account_name, "file"), + share_name=self.share_name, + file_path=file_name + "file2", + credential=storage_account_key + ) + file2.create_file(1024, file_property_semantics="New") + props = file2.get_file_properties() + assert props is not None + + file3 = ShareFileClient( + self.account_url(storage_account_name, "file"), + share_name=self.share_name, + file_path=file_name + "file2", + credential=storage_account_key + ) + file3.create_file(1024, file_property_semantics="Restore", file_permission=TEST_FILE_PERMISSIONS) + props = file3.get_file_properties() + assert props is not None + @FileSharePreparer() @recorded_by_proxy def test_create_file_with_lease(self, **kwargs): @@ -3927,4 +3966,24 @@ def test_upload_range_copy_source_error_and_status_code(self, **kwargs): finally: self.fsc.delete_share(self.share_name) + @FileSharePreparer() + @recorded_by_proxy + def test_create_file_with_data(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + file_name = self._get_file_reference() + file_client = ShareFileClient( + self.account_url(storage_account_name, "file"), + share_name=self.share_name, + file_path=file_name + "file", + credential=storage_account_key + ) + size = 4 * 1024 * 1024 + data = b"A" * size + file_client.create_file(size, data=data, length=size) + downloaded_data = file_client.download_file().readall() + assert downloaded_data == data + # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_async.py b/sdk/storage/azure-storage-file-share/tests/test_file_async.py index f3cc42f5da46..db71322ec773 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file_async.py @@ -484,6 +484,46 @@ async def test_create_file_with_invalid_file_permission(self, **kwargs): with pytest.raises(HttpResponseError): await file_name.create_file(1024, file_permission="abcde") + @FileSharePreparer() + @recorded_by_proxy_async + async def test_create_file_semantics(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + await self._setup_share(storage_account_name, storage_account_key) + file_name = self._get_file_reference() + + file1 = ShareFileClient( + self.account_url(storage_account_name, "file"), + share_name=self.share_name, + file_path=file_name + "file1", + credential=storage_account_key + ) + await file1.create_file(1024, file_property_semantics=None) + props = await file1.get_file_properties() + assert props is not None + + file2 = ShareFileClient( + self.account_url(storage_account_name, "file"), + share_name=self.share_name, + file_path=file_name + "file2", + credential=storage_account_key + ) + await file2.create_file(1024, file_property_semantics="New") + props = await file2.get_file_properties() + assert props is not None + + file3 = ShareFileClient( + self.account_url(storage_account_name, "file"), + share_name=self.share_name, + file_path=file_name + "file2", + credential=storage_account_key + ) + await file3.create_file(1024, file_property_semantics="Restore", file_permission=TEST_FILE_PERMISSIONS) + props = await file3.get_file_properties() + assert props is not None + @FileSharePreparer() @recorded_by_proxy_async async def test_create_file_with_lease(self, **kwargs): @@ -4050,3 +4090,25 @@ async def test_upload_range_copy_source_error_and_status_code(self, **kwargs): assert e.value.response.headers["x-ms-copy-source-error-code"] == "NoAuthenticationInformation" finally: await self.fsc.delete_share(self.share_name) + + @FileSharePreparer() + @recorded_by_proxy_async + async def test_create_file_with_data(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + await self._setup_share(storage_account_name, storage_account_key) + + file_name = self._get_file_reference() + file_client = ShareFileClient( + self.account_url(storage_account_name, "file"), + share_name=self.share_name, + file_path=file_name + "file", + credential=storage_account_key + ) + size = 4 * 1024 * 1024 + data = b"A" * size + await file_client.create_file(size, data=data, length=size) + downloaded_data = await (await file_client.download_file()).readall() + assert downloaded_data == data