Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1469f3b
SDK refresh to support new API version (#1)
sashanm Oct 17, 2019
07b69a4
Added recorded sessions to fix CI (#2)
sashanm Oct 17, 2019
fca0c83
[Event Hubs Client] Track Two: Fifth Preview (AMQP Producer)
jsquire Oct 8, 2019
631130d
fix blobs readme.md yaml structure (#8182)
JoshLove-msft Oct 17, 2019
c50152c
[Storage] Change ShareClient.SetQuotaInternal and ListSharesIncludeTy…
ShivangiReja Oct 17, 2019
0606479
[Event Hubs Client] Track Two: Fifth Preview (AMQP Refactoring)
jsquire Oct 16, 2019
d4a4095
Expand default header allow-list (#8166)
pakrym Oct 17, 2019
2c36330
Make BlobBlock a struct (#8180)
pakrym Oct 17, 2019
33b8a65
[Storage] Rename IPRange to SasIPRange (#8170)
ShivangiReja Oct 17, 2019
ba25999
Fix issue where any retry will fail to AppConfig service. (#8184)
annelo-msft Oct 17, 2019
5f6fbdc
Turn large or mutable structs back into classes (#8178)
pakrym Oct 17, 2019
7355195
Add XML doc comments to types in Azure.Core (#8147)
pakrym Oct 17, 2019
31ea349
[Storage] Make GeoReplicationStatus a regular enum (#8197)
ShivangiReja Oct 17, 2019
7dac1af
Use correct suffix for lockfile
ellismg Oct 17, 2019
9d25e16
Revert accidental change (#8207)
pakrym Oct 18, 2019
66f2e67
Remove AzureExtensions (#8193)
pakrym Oct 18, 2019
8a44c77
Split out ForceCloseHandles into two methods (#8134)
JoshLove-msft Oct 18, 2019
eab33d4
Merge branch 'master' of https://github.com/AzureDataBox/azure-sdk-fo…
sashanm Oct 18, 2019
9de3cf2
Coder review fix
sashanm Oct 18, 2019
fd12c0f
SDK refresh to support new API version (#1)
sashanm Oct 17, 2019
82eabce
Added recorded sessions to fix CI (#2)
sashanm Oct 17, 2019
7b51014
Rebasing to remove commits
sashanm Oct 18, 2019
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
2 changes: 1 addition & 1 deletion eng/CodeAnalysis.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
<Rule Id="SA1626" Action="None" /> <!-- Single-line comments should not use documentation style slashes -->
<Rule Id="SA1627" Action="None" /> <!-- Documentation text should not be empty -->
<Rule Id="SA1628" Action="None" /> <!-- Documentation text should begin with a capital letter -->
<Rule Id="SA1629" Action="None" /> <!-- Documentation text should end with a period -->
<Rule Id="SA1629" Action="Info" /> <!-- Documentation text should end with a period -->
<Rule Id="SA1630" Action="None" /> <!-- Documentation text should contain whitespace -->
<Rule Id="SA1631" Action="None" /> <!-- Documentation should meet character percentage -->
<Rule Id="SA1632" Action="None" /> <!-- Documentation text should meet minimum character length -->
Expand Down
14 changes: 14 additions & 0 deletions eng/mgmt/mgmtmetadata/databox_resource-manager.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Installing AutoRest version: latest
AutoRest installed successfully.
Commencing code generation
Generating CSharp code
Executing AutoRest command
cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/databox/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --tag=package-2019-09 --csharp-sdks-folder=D:\god\azure_sdk_net\azure-sdk-for-net\sdk
2019-10-17 06:34:11 UTC
Azure-rest-api-specs repository information
GitHub fork: Azure
Branch: master
Commit: 59998f796f05580bc1d43ba39f0170204113fa91
AutoRest information
Requested version: latest
Bootstrapper version: autorest@2.0.4283
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ private async ValueTask ProcessAsync(HttpMessage message, bool async)
var signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.ASCII.GetBytes(stringToSign))); // Calculate the signature
string signedHeaders = "date;host;x-ms-content-sha256"; // Semicolon separated header names

// TODO (pri 3): should date header writing be moved out from here?
message.Request.Headers.Add("Date", utcNowString);
message.Request.Headers.Add("x-ms-content-sha256", contentHash);
message.Request.Headers.Add("Authorization", $"HMAC-SHA256 Credential={_credential}&SignedHeaders={signedHeaders}&Signature={signature}");
message.Request.Headers.SetValue("Date", utcNowString);
message.Request.Headers.SetValue("x-ms-content-sha256", contentHash);
message.Request.Headers.SetValue("Authorization", $"HMAC-SHA256 Credential={_credential}&SignedHeaders={signedHeaders}&Signature={signature}");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -820,6 +821,29 @@ public async Task CustomHeadersAreAdded()
Assert.IsFalse(request.Headers.TryGetValue("x-ms-random-id", out string randomId));
}

[Test]
public async Task AuthorizationHeadersAddedOnceWithRetries()
{
var response = new MockResponse(200);
response.SetContent(SerializationHelpers.Serialize(s_testSetting, SerializeSetting));

var mockTransport = new MockTransport(new MockResponse(503), response);
ConfigurationClient service = CreateTestService(mockTransport);

ConfigurationSetting setting = await service.GetAsync(s_testSetting.Key, s_testSetting.Label);

var retriedRequest = mockTransport.Requests[1];

AssertRequestCommon(retriedRequest);
Assert.True(retriedRequest.Headers.TryGetValues("Date", out var dateHeaders));
Assert.True(retriedRequest.Headers.TryGetValues("x-ms-content-sha256", out var contentHashHeaders));
Assert.True(retriedRequest.Headers.TryGetValues("Authorization", out var authorizationHeaders));
Assert.AreEqual(1, dateHeaders.Count());
Assert.AreEqual(1, contentHashHeaders.Count());
Assert.AreEqual(1, authorizationHeaders.Count());
}


private void AssertContent(byte[] expected, MockRequest request, bool compareAsString = true)
{
using (var stream = new MemoryStream())
Expand Down
20 changes: 18 additions & 2 deletions sdk/core/Azure.Core/src/AccessToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,33 @@

namespace Azure.Core
{
/// <summary>
/// Represents an Azure service bearer access token with expiry information.
/// </summary>
public struct AccessToken
{
/// <summary>
/// Creates a new instance of <see cref="AccessToken"/> using the provided <paramref name="accessToken"/> and <paramref name="expiresOn"/>.
/// </summary>
/// <param name="accessToken">The bearer access token value.</param>
/// <param name="expiresOn">The bearer access token expiry date.</param>
public AccessToken(string accessToken, DateTimeOffset expiresOn)
{
Token = accessToken;
ExpiresOn = expiresOn;
}

public string Token { get; private set; }
/// <summary>
/// Get the access token value.
/// </summary>
public string Token { get; }

public DateTimeOffset ExpiresOn { get; private set; }
/// <summary>
/// Gets the time when the provided token expires.
/// </summary>
public DateTimeOffset ExpiresOn { get; }

/// <inheritdoc />
public override bool Equals(object? obj)
{
if (obj is AccessToken accessToken)
Expand All @@ -27,6 +42,7 @@ public override bool Equals(object? obj)
return false;
}

/// <inheritdoc />
public override int GetHashCode()
{
return Token.GetHashCode() ^ ExpiresOn.GetHashCode();
Expand Down
4 changes: 2 additions & 2 deletions sdk/core/Azure.Core/src/AsyncPageable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected AsyncPageable(CancellationToken cancellationToken) =>

/// <summary>
/// Enumerate the values a <see cref="Page{T}"/> at a time. This may
/// make mutliple service requests.
/// make multiple service requests.
/// </summary>
/// <param name="continuationToken">
/// A continuation token indicating where to resume paging or null to
Expand All @@ -60,7 +60,7 @@ public abstract IAsyncEnumerable<Page<T>> AsPages(

/// <summary>
/// Enumerate the values in the collection asynchronously. This may
/// make mutliple service requests.
/// make multiple service requests.
/// </summary>
/// <param name="cancellationToken">
/// The <see cref="CancellationToken"/> used for requests made while
Expand Down
51 changes: 0 additions & 51 deletions sdk/core/Azure.Core/src/AzureExtensions.cs

This file was deleted.

27 changes: 25 additions & 2 deletions sdk/core/Azure.Core/src/ClientOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,48 @@

namespace Azure.Core
{
/// <summary>
/// Base type for all client option types, exposes various common client options like <see cref="Diagnostics"/>, <see cref="Retry"/>, <see cref="Transport"/>.
/// </summary>
public abstract class ClientOptions
{
private HttpPipelineTransport _transport = HttpClientTransport.Shared;

/// <summary>
/// Creates a new instance of <see cref="ClientOptions"/>.
/// </summary>
protected ClientOptions()
{
Retry = new RetryOptions();
Diagnostics = new DiagnosticsOptions();
}

/// <summary>
/// The <see cref="HttpPipelineTransport"/> to be used for this client. Defaults to an instance of <see cref="HttpClientTransport"/>.
/// </summary>
public HttpPipelineTransport Transport
{
get => _transport;
set => _transport = value ?? throw new ArgumentNullException(nameof(value));
}

/// <summary>
/// Gets the client diagnostic options.
/// </summary>
public DiagnosticsOptions Diagnostics { get; }

/// <summary>
/// Gets the client retry options.
/// </summary>
public RetryOptions Retry { get; }

/// <summary>
/// Adds an <see cref="HttpPipeline"/> policy into the client pipeline. The position of policy in the pipeline is controlled by <paramref name="position"/> parameter.
/// If you want the policy to execute once per client request use <see cref="HttpPipelinePosition.PerCall"/> otherwise use <see cref="HttpPipelinePosition.PerRetry"/>
/// to run the policy for every retry. Note that the same instance of <paramref name="policy"/> would be added to all pipelines of client constructed using this <see cref="ClientOptions"/> object.
/// </summary>
/// <param name="policy">The <see cref="HttpPipelinePolicy"/> instance to be added to the pipeline.</param>
/// <param name="position">The position of policy in the pipeline.</param>
public void AddPolicy(HttpPipelinePolicy policy, HttpPipelinePosition position)
{
switch (position)
Expand All @@ -47,15 +69,16 @@ public void AddPolicy(HttpPipelinePolicy policy, HttpPipelinePosition position)

internal IList<HttpPipelinePolicy> PerRetryPolicies { get; } = new List<HttpPipelinePolicy>();

#region nobody wants to see these
/// <inheritdoc />
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object? obj) => base.Equals(obj);

/// <inheritdoc />
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode() => base.GetHashCode();

/// <inheritdoc />
[EditorBrowsable(EditorBrowsableState.Never)]
public override string ToString() => base.ToString();
#endregion
}
}
34 changes: 17 additions & 17 deletions sdk/core/Azure.Core/src/Cryptography/IKeyEncryptionKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Azure.Core.Cryptography
{
/// <summary>
/// A key which is used to encrypt, or wrap, another key
/// A key which is used to encrypt, or wrap, another key.
/// </summary>
public interface IKeyEncryptionKey
{
Expand All @@ -18,39 +18,39 @@ public interface IKeyEncryptionKey
string KeyId { get; }

/// <summary>
/// Encrypts the specified key using the specified algorithm
/// Encrypts the specified key using the specified algorithm.
/// </summary>
/// <param name="algorithm">The key wrap algorithm used to encrypt the specified key</param>
/// <param name="key">The key to be encrypted</param>
/// <param name="algorithm">The key wrap algorithm used to encrypt the specified key.</param>
/// <param name="key">The key to be encrypted.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
/// <returns>The encrypted key bytes</returns>
/// <returns>The encrypted key bytes.</returns>
byte[] WrapKey(string algorithm, ReadOnlyMemory<byte> key, CancellationToken cancellationToken = default);

/// <summary>
/// Encrypts the specified key using the specified algorithm
/// Encrypts the specified key using the specified algorithm.
/// </summary>
/// <param name="algorithm">The key wrap algorithm used to encrypt the specified key</param>
/// <param name="key">The key to be encrypted</param>
/// <param name="algorithm">The key wrap algorithm used to encrypt the specified key.</param>
/// <param name="key">The key to be encrypted.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
/// <returns>The encrypted key bytes</returns>
/// <returns>The encrypted key bytes.</returns>
Task<byte[]> WrapKeyAsync(string algorithm, ReadOnlyMemory<byte> key, CancellationToken cancellationToken = default);

/// <summary>
/// Decrypts the specified encrpted key using the specified algorithm
/// Decrypts the specified encrypted key using the specified algorithm.
/// </summary>
/// <param name="algorithm">The key wrap algorithm which was used to encrypt the specified encrypted key</param>
/// <param name="encryptedKey">The encrypted key to be decrypted</param>
/// <param name="algorithm">The key wrap algorithm which was used to encrypt the specified encrypted key.</param>
/// <param name="encryptedKey">The encrypted key to be decrypted.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
/// <returns>The decrpted key bytes</returns>
/// <returns>The decrypted key bytes.</returns>
byte[] UnwrapKey(string algorithm, ReadOnlyMemory<byte> encryptedKey, CancellationToken cancellationToken = default);

/// <summary>
/// Decrypts the specified encrpted key using the specified algorithm
/// Decrypts the specified encrypted key using the specified algorithm.
/// </summary>
/// <param name="algorithm">The key wrap algorithm which was used to encrypt the specified encrypted key</param>
/// <param name="encryptedKey">The encrypted key to be decrypted</param>
/// <param name="algorithm">The key wrap algorithm which was used to encrypt the specified encrypted key.</param>
/// <param name="encryptedKey">The encrypted key to be decrypted.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
/// <returns>The decrpted key bytes</returns>
/// <returns>The decrypted key bytes.</returns>
Task<byte[]> UnwrapKeyAsync(string algorithm, ReadOnlyMemory<byte> encryptedKey, CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ namespace Azure.Core.Cryptography
public interface IKeyEncryptionKeyResolver
{
/// <summary>
/// Retrieves the key encryption key corresponding to the specified keyId
/// Retrieves the key encryption key corresponding to the specified keyId.
/// </summary>
/// <param name="keyId">The key idenitifier of the key encryption key to retrieve</param>
/// <param name="keyId">The key identifier of the key encryption key to retrieve.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
/// <returns>The key encryption key corresponding to the specified keyId</returns>
/// <returns>The key encryption key corresponding to the specified keyId.</returns>
IKeyEncryptionKey Resolve(string keyId, CancellationToken cancellationToken = default);

/// <summary>
/// Retrieves the key encryption key corresponding to the specified keyId
/// Retrieves the key encryption key corresponding to the specified keyId.
/// </summary>
/// <param name="keyId">The key idenitifier of the key encryption key to retrieve</param>
/// <param name="keyId">The key identifier of the key encryption key to retrieve.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
/// <returns>The key encryption key corresponding to the specified keyId</returns>
/// <returns>The key encryption key corresponding to the specified keyId.</returns>
Task<IKeyEncryptionKey> ResolveAsync(string keyId, CancellationToken cancellationToken = default);
}
}
Loading