forked from robinrodricks/FluentStorage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAzureDataLakeStorage.cs
More file actions
70 lines (52 loc) · 2.79 KB
/
Copy pathAzureDataLakeStorage.cs
File metadata and controls
70 lines (52 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Azure.Storage;
using Azure.Storage.Blobs;
using Blobs;
using FluentStorage.Blobs;
using FluentStorage.Azure.Blobs.Gen2.Model;
using FluentStorage.Utils.Objects;
using Azure.Core.Pipeline;
using FluentStorage.Azure.Identity;
namespace FluentStorage.Azure.Blobs {
class AzureDataLakeStorage : AzureBlobStorage, IAzureDataLakeStorage {
private readonly ExtendedSdk _extended;
public AzureDataLakeStorage(BlobServiceClient client, string accountName, StorageSharedKeyCredential sasSigningCredentials = null, string containerName = null, AzureCloudEnvironment azureCloudEnvironment = default) : base(client, accountName, sasSigningCredentials, containerName) {
_extended = new ExtendedSdk(client, accountName, azureCloudEnvironment);
// Fix #41: `ExtendedSdk.GetHttpPipeline` needs to be manually set otherwise connection to DataLake Gen2 fails
// get `client.ClientConfiguration.Pipeline`
var config = Reflections.GetProp(client, "_clientConfiguration", false);
var pipeline = Reflections.GetPropTyped<HttpPipeline>(config, "Pipeline", false);
// link the pipeline to the client
Reflections.SetProp(_extended, "_httpPipeline", pipeline);
}
#region [ Data Lake Storage ]
public Task<IReadOnlyCollection<Filesystem>> ListFilesystemsAsync(CancellationToken cancellationToken = default) {
return _extended.ListFilesystemsAsync(cancellationToken);
}
public Task CreateFilesystemAsync(string filesystemName, CancellationToken cancellationToken = default) {
return _extended.CreateFilesystemAsync(filesystemName, cancellationToken);
}
public Task DeleteFilesystemAsync(string filesystemName, CancellationToken cancellationToken = default) {
return _extended.DeleteFilesystemAsync(filesystemName, cancellationToken);
}
public Task SetAccessControlAsync(string fullPath, AccessControl accessControl, CancellationToken cancellationToken = default) {
return _extended.SetAccessControlAsync(fullPath, accessControl, cancellationToken);
}
public Task<AccessControl> GetAccessControlAsync(string fullPath, bool getUpn = false, CancellationToken cancellationToken = default) {
return _extended.GetAccessControlAsync(fullPath, getUpn, cancellationToken);
}
#endregion
protected override Task DeleteAsync(string fullPath, CancellationToken cancellationToken) {
return _extended.DeleteAsync(fullPath, cancellationToken);
}
public override Task<IReadOnlyCollection<Blob>> ListAsync(
ListOptions options, CancellationToken cancellationToken) {
return _extended.ListAsync(options, cancellationToken);
}
protected override Task<Blob> GetBlobAsync(string fullPath, CancellationToken cancellationToken) {
return _extended.GetBlobAsync(fullPath, cancellationToken);
}
}
}