Skip to content

Commit 84573c1

Browse files
authored
Migrated Data Lake to the new generator. (Azure#18366)
1 parent 01ff6bb commit 84573c1

File tree

882 files changed

+96061
-93643
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

882 files changed

+96061
-93643
lines changed

sdk/storage/Azure.Storage.Blobs/src/BlobBaseClient.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ internal BlobBaseClient(
375375
customerProvidedKey: options.CustomerProvidedKey,
376376
encryptionScope: options.EncryptionScope);
377377

378+
_clientSideEncryption = options._clientSideEncryptionOptions?.Clone();
378379
_blobRestClient = BuildBlobRestClient(blobUri);
379380

380381
BlobErrors.VerifyHttpsCustomerProvidedKey(_uri, _clientConfiguration.CustomerProvidedKey);

sdk/storage/Azure.Storage.Common/src/Shared/ClientDiagnostics.cs

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Collections.Generic;
66
using System.Text;
7+
using System.Text.Json;
78
using System.Xml;
89
using System.Xml.Linq;
910
using Azure.Storage;
@@ -37,24 +38,49 @@ ref IDictionary<string, string>? additionalInfo
3738

3839
if (content != null)
3940
{
40-
XDocument xml = XDocument.Parse(content);
41-
errorCode = xml.Root.Element(Constants.ErrorCode).Value;
42-
message = xml.Root.Element(Constants.ErrorMessage).Value;
41+
// XML body
42+
if (responseHeaders.ContentType.Contains(Constants.ContentTypeApplicationXml))
43+
{
44+
XDocument xml = XDocument.Parse(content);
45+
errorCode = xml.Root.Element(Constants.ErrorCode).Value;
46+
message = xml.Root.Element(Constants.ErrorMessage).Value;
4347

44-
foreach (XElement element in xml.Root.Elements())
48+
foreach (XElement element in xml.Root.Elements())
49+
{
50+
switch (element.Name.LocalName)
51+
{
52+
case Constants.ErrorCode:
53+
case Constants.ErrorMessage:
54+
continue;
55+
default:
56+
additionalInfo[element.Name.LocalName] = element.Value;
57+
break;
58+
}
59+
}
60+
}
61+
62+
// Json body
63+
else if (responseHeaders.ContentType.Contains(Constants.ContentTypeApplicationJson))
4564
{
46-
switch (element.Name.LocalName)
65+
JsonDocument json = JsonDocument.Parse(content);
66+
JsonElement error = json.RootElement.GetProperty(Constants.ErrorPropertyKey);
67+
68+
IDictionary<string, string> details = default;
69+
if (error.TryGetProperty(Constants.DetailPropertyKey, out JsonElement detail))
4770
{
48-
case Constants.ErrorCode:
49-
case Constants.ErrorMessage:
50-
continue;
51-
default:
52-
additionalInfo[element.Name.LocalName] = element.Value;
53-
break;
71+
details = new Dictionary<string, string>();
72+
foreach (JsonProperty property in detail.EnumerateObject())
73+
{
74+
details[property.Name] = property.Value.GetString();
75+
}
5476
}
77+
78+
message = error.GetProperty(Constants.MessagePropertyKey).GetString();
79+
errorCode = error.GetProperty(Constants.CodePropertyKey).GetString();
80+
additionalInfo = details;
5581
}
5682
}
57-
// Error response does not have a content body.
83+
// No response body.
5884
else
5985
{
6086
// The other headers will appear in the "Headers" section of the Exception message.

sdk/storage/Azure.Storage.Common/src/Shared/Constants.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ internal static class Constants
9494
public const string CommaString = ",";
9595
public const char CommaChar = ',';
9696

97+
public const string ContentTypeApplicationXml = "application/xml";
98+
public const string ContentTypeApplicationJson = "application/json";
99+
100+
public const string ErrorPropertyKey = "error";
101+
public const string DetailPropertyKey = "detail";
102+
public const string MessagePropertyKey = "message";
103+
public const string CodePropertyKey = "code";
104+
97105
public const string Iso8601Format = "yyyy'-'MM'-'dd'T'HH':'mm':'ssZ";
98106

99107
/// <summary>

sdk/storage/Azure.Storage.Files.DataLake/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Release History
22

33
## 12.7.0-beta.2 (Unreleased)
4-
4+
- Changed error codes from numerical (404) to descriptive (PathNotFound).
55

66
## 12.7.0-beta.1 (2021-02-09)
77
- Added support for service version 2020-06-12.

sdk/storage/Azure.Storage.Files.DataLake/src/Azure.Storage.Files.DataLake.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<Compile Include="..\..\Azure.Storage.Blobs\src\Sas\SasQueryParametersExtensions.cs" Link="Shared\Sas\KeySasQueryParametersExtensions.cs" />
4343
<Compile Include="$(AzureStorageSharedSources)AggregatingProgressIncrementer.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
4444
<Compile Include="$(AzureStorageSharedSources)Constants.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
45+
<Compile Include="$(AzureStorageSharedSources)ClientDiagnostics.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
4546
<Compile Include="$(AzureStorageSharedSources)Errors.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
4647
<Compile Include="$(AzureStorageSharedSources)Errors.Clients.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
4748
<Compile Include="$(AzureStorageSharedSources)GeoRedundantReadPolicy.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
@@ -54,6 +55,7 @@
5455
<Compile Include="$(AzureStorageSharedSources)SasQueryParametersInternals.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
5556
<Compile Include="$(AzureStorageSharedSources)SharedAccessSignatureCredentials.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
5657
<Compile Include="$(AzureStorageSharedSources)SlicedStream.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
58+
<Compile Include="$(AzureStorageSharedSources)StorageClientConfiguration.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
5759
<Compile Include="$(AzureStorageSharedSources)StorageClientOptions.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
5860
<Compile Include="$(AzureStorageSharedSources)StorageConnectionString.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
5961
<Compile Include="$(AzureStorageSharedSources)StorageCollectionEnumerator.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using Azure.Core.Pipeline;
5+
using Azure.Storage.Shared;
6+
7+
namespace Azure.Storage.Files.DataLake
8+
{
9+
internal class DataLakeClientConfiguration : StorageClientConfiguration
10+
{
11+
public DataLakeClientOptions.ServiceVersion Version { get; internal set; }
12+
13+
public DataLakeClientConfiguration(
14+
HttpPipeline pipeline,
15+
StorageSharedKeyCredential sharedKeyCredential,
16+
ClientDiagnostics clientDiagnostics,
17+
DataLakeClientOptions.ServiceVersion version)
18+
: base(pipeline, sharedKeyCredential, clientDiagnostics)
19+
{
20+
Version = version;
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)