-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Set expiry #12642
Merged
xiafu-msft
merged 9 commits into
Azure:feature/storage-stg74
from
xiafu-msft:set-expiry
Sep 29, 2020
Merged
Set expiry #12642
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ec81912
[DataLake][SetExpiry]Set Expiry of DataLake File
xiafu-msft 9bc70d4
address comments
xiafu-msft c6a8d7d
use datalake set_expiry operation
xiafu-msft b440161
Merge branch 'feature/storage-stg74' into set-expiry
xiafu-msft eeddd69
Merge branch 'feature/storage-stg74' into set-expiry
xiafu-msft 99d2007
add serialize rfc1123 and fix pylint
xiafu-msft ae9cab5
fix pylint
xiafu-msft beee98a
remove return type
xiafu-msft 49b762e
Merge branch 'feature/storage-stg74' into set-expiry
xiafu-msft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_list_paths_helper.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# ------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for | ||
# license information. | ||
# -------------------------------------------------------------------------- | ||
from azure.core.paging import PageIterator | ||
from ._generated.models import StorageErrorException | ||
from ._models import PathProperties | ||
from ._deserialize import return_headers_and_deserialized_path_list | ||
from ._generated.models import Path | ||
from ._shared.response_handlers import process_storage_error | ||
|
||
|
||
class PathPropertiesPaged(PageIterator): | ||
"""An Iterable of Path properties. | ||
|
||
:ivar str path: Filters the results to return only paths under the specified path. | ||
:ivar int results_per_page: The maximum number of results retrieved per API call. | ||
:ivar str continuation_token: The continuation token to retrieve the next page of results. | ||
:ivar list(~azure.storage.filedatalake.PathProperties) current_page: The current page of listed results. | ||
|
||
:param callable command: Function to retrieve the next page of items. | ||
:param str path: Filters the results to return only paths under the specified path. | ||
:param int max_results: The maximum number of psths to retrieve per | ||
call. | ||
:param str continuation_token: An opaque continuation token. | ||
""" | ||
def __init__( | ||
self, command, | ||
recursive, | ||
path=None, | ||
max_results=None, | ||
continuation_token=None, | ||
upn=None): | ||
super(PathPropertiesPaged, self).__init__( | ||
get_next=self._get_next_cb, | ||
extract_data=self._extract_data_cb, | ||
continuation_token=continuation_token or "" | ||
) | ||
self._command = command | ||
self.recursive = recursive | ||
self.results_per_page = max_results | ||
self.path = path | ||
self.upn = upn | ||
self.current_page = None | ||
self.path_list = None | ||
|
||
def _get_next_cb(self, continuation_token): | ||
try: | ||
return self._command( | ||
self.recursive, | ||
continuation=continuation_token or None, | ||
path=self.path, | ||
max_results=self.results_per_page, | ||
upn=self.upn, | ||
cls=return_headers_and_deserialized_path_list) | ||
except StorageErrorException as error: | ||
process_storage_error(error) | ||
|
||
def _extract_data_cb(self, get_next_return): | ||
self.path_list, self._response = get_next_return | ||
self.current_page = [self._build_item(item) for item in self.path_list] | ||
|
||
return self._response['continuation'] or None, self.current_page | ||
|
||
@staticmethod | ||
def _build_item(item): | ||
if isinstance(item, PathProperties): | ||
return item | ||
if isinstance(item, Path): | ||
path = PathProperties._from_generated(item) # pylint: disable=protected-access | ||
return path | ||
return item |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove return