Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Storage] [STG93] Rename Support for List Ranges Diff API #33893

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-file-share/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -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_5add1a3035"
"Tag": "python/storage/azure-storage-file-share_bdf1e465af"
}
Original file line number Diff line number Diff line change
Expand Up @@ -1474,14 +1474,15 @@ def get_ranges( # type: ignore
return [{'start': file_range.start, 'end': file_range.end} for file_range in ranges.ranges]

@distributed_trace
def get_ranges_diff( # type: ignore
self,
previous_sharesnapshot, # type: Union[str, Dict[str, Any]]
offset=None, # type: Optional[int]
length=None, # type: Optional[int]
**kwargs # type: Any
):
# type: (...) -> Tuple[List[Dict[str, int]], List[Dict[str, int]]]
def get_ranges_diff(
self,
previous_sharesnapshot: Union[str, Dict[str, Any]],
offset: Optional[int] = None,
length: Optional[int] = None,
*,
support_rename: Optional[bool] = None,
**kwargs: Any
) -> Tuple[List[Dict[str, int]], List[Dict[str, int]]]:
"""Returns the list of valid page ranges for a file or snapshot
of a file.

Expand All @@ -1495,6 +1496,11 @@ def get_ranges_diff( # type: ignore
The snapshot diff parameter that contains an opaque DateTime value that
specifies a previous file snapshot to be compared
against a more recent snapshot or the current file.
:keyword Optional[bool] support_rename:
Only valid if previous_sharesnapshot parameter is provided. Specifies whether the changed ranges for
a file that has been renamed or moved between the target snapshot (or live file) and the previous
snapshot should be listed. If set to True, the valid changed ranges for the file will be returned.
If set to False, the operation will result in a 409 (Conflict) response.
:keyword lease:
Required if the file has an active lease. Value can be a ShareLeaseClient object
or the lease ID as a string.
Expand All @@ -1514,6 +1520,7 @@ def get_ranges_diff( # type: ignore
offset=offset,
length=length,
previous_sharesnapshot=previous_sharesnapshot,
support_rename=support_rename,
**kwargs)
try:
ranges = self._client.file.get_range_list(**options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,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 "2024-02-04". Note that overriding this default value may result in unsupported behavior.
is "2024-05-04". 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 "2024-02-04". Note that overriding this default value may result in unsupported behavior.
is "2024-05-04". 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
Expand All @@ -49,7 +49,7 @@ def __init__(
allow_source_trailing_dot: Optional[bool] = None,
**kwargs: Any
) -> None:
version: Literal["2024-02-04"] = kwargs.pop("version", "2024-02-04")
version: Literal["2024-05-04"] = kwargs.pop("version", "2024-05-04")
file_range_write_from_url: Literal["update"] = kwargs.pop("file_range_write_from_url", "update")

if url is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,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 "2024-02-04". Note that overriding this default value may result in unsupported behavior.
is "2024-05-04". 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 "2024-02-04". Note that overriding this default value may result in unsupported behavior.
is "2024-05-04". 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
Expand All @@ -49,7 +49,7 @@ def __init__(
allow_source_trailing_dot: Optional[bool] = None,
**kwargs: Any
) -> None:
version: Literal["2024-02-04"] = kwargs.pop("version", "2024-02-04")
version: Literal["2024-05-04"] = kwargs.pop("version", "2024-05-04")
file_range_write_from_url: Literal["update"] = kwargs.pop("file_range_write_from_url", "update")

if url is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1521,6 +1521,7 @@ async def get_range_list(
prevsharesnapshot: Optional[str] = None,
timeout: Optional[int] = None,
range: Optional[str] = None,
support_rename: Optional[bool] = None,
lease_access_conditions: Optional[_models.LeaseAccessConditions] = None,
**kwargs: Any
) -> _models.ShareFileRangeList:
Expand All @@ -1540,6 +1541,13 @@ async def get_range_list(
:param range: Specifies the range of bytes over which to list ranges, inclusively. Default
value is None.
:type range: str
:param support_rename: This header is allowed only when PrevShareSnapshot query parameter is
set. Determines whether the changed ranges for a file that has been renamed or moved between
the target snapshot (or the live file) and the previous snapshot should be listed. If the value
is true, the valid changed ranges for the file will be returned. If the value is false, the
operation will result in a failure with 409 (Conflict) response. The default value is false.
Default value is None.
:type support_rename: bool
:param lease_access_conditions: Parameter group. Default value is None.
:type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions
:keyword comp: comp. Default value is "rangelist". Note that overriding this default value may
Expand Down Expand Up @@ -1575,6 +1583,7 @@ async def get_range_list(
timeout=timeout,
range=range,
lease_id=_lease_id,
support_rename=support_rename,
allow_trailing_dot=self._config.allow_trailing_dot,
file_request_intent=self._config.file_request_intent,
comp=comp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ class StorageErrorCode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
SHARE_SNAPSHOT_COUNT_EXCEEDED = "ShareSnapshotCountExceeded"
SHARE_SNAPSHOT_OPERATION_NOT_SUPPORTED = "ShareSnapshotOperationNotSupported"
SHARE_HAS_SNAPSHOTS = "ShareHasSnapshots"
PREVIOUS_SNAPSHOT_NOT_FOUND = "PreviousSnapshotNotFound"
CONTAINER_QUOTA_DOWNGRADE_NOT_ALLOWED = "ContainerQuotaDowngradeNotAllowed"
AUTHORIZATION_SOURCE_IP_MISMATCH = "AuthorizationSourceIPMismatch"
AUTHORIZATION_PROTOCOL_MISMATCH = "AuthorizationProtocolMismatch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,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["2024-02-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-02-04"))
version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04"))
accept = _headers.pop("Accept", "application/xml")

# Construct URL
Expand Down Expand Up @@ -105,7 +105,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["2024-02-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-02-04"))
version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04"))
accept = _headers.pop("Accept", "application/xml")

# Construct URL
Expand Down Expand Up @@ -146,7 +146,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["2024-02-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-02-04"))
version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04"))
accept = _headers.pop("Accept", "application/xml")

# Construct URL
Expand Down Expand Up @@ -192,7 +192,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["2024-02-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-02-04"))
version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04"))
accept = _headers.pop("Accept", "application/xml")

# Construct URL
Expand Down Expand Up @@ -245,7 +245,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["2024-02-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-02-04"))
version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04"))
accept = _headers.pop("Accept", "application/xml")

# Construct URL
Expand Down Expand Up @@ -294,7 +294,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["2024-02-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-02-04"))
version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04"))
accept = _headers.pop("Accept", "application/xml")

# Construct URL
Expand Down Expand Up @@ -350,7 +350,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["2024-02-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-02-04"))
version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04"))
accept = _headers.pop("Accept", "application/xml")

# Construct URL
Expand Down Expand Up @@ -401,7 +401,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["2024-02-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-02-04"))
version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04"))
accept = _headers.pop("Accept", "application/xml")

# Construct URL
Expand Down Expand Up @@ -461,7 +461,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["2024-02-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-02-04"))
version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04"))
accept = _headers.pop("Accept", "application/xml")

# Construct URL
Expand Down
Loading