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

[INTERNAL] CI: Fixes styling and documentation issues #4774

Merged
merged 10 commits into from
Oct 9, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ public override byte[] EncryptData(byte[] plainText)
/// cell_tag = HMAC_SHA-2-256(mac_key, versionbyte + cell_iv + cell_ciphertext + versionbyte_length)
/// cell_blob = versionbyte + cell_tag + cell_iv + cell_ciphertext
/// </summary>
/// <param name="plainText">Plaintext data to be encrypted</param>
/// <returns>Returns the ciphertext corresponding to the plaintext.</returns>
public override int EncryptData(byte[] plainText, int plainTextOffset, int plainTextLength, byte[] output, int outputOffset)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Microsoft.Azure.Cosmos.Encryption.Custom
using System;

/// <summary>
/// This is an empty implementation of CosmosDiagnosticsContext which has been plumbed through the DataEncryptionKeyProvider & EncryptionContainer.
/// This is an empty implementation of CosmosDiagnosticsContext which has been plumbed through the DataEncryptionKeyProvider and EncryptionContainer.
/// This may help adding diagnostics more easily in future.
/// </summary>
internal class CosmosDiagnosticsContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ namespace Microsoft.Azure.Cosmos.Encryption.Custom
internal sealed class EncryptionTransactionalBatchOperationResult<T> : TransactionalBatchOperationResult<T>
{
/// <summary>
/// Initializes a new instance of the <see cref="TransactionalBatchOperationResult{T}"/> class.
/// Initializes a new instance of the <see cref="EncryptionTransactionalBatchOperationResult{T}"/> class.
/// </summary>
/// <param name="result">BatchOperationResult with stream resource.</param>
/// <param name="resource">Deserialized resource.</param>
internal EncryptionTransactionalBatchOperationResult(T resource)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

namespace Microsoft.Azure.Cosmos.Encryption.Custom
{
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos.Fluent;

/// <summary>
/// Container for data encryption keys. Provides methods to create, re-wrap, read and enumerate data encryption keys.
Expand Down Expand Up @@ -132,7 +134,7 @@ public abstract Task<ItemResponse<DataEncryptionKeyProperties>> RewrapDataEncryp
/// </code>
/// </example>
/// <remarks>
/// <see cref="DataEncryptionKey.ReadDataEncryptionKeyAsync" /> is recommended for single data encryption key look-up.
/// <see cref="DataEncryptionKeyContainer.ReadDataEncryptionKeyAsync" /> is recommended for single data encryption key look-up.
/// </remarks>
public abstract FeedIterator<T> GetDataEncryptionKeyQueryIterator<T>(
string queryText = null,
Expand Down Expand Up @@ -167,7 +169,7 @@ public abstract FeedIterator<T> GetDataEncryptionKeyQueryIterator<T>(
/// </code>
/// </example>
/// <remarks>
/// <see cref="DataEncryptionKey.ReadDataEncryptionKeyAsync" /> is recommended for single data encryption key look-up.
/// <see cref="DataEncryptionKeyContainer.ReadDataEncryptionKeyAsync" /> is recommended for single data encryption key look-up.
/// </remarks>
public abstract FeedIterator<T> GetDataEncryptionKeyQueryIterator<T>(
QueryDefinition queryDefinition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.Azure.Cosmos.Encryption.Custom
using Newtonsoft.Json.Linq;

/// <summary>
/// Input type should implement this abstract class for lazy decryption & to retrieve the details in the write path.
/// Input type should implement this abstract class for lazy decryption and to retrieve the details in the write path.
/// </summary>
public abstract class EncryptableItem
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.Azure.Cosmos.Encryption.Custom
using Microsoft.Data.Encryption.Cryptography;

/// <summary>
/// Encryption Algorithm provided by MDE Encryption Package
/// Encryption Algorithm provided by MDE Encryption Package.
/// </summary>
internal sealed class MdeEncryptionAlgorithm : DataEncryptionKey
{
Expand All @@ -27,9 +27,6 @@ internal sealed class MdeEncryptionAlgorithm : DataEncryptionKey
/// <see href="http://tools.ietf.org/html/draft-mcgrew-aead-aes-cbc-hmac-sha2-05">here</see> .
/// More specifically this implements AEAD_AES_256_CBC_HMAC_SHA256 algorithm.
/// </summary>
/// <param name="dekProperties"> Data Encryption Key properties</param>
/// <param name="encryptionType"> Encryption type </param>
/// <param name="encryptionKeyStoreProvider"> EncryptionKeyStoreProvider for wrapping and unwrapping </param>
public MdeEncryptionAlgorithm(
DataEncryptionKeyProperties dekProperties,
Data.Encryption.Cryptography.EncryptionType encryptionType,
Expand Down Expand Up @@ -92,8 +89,6 @@ public MdeEncryptionAlgorithm(
/// <see href="http://tools.ietf.org/html/draft-mcgrew-aead-aes-cbc-hmac-sha2-05">here</see> .
/// More specifically this implements AEAD_AES_256_CBC_HMAC_SHA256 algorithm.
/// </summary>
/// <param name="dataEncryptionKey"> Data Encryption Key </param>
/// <param name="encryptionType"> Encryption type </param>
public MdeEncryptionAlgorithm(
byte[] rawkey,
Data.Encryption.Cryptography.DataEncryptionKey dataEncryptionKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.Azure.Cosmos.Encryption.Custom
using System.IO;

/// <summary>
/// Adjusted implementation of .Net StringReader reading from a Memory<char> instead of a string.
/// Adjusted implementation of .Net StringReader reading from a Memory{char} instead of a string.
/// </summary>
internal class MemoryTextReader : TextReader
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<PackageLicenseUrl>https://aka.ms/netcoregaeula</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/Azure/azure-cosmos-dotnet-v3</PackageProjectUrl>
<PackageIconUrl>http://go.microsoft.com/fwlink/?LinkID=288890</PackageIconUrl>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<PackageTags>microsoft;azure;cosmos;cosmosdb;documentdb;docdb;nosql;azureofficial;dotnetcore;netcore;netstandard;client;encryption;byok</PackageTags>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Microsoft.Azure.Cosmos.Encryption.Custom
{
internal static class AssemblyKeys
{
/// <summary>TestPublicKey is an unsupported strong key for testing and internal use only</summary>
/// <summary>TestPublicKey is an unsupported strong key for testing and internal use only.</summary>
internal const string TestPublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100197c25d0a04f73cb271e8181dba1c0c713df8deebb25864541a66670500f34896d280484b45fe1ff6c29f2ee7aa175d8bcbd0c83cc23901a894a86996030f6292ce6eda6e6f3e6c74b3c5a3ded4903c951e6747e6102969503360f7781bf8bf015058eb89b7621798ccc85aaca036ff1bc1556bb7f62de15908484886aa8bbae";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ internal sealed class CosmosJsonDotNetSerializer
private readonly JsonSerializerSettings serializerSettings;

/// <summary>
/// Create a serializer that uses the JSON.net serializer
/// Initializes a new instance of the <see cref="CosmosJsonDotNetSerializer"/> class.
/// </summary>
/// <remarks>
/// This is internal to reduce exposure of JSON.net types so
/// it is easier to convert to System.Text.Json
/// it is easier to convert to System.Text.Json.
/// </remarks>
internal CosmosJsonDotNetSerializer(JsonSerializerSettings jsonSerializerSettings = null)
{
Expand All @@ -35,9 +35,9 @@ internal CosmosJsonDotNetSerializer(JsonSerializerSettings jsonSerializerSetting
/// <summary>
/// Convert a Stream to the passed in type.
/// </summary>
/// <typeparam name="T">The type of object that should be deserialized</typeparam>
/// <param name="stream">An open stream that is readable that contains JSON</param>
/// <returns>The object representing the deserialized stream</returns>
/// <typeparam name="T">The type of object that should be deserialized.</typeparam>
/// <param name="stream">An open stream that is readable that contains JSON.</param>
/// <returns>The object representing the deserialized stream.</returns>
public T FromStream<T>(Stream stream)
{
if (stream == null)
Expand All @@ -61,9 +61,9 @@ public T FromStream<T>(Stream stream)
/// <summary>
/// Converts an object to a open readable stream.
/// </summary>
/// <typeparam name="T">The type of object being serialized</typeparam>
/// <param name="input">The object to be serialized</param>
/// <returns>An open readable stream containing the JSON of the serialized object</returns>
/// <typeparam name="T">The type of object being serialized.</typeparam>
/// <param name="input">The object to be serialized.</param>
/// <returns>An open readable stream containing the JSON of the serialized object.</returns>
public MemoryStream ToStream<T>(T input)
{
MemoryStream streamPayload = new MemoryStream();
Expand All @@ -83,7 +83,7 @@ public MemoryStream ToStream<T>(T input)

/// <summary>
/// JsonSerializer has hit a race conditions with custom settings that cause null reference exception.
/// To avoid the race condition a new JsonSerializer is created for each call
/// To avoid the race condition a new JsonSerializer is created for each call.
/// </summary>
private JsonSerializer GetSerializer()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public EncryptionContainerResponse(
public override HttpStatusCode StatusCode => this.containerResponse.StatusCode;

/// <summary>
/// Get <see cref="Cosmos.Container"/> implicitly from <see cref="EncryptionContainerResponse"/>
/// Get <see cref="Cosmos.Container"/> implicitly from <see cref="EncryptionContainerResponse"/>.
/// </summary>
/// <param name="response">ContainerResponse</param>
/// <param name="response">ContainerResponse.</param>
public static implicit operator Container(EncryptionContainerResponse response)
{
return response.Container;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ public async Task<AeadAes256CbcHmac256EncryptionAlgorithm> BuildEncryptionAlgori
/// Helper function which force refreshes the gateway cache to fetch the latest client encryption key to build ProtectedDataEncryptionKey object for the encryption setting.
/// </summary>
/// <param name="existingCekEtag">Client encryption key etag to be passed, which is used as If-None-Match Etag for the request. </param>
/// <param name="cancellationToken"> cacellation token. </param>
/// <param name="refreshRetriedOnException"> KEK expired exception. </param>
/// <param name="cancellationToken"> Cancellation token. </param>
/// <returns>ProtectedDataEncryptionKey object. </returns>
private async Task<ProtectedDataEncryptionKey> ForceRefreshGatewayCacheAndBuildProtectedDataEncryptionKeyAsync(
string existingCekEtag,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ namespace Microsoft.Azure.Cosmos.Encryption
internal sealed class EncryptionTransactionalBatchOperationResult<T> : TransactionalBatchOperationResult<T>
{
/// <summary>
/// Initializes a new instance of the <see cref="TransactionalBatchOperationResult{T}"/> class.
/// Initializes a new instance of the <see cref="EncryptionTransactionalBatchOperationResult{T}"/> class.
/// </summary>
/// <param name="result">BatchOperationResult with stream resource.</param>
/// <param name="resource">Deserialized resource.</param>
internal EncryptionTransactionalBatchOperationResult(T resource)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<PackageProjectUrl>https://github.com/Azure/azure-cosmos-dotnet-v3</PackageProjectUrl>
<PackageIconUrl>http://go.microsoft.com/fwlink/?LinkID=288890</PackageIconUrl>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<PackageTags>microsoft;azure;cosmos;cosmosdb;documentdb;docdb;nosql;azureofficial;dotnetcore;netcore;netstandard;client;encryption;byok</PackageTags>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Microsoft.Azure.Cosmos.Encryption.Custom
{
internal static class AssemblyKeys
{
/// <summary>TestPublicKey is an unsupported strong key for testing and internal use only</summary>
/// <summary>TestPublicKey is an unsupported strong key for testing and internal use only.</summary>
internal const string TestPublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100197c25d0a04f73cb271e8181dba1c0c713df8deebb25864541a66670500f34896d280484b45fe1ff6c29f2ee7aa175d8bcbd0c83cc23901a894a86996030f6292ce6eda6e6f3e6c74b3c5a3ded4903c951e6747e6102969503360f7781bf8bf015058eb89b7621798ccc85aaca036ff1bc1556bb7f62de15908484886aa8bbae";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Microsoft.Azure.Cosmos.Encryption

/// <summary>
/// Cache which supports asynchronous value initialization.
/// It ensures that for given key only single inintialization funtion is running at any point in time.
/// It ensures that for given key only single initialization function is running at any point in time.
/// </summary>
/// <typeparam name="TKey">Type of keys.</typeparam>
/// <typeparam name="TValue">Type of values.</typeparam>
Expand Down Expand Up @@ -168,7 +168,7 @@ public bool TryRemoveIfCompleted(TKey key)
/// <summary>
/// Remove value from cache and return it if present.
/// </summary>
/// <param name="key"> Key </param>
/// <param name="key"> Key. </param>
/// <returns>Value if present, default value if not present.</returns>
public async Task<TValue> RemoveAsync(TKey key)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
<PackageReference Include="Azure.Storage.Blobs" Version="12.16.0" />
<PackageReference Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.0.0-beta.13" />
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="MathNet.Numerics" Version="4.15.0" />
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="*" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>

<ItemGroup Condition=" '$(ProjectRef)' != 'True' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,6 @@ private static bool ShouldContinue(
TimeSpan maxDurationTime = config.RunningTimeDurationAsTimespan;
long maxNumberOfOperations = config.Operations;

if (maxDurationTime == null)
{
return iterationCount < maxNumberOfOperations;
}

if (maxDurationTime.TotalMilliseconds < stopwatch.ElapsedMilliseconds)
{
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<AssemblyName>Microsoft.Azure.Cosmos.FaultInjection</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<SdkProjectRef>True</SdkProjectRef>
</PropertyGroup>

Expand Down
Loading