Пример #1
0
        /// <summary>
        /// Azure DataLakeGen2 Item constructor
        /// </summary>
        /// <param name="blobDir">Cloud blob Directory object</param>
        public AzureDataLakeGen2Item(DataLakeDirectoryClient directoryClient)
        {
            Name        = directoryClient.Name;
            Path        = directoryClient.Path;
            Directory   = directoryClient;
            IsDirectory = true;
            if (directoryClient.Path != "/" || string.IsNullOrEmpty(directoryClient.Path)) //if root directory, GetProperties() will fail. Skip until this is fixed.
            {
                try
                {
                    Properties   = directoryClient.GetProperties();
                    Length       = Properties.ContentLength;
                    ContentType  = Properties.ContentType;
                    LastModified = Properties.LastModified;
                }
                catch (global::Azure.RequestFailedException e) when(e.Status == 403 || e.Status == 404)
                {
                    // skip get dir properties if don't have read permission
                }
            }

            try
            {
                AccessControl = directoryClient.GetAccessControl();
                Permissions   = AccessControl.Permissions;
                ACL           = PSPathAccessControlEntry.ParsePSPathAccessControlEntrys(AccessControl.AccessControlList);
                Owner         = AccessControl.Owner;
                Group         = AccessControl.Group;
            }
            catch (global::Azure.RequestFailedException e) when(e.Status == 403 || e.Status == 404)
            {
                // skip get dir ACL if don't have read permission
            }
        }
Пример #2
0
 /// <summary>
 /// Azure DataLakeGen2 Item constructor
 /// </summary>
 /// <param name="blobDir">Cloud blob Directory object</param>
 public AzureDataLakeGen2Item(DataLakeDirectoryClient directoryClient)
 {
     Name        = directoryClient.Name;
     Path        = directoryClient.Path;
     Directory   = directoryClient;
     IsDirectory = true;
     if (directoryClient.Path != "/") //if root directory, GetProperties() will fail. Skip until this is fixed.
     {
         Properties   = directoryClient.GetProperties();
         Length       = Properties.ContentLength;
         ContentType  = Properties.ContentType;
         LastModified = Properties.LastModified;
     }
     AccessControl = directoryClient.GetAccessControl();
     Permissions   = AccessControl.Permissions;
     ACL           = PSPathAccessControlEntry.ParsePSPathAccessControlEntrys(AccessControl.AccessControlList);
     Owner         = AccessControl.Owner;
     Group         = AccessControl.Group;
 }