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

Recursive acl #13476

Merged
merged 7 commits into from
Sep 23, 2020
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
4 changes: 4 additions & 0 deletions sdk/storage/azure-storage-file-datalake/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
## 12.1.0 (2020-08-12)
- Added `query_file` API to enable users to select/project on DataLake file data by providing simple query expressions.

## XX.XX.XX
**New Feature**
- Added support for recursively set/update/remove Access Control on a path and sub-paths.

## 12.1.0b1 (2020-07-07)
**New Feature**
- Block size is increased to 4GB at maximum, max single put size is increased to 5GB.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
AccessPolicy,
DelimitedTextDialect,
DelimitedJsonDialect,
DataLakeFileQueryError
DataLakeFileQueryError,
AccessControlChangeResult,
AccessControlChangeCounters,
AccessControlChangeFailure,
AccessControlChanges,
)
from ._shared_access_signature import generate_account_sas, generate_file_system_sas, generate_directory_sas, \
generate_file_sas
Expand Down Expand Up @@ -63,6 +67,10 @@
'PathPropertiesPaged',
'LeaseProperties',
'ContentSettings',
'AccessControlChangeResult',
'AccessControlChangeCounters',
'AccessControlChangeFailure',
'AccessControlChanges',
'AccountSasPermissions',
'FileSystemSasPermissions',
'DirectorySasPermissions',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class FileSystemProperties(object):
dictionary interface, for example: ``file_system_props["last_modified"]``.
Additionally, the file system name is available as ``file_system_props["name"]``.
"""

def __init__(self):
self.name = None
self.last_modified = None
Expand Down Expand Up @@ -130,6 +131,7 @@ class DirectoryProperties(DictMixin):
before being permanently deleted by the service.
:var ~azure.storage.filedatalake.ContentSettings content_settings:
"""

def __init__(self, **kwargs):
super(DirectoryProperties, self).__init__(
**kwargs
Expand Down Expand Up @@ -178,6 +180,7 @@ class FileProperties(DictMixin):
before being permanently deleted by the service.
:var ~azure.storage.filedatalake.ContentSettings content_settings:
"""

def __init__(self, **kwargs):
super(FileProperties, self).__init__(
**kwargs
Expand Down Expand Up @@ -229,6 +232,7 @@ class PathProperties(object):
conditionally.
:ivar content_length: the size of file if the path is a file.
"""

def __init__(self, **kwargs):
super(PathProperties, self).__init__(
**kwargs
Expand Down Expand Up @@ -270,6 +274,7 @@ class PathPropertiesPaged(PageIterator):
call.
:param str continuation_token: An opaque continuation token.
"""

def __init__(
self, command,
recursive,
Expand Down Expand Up @@ -328,6 +333,7 @@ class LeaseProperties(BlobLeaseProperties):
:ivar str duration:
When a file is leased, specifies whether the lease is of infinite or fixed duration.
"""

def __init__(self):
self.status = None
self.state = None
Expand Down Expand Up @@ -380,6 +386,7 @@ class ContentSettings(BlobContentSettings):
header is stored so that the client can check for message content
integrity.
"""

def __init__(
self, **kwargs):
super(ContentSettings, self).__init__(
Expand Down Expand Up @@ -409,6 +416,7 @@ class FileSystemSasPermissions(ContainerSasPermissions):
:param bool list:
List paths in the file system.
"""

def __init__(self, read=False, write=False, delete=False, list=False # pylint: disable=redefined-builtin
):
super(FileSystemSasPermissions, self).__init__(
Expand All @@ -429,6 +437,7 @@ class DirectorySasPermissions(BlobSasPermissions):
:param bool delete:
Delete the directory.
"""

def __init__(self, read=False, create=False, write=False,
delete=False):
super(DirectorySasPermissions, self).__init__(
Expand All @@ -451,6 +460,7 @@ class FileSasPermissions(BlobSasPermissions):
:param bool delete:
Delete the file.
"""

def __init__(self, read=False, create=False, write=False,
delete=False):
super(FileSasPermissions, self).__init__(
Expand Down Expand Up @@ -502,6 +512,7 @@ class AccessPolicy(BlobAccessPolicy):
be UTC.
:paramtype start: ~datetime.datetime or str
"""

def __init__(self, permission=None, expiry=None, **kwargs):
super(AccessPolicy, self).__init__(
permission=permission, expiry=expiry, start=kwargs.pop('start', None)
Expand All @@ -521,6 +532,7 @@ class ResourceTypes(BlobResourceTypes):
Access to object-level APIs for
files(e.g. Create File, etc.)
"""

def __init__(self, service=False, file_system=False, object=False # pylint: disable=redefined-builtin
):
super(ResourceTypes, self).__init__(service=service, container=file_system, object=object)
Expand Down Expand Up @@ -549,6 +561,7 @@ class UserDelegationKey(BlobUserDelegationKey):
:ivar str value:
The user delegation key.
"""

@classmethod
def _from_generated(cls, generated):
delegation_key = cls()
Expand Down Expand Up @@ -641,8 +654,84 @@ class DataLakeFileQueryError(object):
:ivar int position:
The blob offset at which the error occurred.
"""

def __init__(self, error=None, is_fatal=False, description=None, position=None):
self.error = error
self.is_fatal = is_fatal
self.description = description
self.position = position


class AccessControlChangeCounters(object):
"""
AccessControlChangeCounters contains counts of operations that change Access Control Lists recursively.

:ivar int directories_successful:
Number of directories where Access Control List has been updated successfully.
:ivar int files_successful:
Number of files where Access Control List has been updated successfully.
:ivar int failure_count:
Number of paths where Access Control List update has failed.
"""

def __init__(self, directories_successful, files_successful, failure_count):
self.directories_successful = directories_successful
self.files_successful = files_successful
self.failure_count = failure_count


class AccessControlChangeResult(object):
"""
AccessControlChangeResult contains result of operations that change Access Control Lists recursively.

:ivar ~azure.storage.filedatalake.AccessControlChangeCounters counters:
Contains counts of paths changed from start of the operation.
:ivar str continuation:
Optional continuation token.
Value is present when operation is split into multiple batches and can be used to resume progress.
"""

def __init__(self, counters, continuation):
self.counters = counters
self.continuation = continuation


class AccessControlChangeFailure(object):
"""
Represents an entry that failed to update Access Control List.

:ivar str name:
Name of the entry.
:ivar bool is_directory:
Indicates whether the entry is a directory.
:ivar str error_message:
Indicates the reason why the entry failed to update.
"""

def __init__(self, name, is_directory, error_message):
self.name = name
self.is_directory = is_directory
self.error_message = error_message


class AccessControlChanges(object):
"""
AccessControlChanges contains batch and cumulative counts of operations
that change Access Control Lists recursively.
Additionally it exposes path entries that failed to update while these operations progress.

:ivar ~azure.storage.filedatalake.AccessControlChangeCounters batch_counters:
Contains counts of paths changed within single batch.
:ivar ~azure.storage.filedatalake.AccessControlChangeCounters aggregate_counters:
Contains counts of paths changed from start of the operation.
:ivar list(~azure.storage.filedatalake.AccessControlChangeFailure) batch_failures:
List of path entries that failed to update Access Control List within single batch.
:ivar str continuation:
An opaque continuation token that may be used to resume the operations in case of failures.
"""

def __init__(self, batch_counters, aggregate_counters, batch_failures, continuation):
self.batch_counters = batch_counters
self.aggregate_counters = aggregate_counters
self.batch_failures = batch_failures
self.continuation = continuation
Loading